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

Free Support Forum - aspose.com

In Line+column chart- column chart on secondary y-axis plot inverted

Hi All,

I want to draw a combo (Line+column) chart. when i draw a column chart on secondary y-axis then it draw from secondary x-axis for the same.
but i want to plot this chart on primary x-axis and secondary y-axis.
To get this i write this code-
chart.Axes.SecondaryVerticalAxis.IsPlotOrderReversed = true;
but when i write this code, the value of secondary y-axis starts from top to bottom.


my code to draw Line+column chart is-
Presentation pres = new Presentation();
ISlide sld = pres.Slides[0];
IChart chart = sld.Shapes.AddChart(ChartType.ClusteredColumn, 0, 0, 500, 500);
chart.ChartTitle.AddTextFrameForOverriding(“Sample Title”);
chart.ChartTitle.TextFrameForOverriding.TextFrameFormat.CenterText = NullableBool.True;
chart.ChartTitle.Height = 20;
chart.HasTitle = true;
chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowValue = true;
int defaultWorksheetIndex = 0;
IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();
int s = chart.ChartData.Series.Count;
s = chart.ChartData.Categories.Count;
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 1, “Series 1”), chart.Type);
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 2, “Series 2”), chart.Type);
IChartSeries series = chart.ChartData.Series[0];
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 1, 20));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 1, 50));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 3, 1, 30));
series.PlotOnSecondAxis = true;
chart.Axes.SecondaryVerticalAxis.IsPlotOrderReversed = true;
series = chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 5, “Series 4”), ChartType.ScatterWithStraightLinesAndMarkers);
series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 1, 5, 5), fact.GetCell(defaultWorksheetIndex, 1, 6, 1));

series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 2, 5,10), fact.GetCell(defaultWorksheetIndex, 2, 6, 7));
series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 3, 5, 15), fact.GetCell(defaultWorksheetIndex, 3, 6, 7));

series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 4, 5, 20), fact.GetCell(defaultWorksheetIndex, 4, 6,12));

series.Marker.Size = 10;
series.Marker.Symbol = MarkerStyleType.Circle;

pres.Save(@“D:\”+“Line+Column.pptx”, SaveFormat.Pptx);

Hi Pardeep,


Thank you for posting.

I have observed your requirements and verified the shared sample code using Aspose.Slides for .NET 16.4.0 on my end. The presentation that I have generated using the said version has column chart created on primary X-axis (category axis) and secondary Y-axis (Value Axis). It seems in accordance with you needs. For reference, I have attached the generated presentation as well. If there is still an issue then please share in the form of desired output presentation and snapshot that what you want to generate using Aspose.Slides. I will investigate that further on my end.

Best Regards,

Hi Adnan,

You created Line+column chart as per my need and I want the same but value on secondary y-axis should start from 0, not from 60.

Regards
Pradeep

Hi Pradeep,


I have observed your requirements further and it seems to be an issue with Aspose.Slides. A ticket with ID SLIDESNET-37534 has been added in our issue tracking system to further investigate and resolve the issue. This thread has been associated with ticket so that we may share notification with you once issue will be fixed.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESNET-37534) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,


What should i change in my code to get the desired output.
I am using .dll version 16.9.0

Thanks.

Hi Pradeep,

In order to get the desired results, please replace following line in your code:

chart.Axes.SecondaryVerticalAxis.IsPlotOrderReversed = true;

with

chart.Axes.SecondaryHorizontalAxis.TickLabelPosition = TickLabelPositionType.Low;

I hope this will be helpful.

May Thanks,

Hi Mudassir,


I replaced -
chart.Axes.SecondaryVerticalAxis.IsPlotOrderReversed = true;

with

chart.Axes.SecondaryHorizontalAxis.TickLabelPosition = TickLabelPositionType.Low;
in my code.
what i get as output is in attachment.

Exactly what i want is the same chart but in this chart column should also plot on primary x-axis(horizontal line) as line in plotted.

Thanks.

Hi Pardeep,


I have observed your comments. I request you to please share your code and sample presentation so that we may further investigate issue in details.

Best Regards,

Hi Mudassir,


This is my code-

Presentation pres = new Presentation();
ISlide sld = pres.Slides[0];
IChart chart = sld.Shapes.AddChart(ChartType.ClusteredColumn, 0, 0, 500, 500);
chart.ChartTitle.AddTextFrameForOverriding(“Sample Title”);
chart.ChartTitle.TextFrameForOverriding.TextFrameFormat.CenterText = NullableBool.True;
chart.ChartTitle.Height = 20;
chart.HasTitle = true;
chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowValue = true;
int defaultWorksheetIndex = 0;
IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();
int s = chart.ChartData.Series.Count;
s = chart.ChartData.Categories.Count;
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 1, “Series 1”), chart.Type);
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 2, “Series 2”), chart.Type);
IChartSeries series = chart.ChartData.Series[0];
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 1, 20));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 1, 50));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 3, 1, 30));
series.PlotOnSecondAxis = true;
chart.Axes.SecondaryHorizontalAxis.TickLabelPosition = TickLabelPositionType.Low;
series = chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 5, “Series 4”), ChartType.ScatterWithStraightLinesAndMarkers);
series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 1, 5, 5), fact.GetCell(defaultWorksheetIndex, 1, 6, 1));

series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 2, 5,10), fact.GetCell(defaultWorksheetIndex, 2, 6, 7));
series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 3, 5, 15), fact.GetCell(defaultWorksheetIndex, 3, 6, 7));

series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 4, 5, 20), fact.GetCell(defaultWorksheetIndex, 4, 6,12));

series.Marker.Size = 10;
series.Marker.Symbol = MarkerStyleType.Circle;

pres.Save(@“D:\”+“Line+Column.pptx”, SaveFormat.Pptx);


Output of this code is the last attachment above.
My desired output is the first attachment above.
I want same chart but co-ordinate value on secondary y-axis should start from 0 to 60 not from 60 to 0.

Hope this will help.

Thanks


Hi Luciano,


I have observed your comments. I like to share that we have been able to reproduce the issue and have reopened the ticket. We will share feedback with you soon.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESNET-37534) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.