I am new to Aspose Slifdes and would lie to create a stacked bar chart with Dateaxis and would also like to change the orientation of the plotting.
Hi,
PresentationEx pres = new PresentationEx();SlideEx sld = pres.getSlides().get_Item(0);ChartEx chart = sld.getShapes().addChart(ChartTypeEx.ClusteredColumn, 10, 60, 700, 300);ChartSeriesEx series = chart.getChartData().getSeries().get_Item(0);String Sername=series.getNameCells().getGetConcateNameFromCells();ChartDataCell cell = series.getNameCells().get_Item(0);//0 is series indexchart.getValueAxis().setSourceLinked(false);chart.getValueAxis().setBaseUnitScale(TimeUnitType.Months);////[$-409]mmm-yy;@chart.getValueAxis().setNumberFormat(“[$-409]mmm-dd;@”);chart.getValueAxis().isAutomaticMajorUnit(false);chart.getValueAxis().isAutomaticMinorUnit(false);chart.getValueAxis().isAutomaticMaxValue(false);chart.getValueAxis().isAutomaticMinValue(false);//Starting day numberchart.getValueAxis().setMinValue(13);//Ending day numberchart.getValueAxis().setMaxValue(365);//Setting month wise intervalchart.getValueAxis().setMajorUnit(30.5f);//setting minor unit to 10 dayschart.getValueAxis().setMinorUnit(10);chart.getValueAxis().setMinorUnitScale(TimeUnitType.Days);chart.getValueAxis().setMajorUnitScale(TimeUnitType.Months);chart.hasLegend (false);pres.write(“D:\Aspose Data\Bar2.pptx”);
Thanks for the sample .It did help me a bit .
Hi,
I have observed your requirements and like to share that if you want to set the minimum value to June 12, then you need to set the axis minimum value to day number of June 12 and max value of axis to desired date day number.
I hope this will clear the concept to you. Secondly, for you inquiry related dates coming in value axis in erratic manner, I like to share that you need to set the Major unit that set as interval for the value axis values. This is constant for all values and one cannot set major unit between two successive intervals. Since some months have 30 and some have 31 days so you get different dates on value axis as it is mapped on number of days and not defined dates.
Please share, if I may help you further in this regard,
Many Thanks,
Thanks for your Input
Hi,
public static void testChart(){PresentationEx pres = new PresentationEx();SlideEx sld = pres.getSlides().get_Item(0);ChartEx chart = sld.getShapes().addChart(ChartTypeEx.ClusteredColumn, 10, 60, 700, 300);ChartSeriesEx series = chart.getChartData().getSeries().get_Item(0);String Sername=series.getNameCells().getGetConcateNameFromCells();ChartDataCell cell = series.getNameCells().get_Item(0);//0 is series indexchart.getValueAxis().setSourceLinked(false);chart.getValueAxis().setBaseUnitScale(TimeUnitType.Months);////[$-409]mmm-yy;@// chart.getValueAxis().setNumberFormat("[$-409]mmm-dd;@");chart.getValueAxis().setNumberFormat(“mmm-yyyy”);chart.getValueAxis().isAutomaticMajorUnit(false);chart.getValueAxis().isAutomaticMinorUnit(false);chart.getValueAxis().isAutomaticMaxValue(false);chart.getValueAxis().isAutomaticMinValue(false);//Starting day number// chart.getValueAxis().setMinValue(13);chart.getValueAxis().setMinValue((365.25f109)+163);//Ending day number// chart.getValueAxis().setMaxValue(365);chart.getValueAxis().setMaxValue((365.25f110)+15);//Setting month wise intervalchart.getValueAxis().setMajorUnit(30.5f);//setting minor unit to 10 dayschart.getValueAxis().setMinorUnit(10);chart.getValueAxis().setMinorUnitScale(TimeUnitType.Days);chart.getValueAxis().setMajorUnitScale(TimeUnitType.Months);chart.hasLegend (false);pres.write(“D:\Aspose Data\Bar2.pptx”);}
Thanks for the reply it did help a lot …
Hi,
I added the factor 110 as on my PC the chart was picking starting date as 1904. So, I had to shift it to 2013 and used this factor. You can use the value shared or tailor it as per your requirements.
Many Thanks,
Many Thanks …I did that only …