Implement Stacked column chart in aspose.slide

Hi support,

I am implementing stacked column chart using aspose.slides. my requirement is attached hereStackedColumnChart - sample.png (2.7 KB)

While i am generating ppt using aspose it generated like - StackedColumnChart - Gen.png (3.3 KB)
i have already set chart type as stacked column chart.

PrimaryChartControl.Type = Aspose.Slides.Charts.ChartType.StackedColumn;

after open generated ppt when i open change chart type dialogbox and press Ok without changing anything it will change to StackedColumnChart - Gen_1.png (3.8 KB)

I have also attached code - Code.zip (1.4 KB)

I have also attached my requirement here. can you please provide details how can i achive the same.

Regards,
Vishal Bhatt

@siriussynoptek,

I have observed the requirement image shared by you. Unfortunately, I am unable to use your sample code as it is involving custom declerations and assignment that you have not provided. Plase provide a working sample project that we may test on our end.

From the requirement image, it seems that you are interested in setting Gap width property. Therefore, I request you to please visit this documentation link to set the Gap width property for overlapping or a parted chart series data.

Hi

Please find attached demo console application ConsoleAspose.zip (381.4 KB)
Version : 18.9.

Template location : ConsoleAspose\bin\Debug\PresentationTemplate
Generated report location : ConsoleAspose\bin\Debug\PresentationDownloads

We are enable to reproduce the same issue as well. Please suggest possible solution for that.

Thanks in advance

@siriussynoptek,

I have observed that you are using older version of Aspose.Slides on your end. Please try using latest Aspose.Slides for .NET 20.3 on your end and in case there is still an issue, please share with us.

I have updated and tried with 20.1 but it doesn’t resolve the issue. can you please suggest how can i produce required output.

Thanks in advance.

@siriussynoptek,

I have worked over the issue shared using latest Aspose.Slides for .NET 20.3 and have been able to reproduce this on my end. An issue with ID SLIDESNET-41870 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Hi,

I have attached another demo application with similar implementation ConsoleAspose.zip (979.2 KB). i have formated properly. now i want to change color for different categories in the chart(which can fullfill our need StackedColumnChart - sample.png (2.7 KB)
).

  1. diferent color for each category
  2. seperator between series and labels similar to attached image.

Thanks in advance.
.

@siriussynoptek,

I have observed your requirements and like to share that there is no color setting for categories. You need to set the chart series color or set color for individual chart series data point.

            int ColIdx = 1;
            for (int rowCnt = 0; rowCnt < dt.Rows.Count; rowCnt++)
            {
                DataRow FirstRow = dt.Rows[rowCnt];
                Columnseries1.DataPoints.AddDataPointForBarSeries(factSecondary.GetCell(0, 1, ColIdx, Convert.ToDouble(FirstRow[1])));
                Columnseries2.DataPoints.AddDataPointForBarSeries(factSecondary.GetCell(0, 2, ColIdx, Convert.ToDouble(FirstRow[2])));
                Columnseries3.DataPoints.AddDataPointForBarSeries(factSecondary.GetCell(0, 3, ColIdx, Convert.ToDouble(FirstRow[3])));
                Columnseries4.DataPoints.AddDataPointForBarSeries(factSecondary.GetCell(0, 4, ColIdx, Convert.ToDouble(FirstRow[4])));
                //Columnseries5.DataPoints.AddDataPointForBarSeries(factSecondary.GetCell(0, 5, ColIdx, Convert.ToDouble(FirstRow[5])));
                ColIdx++;

                Columnseries1.DataPoints[rowCnt].Format.Fill.FillType = FillType.Solid;
                Columnseries2.DataPoints[rowCnt].Format.Fill.FillType = FillType.Solid;
                Columnseries3.DataPoints[rowCnt].Format.Fill.FillType = FillType.Solid;
                Columnseries4.DataPoints[rowCnt].Format.Fill.FillType = FillType.Solid;
                
                Columnseries1.DataPoints[rowCnt].Format.Fill.SolidFillColor.Color = System.Drawing.Color.Red;
                Columnseries2.DataPoints[rowCnt].Format.Fill.SolidFillColor.Color = System.Drawing.Color.Red;
                Columnseries3.DataPoints[rowCnt].Format.Fill.SolidFillColor.Color = System.Drawing.Color.Red;
                Columnseries4.DataPoints[rowCnt].Format.Fill.SolidFillColor.Color = System.Drawing.Color.Red;


            }

Hi,

I have implemented suggested approach. now i wanted to show border between two series highlighted in attached image(StackedColumnChart - sample.png (10.2 KB)
). can you please suggest how can i achieve same.

Thanks in advance.

@siriussynoptek,

Please add following modification inside for-loop of you sample code.

                Columnseries1.DataPoints[rowCnt].Format.Line.FillFormat.FillType = FillType.Solid;
                Columnseries1.DataPoints[rowCnt].Format.Line.Width=1;
                Columnseries1.DataPoints[rowCnt].Format.Line.DashStyle=LineDashStyle.Solid;
                Columnseries1.DataPoints[rowCnt].Format.Line.FillFormat.SolidFillColor.Color = System.Drawing.Color.White;


                Columnseries2.DataPoints[rowCnt].Format.Line.FillFormat.FillType = FillType.Solid;
                Columnseries2.DataPoints[rowCnt].Format.Line.Width = 1;
                Columnseries2.DataPoints[rowCnt].Format.Line.DashStyle = LineDashStyle.Solid;
                Columnseries2.DataPoints[rowCnt].Format.Line.FillFormat.SolidFillColor.Color = System.Drawing.Color.White;


                Columnseries3.DataPoints[rowCnt].Format.Line.FillFormat.FillType = FillType.Solid;
                Columnseries3.DataPoints[rowCnt].Format.Line.Width = 1;
                Columnseries3.DataPoints[rowCnt].Format.Line.DashStyle = LineDashStyle.Solid;
                Columnseries3.DataPoints[rowCnt].Format.Line.FillFormat.SolidFillColor.Color = System.Drawing.Color.White;

                Columnseries4.DataPoints[rowCnt].Format.Line.FillFormat.FillType = FillType.Solid;
                Columnseries4.DataPoints[rowCnt].Format.Line.Width = 1;
                Columnseries4.DataPoints[rowCnt].Format.Line.DashStyle = LineDashStyle.Solid;
                Columnseries4.DataPoints[rowCnt].Format.Line.FillFormat.SolidFillColor.Color = System.Drawing.Color.White;

I have implemented and its served our need. now after plotting values in the chart. label not visible properly when value is bit small. attached screenshot Series Issue.png (5.7 KB). can you please advice any way to make label visible proprtly in any case.

Thanks in advance.

@siriussynoptek,

I have observed the snapshot shared by you. This is not issue with API. Actually, the value of your series data-point is less and hence the rendering is small for that data-point. In this scenario, you can access the chart data point label and set the reduced font height or you can set location of chart data label to any other position to avoid the shared limitation. Please visit this documentation link for possible option to manage chart data-point labels.

HI Support,

I have implemented stackedColumn chart in our application, Now i want to hide datalabels for specific datapoint which have value less then 0.5.Series Issue.png (5.7 KB) In attached image highlighted datapoint has less then value 0.5. Please suggest any way to hide specific datapoints

I have added below code but it hides data label for both the series regardless value is less then of grather then 0.5.
if (Convert.ToDouble(FirstRow[1]) <= 0.5) Columnseries1.Labels.DefaultDataLabelFormat.ShowSeriesName = false;

Please suggest way to resolve.

@siriussynoptek,

Can you please provide a working sample solution and I will use that and suggest a solution based on that.

Hi,

ConsoleAspose.zip (389.1 KB)

In chart we have two bars which have labels. now label overlaps as value is less. we need to find approach where label should only properly even value is small in amount. else hide the labels in case when we do not have enough space to accommodate value properly.

Can you please suggest way to handle such scenario.

Thanks.

@siriussynoptek,

I have made modification in sample project and it will hide labels for which data point value is less than or equal to 0.5.

ConsoleAspose_Mod.zip (529.2 KB)

Thanks for quick response.

by implementing the solution it will not work in every scenario because if second bar has no value then primary bar will have appropriate space and due to label hide logic it will not display label even though bar has enough space to display label. so I don’t think we can hide labels based on plotting values.

DataRow dr = dtPrimaryChart.NewRow();
dr[0] = “Primary”;
dr[1] = 0.23;
dr[2] = 0.78;
dr[3] = 0.16;
dr[4] = 0.39;
dtPrimaryChart.Rows.Add(dr);

            DataRow dr1 = dtPrimaryChart.NewRow();
            dr1[0] = "Secondary";
            dr1[1] = 0;
            dr1[2] = 0;
            dr1[3] = 0;
            dr1[4] = 0;
            //DataRow dr1 = dtPrimaryChart.NewRow();
            //dr1[0] = "Secondary";
            //dr1[1] = 2.76;
            //dr1[2] = 2.38;
            //dr1[3] = 2.55;
            //dr1[4] = 2.1;
            dtPrimaryChart.Rows.Add(dr1);

You can use above data set to repro the same scenario. here is updated demo ConsoleAspose.zip (453.9 KB)

only thing we are looking for is if enough space is exist for specific series label then label should be displayed else not.

as per my understanding we need to implement implement logic based on height of series area or other approach available in aspose library.

Can you please suggest another approach which can be implemented in all scenario.

@siriussynoptek,

I have observed your comments and like to share that I have shared the approach with you that you can use on your end to verify every series data point value as per your accepted filtered value and then either hide or show the respective labels,

For your this requirement, I like to share that it depends on your own custom logic. As far as API features are concerned, I have shared the approach for enabling or disabling the labels data. Please share, if you have any issue in terms of using API, we will be glad to help you.

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

Hi support,

We have updated version 20.5 and found that issue is still persist. is there any property we need to use to resolve the issue. please find demo application. ConsoleAspose.zip (556.0 KB)

Thanks in advnce.