Hi,
How to create a normal column chart with min/max x axis value and y axis value.
Thanks.
Hi,
How to create a normal column chart with min/max x axis value and y axis value.
Thanks.
Hi,
Hi,
I did refer the same link today morning. But I am not able do the following things:
1.set min/max values for x-axis and y axis
2.create secondary y axis.
Hi,
PresentationEx pres;pres = new PresentationEx();SlideEx sld = pres.Slides[0];ChartEx chart = sld.Shapes.AddChart(ChartTypeEx.ClusteredColumn, 0, 0, 500, 500);chart.ChartTitle.Text.Text = “Sample Title”;chart.ChartTitle.Text.CenterText = true;chart.ChartTitle.Height = 20;chart.HasTitle = false;chart.HasLegend = false;chart.ChartData.Series[0].Labels.ShowValue = true;chart.SecondCategoryAxis.IsVisible = true;int defaultWorksheetIndex = 0;ChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;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, “1”), chart.Type);chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 2, “2”), chart.Type);chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 3, “3”), chart.Type);chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 1, 0, “Age”));chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 2, 0, “Gender”));chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 3, 0, “Status”));chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 4, 0, “Nationality”));chart.GapDepth = 200;// chart.GapWidth = 50 I need to be able to do something similar to this codeChartSeriesEx series = chart.ChartData.Series[0];series.Format.Fill.FillType = FillTypeEx.Solid;series.Format.Fill.SolidFillColor.Color = Color.FromArgb(32, 202, 250);series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 1, 40));series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 1, 64));series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 1, 50));series.Values.Add(fact.GetCell(defaultWorksheetIndex, 4, 1, 1));series.PlotOnSecondAxis = true;series = chart.ChartData.Series[1];series.Format.Fill.FillType = FillTypeEx.Solid;series.Format.Fill.SolidFillColor.Color = Color.FromArgb(0, 122, 171);series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 2, 4));series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 2, 19));series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 2, 50));series.Values.Add(fact.GetCell(defaultWorksheetIndex, 4, 2, 25));series.PlotOnSecondAxis = true;series = chart.ChartData.Series[2];series.Format.Fill.FillType = FillTypeEx.Solid;series.Format.Fill.SolidFillColor.Color = Color.FromArgb(0, 136, 188);series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 2, 3));series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 2, 17));series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 2, 0));series.Values.Add(fact.GetCell(defaultWorksheetIndex, 4, 2, 63));series.PlotOnSecondAxis = true;chart.GapDepth = 80;//Values in percentagechart.GapWidth = 250;pres.Write(“D:\Aspose Data\Presentation2.pptx”);
Please find below my requirements and let me know if these can be acieved using Aspose.Slide.Pptx.ChartEx :
· 18-20 charts on a single slide in readable format
· scale break
· Common scale for multiple charts drawn on one slide. There can be max of two scales in a slide. We can evaluate the possibility to define scale by setting common values for Axis attributes –Minimum, maximum and interval to redraw the charts on screen/slide
· Provision to show values as millions/billions/actual
· Provision to manage the decimal places
· To show absolute as well as percentage values in some sections of the graph.
Thanks
Hi,
Please let me know the relevant code for PPT chart .Below is for excel chart:
//Applying a dotted line style on the lines of a SeriesCollection
chart.NSeries[0].Line.Style = Aspose.Cells.Drawing.LineType.Dot;
//Applying a triangular marker style on the data markers of a SeriesCollection
chart.NSeries[0].MarkerStyle = Aspose.Cells.Charts.ChartMarkerType.Triangle;
//Setting the weight of all lines in a SeriesCollection to medium
chart.NSeries[1].Line.Weight = Aspose.Cells.Drawing.WeightType.MediumLine;
Hi,
I am trying to work on chart appearance for pptx chart as described for excel chart here :http://www.aspose.com/docs/display/cellsnet/Setting+Charts+Appearance
Hi,
public static void MangeChartProperties(){PresentationEx pres = new PresentationEx();SlideEx slide = pres.Slides[0];ChartEx chart = slide.Shapes.AddChart(ChartTypeEx.LineWithMarkers, 50, 50, 500, 400);//Setting Major and minor grid lines format for value axischart.ValueAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.Solid;chart.ValueAxis.MajorGridLines.FillFormat.SolidFillColor.Color = Color.Blue;chart.ValueAxis.MajorGridLines.Width = 5;chart.ValueAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.Solid;chart.ValueAxis.MinorGridLines.FillFormat.SolidFillColor.Color = Color.Red;chart.ValueAxis.MinorGridLines.Width = 3;chart.ValueAxis.SourceLinked = false;// chart.ValueAxis.DisplayUnit = DisplayUnitType.Millions;chart.ValueAxis.DisplayUnit = DisplayUnitType.Thousands;chart.ValueAxis.NumberFormat = “0.0%”;//Setting chart maximum, minimum valueschart.ValueAxis.IsAutomaticMajorUnit = false;chart.ValueAxis.IsAutomaticMaxValue = false;chart.ValueAxis.IsAutomaticMinorUnit = false;chart.ValueAxis.IsAutomaticMinValue = false;chart.ValueAxis.MaxValue = 15f;chart.ValueAxis.MinValue = -2f;chart.ValueAxis.MinorUnit = 0.5f;chart.ValueAxis.MajorUnit = 2.0f;//Setting Major and minor grid lines format for Category axischart.CategoryAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.Solid;chart.CategoryAxis.MajorGridLines.FillFormat.SolidFillColor.Color = Color.Green;chart.CategoryAxis.MajorGridLines.Width = 5;chart.CategoryAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.Solid;chart.CategoryAxis.MinorGridLines.FillFormat.SolidFillColor.Color = Color.Yellow;chart.CategoryAxis.MinorGridLines.Width = 3;//Setting Category Axis Text PropertiesTextFrameEx txt = chart.CategoryAxis.TextProperties;txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid; ;txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;//Setting Value Axis Text PropertiesTextFrameEx txt2 = chart.ValueAxis.TextProperties;txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid; ;txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;//Setting Legends Text PropertiesTextFrameEx txt3 = chart.Legend.TextProperties;txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid; ;txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;chart.ValueAxis.AxisLine.Width = 10;chart.ValueAxis.AxisLine.FillFormat.FillType = FillTypeEx.Solid;chart.ValueAxis.AxisLine.FillFormat.SolidFillColor.Color = Color.Red;chart.SecondValueAxis.IsVisible = true;chart.SecondValueAxis.AxisLine.Style = LineStyleEx.ThickBetweenThin;chart.SecondValueAxis.AxisLine.Width = 20;// TextFrameEx tf=chart.SecondValueAxis.Title.Text;//Setting chart back wall colorchart.ChartFormat.Fill.FillType = FillTypeEx.Solid;chart.ChartFormat.Fill.SolidFillColor.Color = Color.Orange;//Setting Plot area colorchart.PlotArea.Format.Fill.FillType = FillTypeEx.Solid;chart.PlotArea.Format.Fill.SolidFillColor.Color = Color.LightCyan;//working with chart seriesChartSeriesEx series = chart.ChartData.Series[0];//Setting marker and its properties for chart seriesseries.MarkerSymbol = MarkerStyleTypeEx.Diamond;series.MarkerSize = 20;series.MarkerFill.Fill.FillType = FillTypeEx.Solid;series.MarkerFill.Fill.SolidFillColor.Color = Color.RosyBrown;series.MarkerFill.Line.Width= 2;series.MarkerFill.Line.FillFormat.FillType=FillTypeEx.Solid;series.MarkerFill.Line.FillFormat.SolidFillColor.Color = Color.Chocolate;//Setting Line format for chart seriesseries.Format.Line.DashStyle = LineDashStyleEx.Dot;series.Format.Line.Style = LineStyleEx.ThickThin;series.Format.Line.Width = 5d;series.Format.Fill.FillType = FillTypeEx.Solid;series.Format.Fill.SolidFillColor.Color = Color.Black;//Plotting series on secondary axisseries.PlotOnSecondAxis = true;//Adding Series label and its propertiesDataLabelEx label = new DataLabelEx(series);series.Labels.Add(label);series.Labels.ShowValue = true;series.Labels.ShowSeriesName = false;series.Labels.ShowCategoryName = false;series.Labels.LinkedSource = false;series.Labels.NumberFormat = “0.0%”;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.DarkGreen;//Saving Presentationpres.Write(“D:\Aspose Data\AxisValue.pptx”);}
Thank you very much for sharing the code.
I am not gettting the following properties(SourceLinked,NumberFormat and TextProperties):
chart.ValueAxis.SourceLinked = false;
chart.ValueAxis.NumberFormat = "0.0%";
TextFrameEx txt3 = chart.Legend.TextProperties;
Regarding my last query of handling decimal values, I want to display decimal number to certain precision value according to user's choice. If user wants 2 precision value than number 2.345 should be displayed as 2.35.If user wants 1 precision value then the number displayed should be 2.3 and so on.
Hi,
// series.Labels.NumberFormat = “0.0%”;series.Values[0].Value = 4.35657;series.Labels.NumberFormat = “#,##0.00”;
Yes i can see the properties but i am not able to set these properties in code behind. Below is the error I am getting:
Aspose.Slides.PPtx.Charts.AxisEx does not contain a defination of 'SourceLinked'
Aspose.Slides.PPtx.Charts.LegendEx does not contain a defination for TextProperties ...........
Also, please let me know if we can have multiple charts with different scale on a single slide.
Hi,
Hi,
Please let me know how to create dotted clusteredColumn chart for Slides as shown below:
Column chart after applying line styles
Hi,
//Setting Line format for chart seriesseries.Format.Line.DashStyle = LineDashStyleEx.Dot;series.Format.Line.Style = LineStyleEx.Single;series.Format.Line.Width = 5d;series.Format.Line.FillFormat.FillType = FillTypeEx.Solid;series.Format.Line.FillFormat.SolidFillColor.Color = Color.Red;
<?xml:namespace prefix = v ns = “urn:schemas-microsoft-com:vml” /><v:shapetype id=_x0000_t75 stroked=“f” filled=“f” path=“m@4@5l@4@11@9@11@9@5xe” o:preferrelative=“t” o:spt=“75” coordsize=“21600,21600”> I have already tried the code suggested by you but its not working. </v:shapetype>
Sorry. its working. i was doing a mistake.
Hi,
As one of my requirements , I also require to have stackedChart as:
30% | |
35% | |
70% | |
60% |
Here we need to display % of area covered by series.
Hi,
However, there has been issue observed in adding custom label. Actually, custom labels are added but only last added custom label is displayed and for first category only. The rest of labels depicts the default chart series values. I have created an issue with ID SLIDESNET-33811 to further investigate and resolve the issue. But the above code will serve the purpose completely for your once the issue will be resolved. I have linked this thread with the issue so that you may be automatically notified once the issue will be fixed.public static void MangeStackedColumnChartProperties(){MemoryStream ms = new MemoryStream();ms.Position = 0;PresentationEx pres = new PresentationEx();SlideEx slide = pres.Slides[0];ChartEx chart = slide.Shapes.AddChart(ChartTypeEx.StackedColumn, 50, 50, 500, 400);//Setting Major and minor grid lines format for value axischart.ValueAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.NoFill;chart.ValueAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.NoFill;chart.CategoryAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.NoFill;chart.CategoryAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.NoFill;//working with chart seriesChartSeriesEx series = chart.ChartData.Series[0];ChartDataWorksheet work = chart.ChartData.Series[0].Values[0].ChartDataWorksheet;ChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;ChartDataCell cell = fact.GetCell(0, chart.ChartData.Series[0].Values[0].Row, chart.ChartData.Series[0].Values[0].Column);//Adding Series label and its properties//For Category 1double totalSeries = System.Convert.ToDouble(chart.ChartData.Series[0].Values[0].Value) + System.Convert.ToDouble(chart.ChartData.Series[1].Values[0].Value) + System.Convert.ToDouble(chart.ChartData.Series[2].Values[0].Value);double percent1 = (System.Convert.ToDouble(chart.ChartData.Series[0].Values[0].Value) / totalSeries) * 100;double percent2 = (System.Convert.ToDouble(chart.ChartData.Series[1].Values[0].Value) / totalSeries) * 100;double percent3 = (System.Convert.ToDouble(chart.ChartData.Series[2].Values[0].Value) / totalSeries) * 100;String per1 = string.Format("{0:0.##}", percent1);String per2 = string.Format("{0:0.##}", percent2);String per3 = string.Format("{0:0.##}", percent3);//For Category 2double totalSeries2 = System.Convert.ToDouble(chart.ChartData.Series[0].Values[1].Value) + System.Convert.ToDouble(chart.ChartData.Series[1].Values[1].Value) + System.Convert.ToDouble(chart.ChartData.Series[1].Values[0].Value);double percent12 = (System.Convert.ToDouble(chart.ChartData.Series[0].Values[1].Value) / totalSeries2) * 100;double percent22 = (System.Convert.ToDouble(chart.ChartData.Series[1].Values[1].Value) / totalSeries2) * 100;double percent32 = (System.Convert.ToDouble(chart.ChartData.Series[2].Values[1].Value) / totalSeries2) * 100;String per12 = string.Format("{0:0.##}", percent12);String per22 = string.Format("{0:0.##}", percent22);String per32 = string.Format("{0:0.##}", percent32);//For Category 3double totalSeries3 = System.Convert.ToDouble(chart.ChartData.Series[0].Values[2].Value) + System.Convert.ToDouble(chart.ChartData.Series[1].Values[2].Value) + System.Convert.ToDouble(chart.ChartData.Series[2].Values[2].Value);double percent13 = (System.Convert.ToDouble(chart.ChartData.Series[0].Values[2].Value) / totalSeries3) * 100;double percent23 = (System.Convert.ToDouble(chart.ChartData.Series[1].Values[2].Value) / totalSeries3) * 100;double percent33 = (System.Convert.ToDouble(chart.ChartData.Series[2].Values[2].Value) / totalSeries3) * 100;String per13 = string.Format("{0:0.##}", percent13);String per23 = string.Format("{0:0.##}", percent23);String per33= string.Format("{0:0.##}", percent33);//For Category 4double totalSeries4 = System.Convert.ToDouble(chart.ChartData.Series[0].Values[3].Value) + System.Convert.ToDouble(chart.ChartData.Series[1].Values[3].Value) + System.Convert.ToDouble(chart.ChartData.Series[2].Values[3].Value);double percent14 = (System.Convert.ToDouble(chart.ChartData.Series[0].Values[3].Value) / totalSeries4) * 100;double percent24 = (System.Convert.ToDouble(chart.ChartData.Series[1].Values[3].Value) / totalSeries4) * 100;double percent34 = (System.Convert.ToDouble(chart.ChartData.Series[2].Values[3].Value) / totalSeries4) * 100;String per14 = string.Format("{0:0.##}", percent14);String per24 = string.Format("{0:0.##}", percent24);String per34= string.Format("{0:0.##}", percent34);series.Labels.ShowValue = false;series.Labels.ShowSeriesName = false;series.Labels.ShowCategoryName = false;series.Labels.LinkedSource = false;series.Labels.ShowPercentage = false;DataLabelEx label = new DataLabelEx(series);TextFrameEx txt = label.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per1+ “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType=FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series.Labels.Add(label);DataLabelEx label12 = new DataLabelEx(series);txt = label.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per12 + “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series.Labels.Add(label12);DataLabelEx label13 = new DataLabelEx(series);txt = label.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per13 + “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series.Labels.Add(label13);DataLabelEx label14 = new DataLabelEx(series);txt = label.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per14 + “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series.Labels.Add(label14);series.Labels.Position = LegendDataLabelPositionEx.BestFit;/* series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.DarkGreen;*/ChartSeriesEx series2 = chart.ChartData.Series[1];DataLabelEx label2 = new DataLabelEx(series2);txt = label2.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per2 + “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series2.Labels.Add(label2);DataLabelEx label22 = new DataLabelEx(series2);txt = label22.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per22 + “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series2.Labels.Add(label22);DataLabelEx label23 = new DataLabelEx(series2);txt = label23.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per23 + “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series2.Labels.Add(label23);DataLabelEx label24 = new DataLabelEx(series2);txt = label24.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per24 + “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series2.Labels.Add(label24);ChartSeriesEx series3 = chart.ChartData.Series[2];DataLabelEx label3 = new DataLabelEx(series3);txt = label3.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per3 + “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series3.Labels.Add(label3);DataLabelEx label32 = new DataLabelEx(series3);txt = label32.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per32 + “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series3.Labels.Add(label32);DataLabelEx label33 = new DataLabelEx(series3);txt = label33.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per33 + “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series3.Labels.Add(label33);DataLabelEx label34 = new DataLabelEx(series3);txt = label34.TextFrame;txt.Text = “”;txt.Paragraphs[0].Portions[0].Text = per34 + “%”;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;txt.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;txt.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;series3.Labels.Add(label34);// series.Labels.NumberFormat = “0.0%”;chart.GapDepth = 0;//Values in percentagechart.GapWidth = 0;//Saving Presentationpres.Write(“D:\Aspose Data\AxisValue.pptx”);}
Hi,
AS suggested by you I am not able to do formating of numeric label values
Hi,
public static void MangeChartProperties(){PresentationEx pres = new PresentationEx();SlideEx slide = pres.Slides[0];ChartEx chart = slide.Shapes.AddChart(ChartTypeEx.LineWithMarkers, 50, 50, 500, 400);//Setting Major and minor grid lines format for value axischart.ValueAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.Solid;chart.ValueAxis.MajorGridLines.FillFormat.SolidFillColor.Color = Color.Blue;chart.ValueAxis.MajorGridLines.Width = 5;chart.ValueAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.Solid;chart.ValueAxis.MinorGridLines.FillFormat.SolidFillColor.Color = Color.Red;chart.ValueAxis.MinorGridLines.Width = 3;chart.ValueAxis.SourceLinked = false;// chart.ValueAxis.DisplayUnit = DisplayUnitType.Millions;chart.ValueAxis.DisplayUnit = DisplayUnitType.Thousands;chart.ValueAxis.NumberFormat = “0.0%”;//Setting chart maximum, minimum valueschart.ValueAxis.IsAutomaticMajorUnit = false;chart.ValueAxis.IsAutomaticMaxValue = false;chart.ValueAxis.IsAutomaticMinorUnit = false;chart.ValueAxis.IsAutomaticMinValue = false;chart.ValueAxis.MaxValue = 15f;chart.ValueAxis.MinValue = -2f;chart.ValueAxis.MinorUnit = 0.5f;chart.ValueAxis.MajorUnit = 2.0f;//Setting Major and minor grid lines format for Category axischart.CategoryAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.Solid;chart.CategoryAxis.MajorGridLines.FillFormat.SolidFillColor.Color = Color.Green;chart.CategoryAxis.MajorGridLines.Width = 5;chart.CategoryAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.Solid;chart.CategoryAxis.MinorGridLines.FillFormat.SolidFillColor.Color = Color.Yellow;chart.CategoryAxis.MinorGridLines.Width = 3;//Setting Category Axis Text PropertiesTextFrameEx txt = chart.CategoryAxis.TextProperties;txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid; ;txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;//Setting Value Axis Text PropertiesTextFrameEx txt2 = chart.ValueAxis.TextProperties;txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid; ;txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;//Setting Legends Text PropertiesTextFrameEx txt3 = chart.Legend.TextProperties;txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid; ;txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;chart.ValueAxis.AxisLine.Width = 10;chart.ValueAxis.AxisLine.FillFormat.FillType = FillTypeEx.Solid;chart.ValueAxis.AxisLine.FillFormat.SolidFillColor.Color = Color.Red;chart.SecondValueAxis.IsVisible = true;chart.SecondValueAxis.AxisLine.Style = LineStyleEx.ThickBetweenThin;chart.SecondValueAxis.AxisLine.Width = 20;// TextFrameEx tf=chart.SecondValueAxis.Title.Text;//Setting chart back wall colorchart.ChartFormat.Fill.FillType = FillTypeEx.Solid;chart.ChartFormat.Fill.SolidFillColor.Color = Color.Orange;//Setting Plot area colorchart.PlotArea.Format.Fill.FillType = FillTypeEx.Solid;chart.PlotArea.Format.Fill.SolidFillColor.Color = Color.LightCyan;//working with chart seriesChartSeriesEx series = chart.ChartData.Series[0];//Setting marker and its properties for chart seriesseries.MarkerSymbol = MarkerStyleTypeEx.Diamond;series.MarkerSize = 20;series.MarkerFill.Fill.FillType = FillTypeEx.Solid;series.MarkerFill.Fill.SolidFillColor.Color = Color.RosyBrown;series.MarkerFill.Line.Width = 2;series.MarkerFill.Line.FillFormat.FillType = FillTypeEx.Solid;series.MarkerFill.Line.FillFormat.SolidFillColor.Color = Color.Chocolate;//Setting Line format for chart seriesseries.Format.Line.DashStyle = LineDashStyleEx.Dot;series.Format.Line.Style = LineStyleEx.ThickThin;series.Format.Line.Width = 5d;series.Format.Fill.FillType = FillTypeEx.Solid;series.Format.Fill.SolidFillColor.Color = Color.Black;//Plotting series on secondary axisseries.PlotOnSecondAxis = true;//Adding Series label and its propertiesDataLabelEx label = new DataLabelEx(series);series.Labels.Add(label);series.Labels.ShowValue = true;series.Labels.ShowSeriesName = false;series.Labels.ShowCategoryName = false;series.Labels.LinkedSource = false;// series.Labels.NumberFormat = “0.0%”;series.Values[0].Value = 4.35657;series.Values[1].Value = 2.45325657;series.Values[2].Value = 6.565657;series.Values[3].Value = 3.675657;series.Labels.NumberFormat = “#,##0.00”;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid;series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.DarkGreen;//Saving Presentationpres.Write(“D:\Aspose Data\AxisValue.pptx”);}