I am using the LINQ engine to create a report. Is it possible to set the maximum value of axis of Chart Axis with LINQ?
Screenshot_2.png (39.5 KB)
Thanks
I am using the LINQ engine to create a report. Is it possible to set the maximum value of axis of Chart Axis with LINQ?
Screenshot_2.png (39.5 KB)
Thanks
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.
So , I could modify the chart later with Aspose.Words API. How can I search for charts in my document? and update the minimum and maximum value of axis of chart?
Document doc = new Document("C:\\Temp\\Report_out.docx");
NodeCollection shapes = doc.getChildNodes(NodeType.SHAPE, true);
for(int i =0; i < shapes.getCount();i++) {
Shape s = ((Shape)shapes.get(i));
if(s.hasChart()) {
Chart chart = s.getChart();
//chart is a horizontal bar chart??
chart.getAxisX().setMajorUnit(50);
}
}
You are getting the chart from the document correctly. Please use Scaling.Maximum property as shown below.
Chart chart = s.getChart();
ChartAxis xAxis = chart.getAxisY();
xAxis.getScaling().setMinimum(new AxisBound(100.0));
xAxis.getScaling().setMaximum(new AxisBound(700.0));
Unfortunately, Aspose.Words does not provide this feature. We have logged a feature request to get the chart type of chart as WORDSNET-22965 in our issue tracking system. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.
@Blegork Currently we have the public ChartType
enum type that is used as type of a parameter in the public DocumentBuilder.InsertChart
method.
We cannot simply provide a public ChartType
property in the Chart
class, because of combo charts. And we cannot add a Combo
element to the ChartType
enum type, because DocumentBuilder.InsertChart
would not process it.
You should use the ChartSeriesGroup.SeriesType
property of the ChartSeriesType
enum type instead.
Code example to get type of a chart:
Document doc = new Document(fileName);
// Find the chart shape.
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
// Get the chart object.
Chart chart = shape.Chart;
// Write the chart type.
if (chart.SeriesGroups.Count > 1)
Console.WriteLine("This is a combo chart!");
else
Console.WriteLine("The chart type is " + chart.SeriesGroups[0].SeriesType);
The issues you have found earlier (filed as WORDSNET-22965) have been fixed in this Aspose.Words for Java 24.10 update.