We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to Set Maximum value of Chart Axis using LINQ

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

@Blegork

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.

@tahir.manzoor

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);
		}
	}

@Blegork

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));

@tahir.manzoor

Perfect. Is it possible to retrieve the value of ChartType?

@Blegork

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.