Line graph problem with the axis

Hi,


I want to generate a Chart (Line Chart) using following code :

Aspose.Slides.Charts.IChart chart = s.Shapes.InsertChart(Aspose.Slides.Charts.ChartType.Line, 10, 10, des.SlideSize.Size.Width - 20, des.SlideSize.Size.Height - 10,0);
int defaultWorksheetIndex = 0;
chart.ChartData.Series.Clear();

double[] xarr4 = new double[myElementGraphData.Count];
double[] yarr4 = new double[myElementGraphData.Count];
IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;
for (int j = 0; j < myElementGraphData.Count; j++)
{
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, j+1, 0, myElementGraphData[j].ColItemId), chart.Type);
}
IChartSeries series = chart.ChartData.Series[0];
for (int j = 0; j < myElementGraphData.Count; j++)
{
xarr4[j] = myElementGraphData[j].ColItemId;
string[] num = myElementGraphData[j].Number.Split(’,’);
yarr4[j] = Convert.ToDouble(num[0]);
series.DataPoints.AddDataPointForLineSeries(fact.GetCell(defaultWorksheetIndex, j + 1, 1, yarr4[j]));
}

problem i am facing here is i am not able to c y axis properly i.e. all the tags are getting overlapped.

Legends are coming wrongly.

Note that : if i create the scattered graph with same data i am able to see output properly and from powerpoint if i change the chart type to line i am able to c correct output.

Thanks and Regards,
Amey

Hi Amey,


I have observed your requirements. Can you please provide the generated chart presentation along with desired output presentation. I also request you to please first try using Aspose.Slides for .NET 16.4.0 on your end as well.

Best Regards,

Hi Adnan,


Thanks for replying, i have started using aspose.slides and above code is giving me wrong output.
Attached is the ppt which is generated as output and also the desired graph should look like how it is coming in the attached doc. file.

Thanks and Regards,
Amey

Hi,


I figured it out myself the problem here was the axes labels were overlapping that was because of a for loop in the code where series are getting added :

for (int j = 0; j < myElementGraphData.Count; j++)
{
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, j+1, 0, myElementGraphData[j].ColItemId), chart.Type);
}

this statements should be :
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, j+1, 0, myElementGraphData[j].ColItemId));

Hi Amey,


Its good to know that you have been able to rectify the issue on your end. You are always welcome to share any incurring issue with us.

Best Regards,