How to Set Minimum and Maximum value of Chart Axis using .NET | LINQ Reporting

Hello,
when using linq chart as described here Template Syntax in C#|Aspose.Words for .NET

is there a way to automatically arrange the xmin and xmax based on the data bound to the chart ? if not available by default, how can we change by code xmin/xmax of an existing chart ? (in the documentation i only see the option to insert a new chart and manipulate it)

@miniseb31

Unfortunately, Aspose.Words does not provide the requested feature. Could you please share your input and expected output Word documents? We will then log this feature in our issue tracking system according your requirement.

at least is it possible to open an existing word document and manipulate an existing chart ?

i would like to change the minimimum and maximum. I dont understand why 0 is set when i am in automatic.

image.png (56.2 KB)

@miniseb31

We have logged this feature request as WORDSNET-18571 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

any news for this request ?

@miniseb31

We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. We work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

Currently, this feature is pending for analysis and is in the queue. Once we complete the analysis, we will then be able to provide you an estimate.

You reported this issue in free support forum and it will be treated with normal priority. To speed up the progress of issue’s resolution, we suggest you please check our paid support policies from following link.
Paid Support Policies

@miniseb31

Please use ChartAxis.Scaling.Minimum and ChartAxis.Scaling.Maximum properties to achieve your requirement. Please check the following code example.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert chart.
Shape shape = builder.InsertChart(ChartType.Line, 432, 252);
Chart chart = shape.Chart;

// Clear demo data.
chart.Series.Clear();

// Fill data.
chart.Series.Add("Aspose Test Series",
    new[]
    {
        new DateTime(2017, 11, 06), new DateTime(2017, 11, 09), new DateTime(2017, 11, 15),
        new DateTime(2017, 11, 21), new DateTime(2017, 11, 25), new DateTime(2017, 11, 29)
    },
    new[] { 1.2, 0.3, 2.1, 2.9, 4.2, 5.3 });

ChartAxis xAxis = chart.AxisX;
ChartAxis yAxis = chart.AxisY;

// Set X axis bounds.
xAxis.Scaling.Minimum = new AxisBound(new DateTime(2017, 11, 05).ToOADate());
xAxis.Scaling.Maximum = new AxisBound(new DateTime(2017, 12, 03));

// Set major units to a week and minor units to a day.
xAxis.BaseTimeUnit = AxisTimeUnit.Days;
xAxis.MajorUnit = 7;
xAxis.MinorUnit = 1;
xAxis.MajorTickMark = AxisTickMark.Cross;
xAxis.MinorTickMark = AxisTickMark.Outside;

// Define Y axis properties.
yAxis.TickLabelPosition = AxisTickLabelPosition.High;
yAxis.MajorUnit = 100;
yAxis.MinorUnit = 50;
yAxis.DisplayUnit.Unit = AxisBuiltInUnit.Hundreds;
yAxis.Scaling.Minimum = new AxisBound(100);
yAxis.Scaling.Maximum = new AxisBound(700);

doc.Save(ArtifactsDir + "Charts.ChartAxisProperties.docx");

thanks for the information but i want to do generate the chart with linq reporting. then i want to open the document and search for the plot to modify its minimimum and maximum (according to our application settings). the sample code you provide is when we want to insert a plot from scratch by code. (i would like to take advantage of the linq reporting power)

@miniseb31

Thanks for sharing the detail. We have updated the issue detail according to your requirement. We will inform you via this forum thread once there is an update available on this feature.

Sorry i found the way to get the chart from an existing document but i have a problem

If I use doc.GetChildNodes(NodeType.Shape, true); or a ShapeVisitor, Why cant i get the data points. serie.DataPoints.Count is always zero.
Please see my reproduction console applicationTestGrapheAspose.zip (24.3 KB)

@miniseb31

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-18874. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Regarding WORDSNET-18571, you can generate the chart using LINQ Reporting and update the minimum and maximum value of axis of chart using Scaling.Minimum and Scaling.Maximum properties.

yes i agree we can close WORDSNET-18571 and open WORDSNET-18874

@minisebdev

We have closed the issue WORDSNET-18571. Please let us know if you have any more queries.

The issues you have found earlier (filed as WORDSNET-18874) have been fixed in this Aspose.Words for .NET 20.11 update and this Aspose.Words for Java 20.11 update.

hello thanks for your feedback
i tried with the last version as mentionned, but how can i get x/y values from a datapoint ?

image.png (37.6 KB)

@miniseb31

You can use AxisScaling.Minimum and AxisScaling.Maximum properties to get the minimum and maximum value of the axis.

shape.Chart.AxisX.Scaling.Minimum gives 0 whereas the minimum of the data is not 0 as you can see in the following image. I cant get the minimum of my values but the minimum of the axis.

image.png (19.8 KB)

please advice

@miniseb31

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.