Free Support Forum - aspose.com

Trendline in ClusteredBar

Hey ,

Please Find below the code that im using to create a Clusteredbar containing a Trendline for average .
The picture shown in Fig1 shows my output where i have 3 series ( "BEP1","BEP2","BEP3") notice that BEP2 fill color in NoFill .
The Picture shown in Fig2 shows the desired Output ( where you can find the trendline in red) but i want the trendline height to be equal to the chart height so that this red line can cover all my chart Height ,below is my code where i want to add the trendline.

ChartEx chart = sld.Shapes.AddChart(ChartTypeEx.ClusteredBar, 0, 0, 500, 500);
chart.HasTitle = 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, "BEP 1"), chart.Type);
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 2, "BEP 2"), chart.Type);
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 3, "BEP 3"), chart.Type);
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 1, 0, "Brand 1"));
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 2, 0, "Brand 2"));
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 3, 0, "Brand 3"));
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 4, 0, "Brand 4"));

ChartSeriesEx series = chart.ChartData.Series[0];
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 1, 10));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 1, 30));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 1, 50));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 4, 1, 90));

series = chart.ChartData.Series[1];
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 2, 30));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 2, 30));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 2, 30));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 4, 2, 30));

series = chart.ChartData.Series[2];
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 3, 30));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 3, 10));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 3, 60));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 4, 3, 200));

ChartSeriesEx nSeries = chart.ChartData.Series[0];
ChartPointEx point = new ChartPointEx(nSeries);
point.Index = 0;
point.Format.Fill.FillType = FillTypeEx.Solid;
point.Format.Fill.SolidFillColor.Color = Color.Red;
nSeries.Points.Add(point);

ChartSeriesEx nSeries1 = chart.ChartData.Series[1];
nSeries1.Format.Fill.FillType = FillTypeEx.NoFill;

Regards ,
Kamel

Hi Kamel,


I have observed your requirements and regret to share that the feature for adding trend line for series data is unavialble in Aspose.Slides. I have created ticket in our issue tracking system with ID SLIDESNET-33949 as new feature request to provide this feature. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)