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

Free Support Forum - aspose.com

How to create waterfall chart using aspose.cells in .Net

Hi,

Can anybody share the sample code to create waterfall chart using aspose.cell in .Net

Thanks.

Hi,

Thanks for your posting and considering Aspose.Cells.

Please
provide us your sample Excel file containing your chart which you want
to create using Aspose.Cells. You can create your chart manually using
MS-Excel and attach it here for our reference.

We will look into it and provide you a sample code how to create your expected chart programmatically using Aspose.Cells.

Hi,

Please Find Attachment of sample waterfall created using excel .

Thanks.

Can you please provide sample code ASAP.

Thanks in Advance.

Hi,

Thanks for your posting and considering Aspose.Cells.

After initial investigation, we think, waterfall chart can be created with Aspose.Cells. However, waterfall chart is not a standard Excel chart and it is created with some Excel creativity and expertise.

We first need to know how did you create this chart using MS-Excel. Please list down all steps one by one in some word document with screenshots. It will help us to investigate and mimic these steps in Aspose.Cells.

Thanks for your cooperation.

Please find Attachment of steps to create waterfall using excel.

Thanks.

Hi Prakash,

Thanks for providing us the word document describing the steps to create Waterfall chart and considering Aspose.Cells.

Please see the following code to create Waterfall chart.

I have attached the source xlsx file used in this code and output xlsx file generated by it and screenshot showing the output Waterfall chart for your reference.

C#


//Load the source workbook

Workbook workbook = new Workbook(“source.xlsx”);


//Access the first worksheet

Worksheet worksheet = workbook.Worksheets[0];


//Add a line chart

int idx = worksheet.Charts.Add(ChartType.Line, 4, 4, 25, 13);

Chart chart = worksheet.Charts[idx];


//Add Series

chart.NSeries.Add("=‘Waterfall Chart example’!$B$17:$C$22", true);


//Add Category Data

chart.NSeries.CategoryData = “=‘Waterfall Chart example’!$A$17:$A$22”;


//Series has Up Down Bars

chart.NSeries[0].HasUpDownBars = true;


//Set the colors of Up and Down Bars

chart.NSeries[0].UpBars.Area.ForegroundColor = Color.Green;

chart.NSeries[0].DownBars.Area.ForegroundColor = Color.Red;


//Make both Series Lines invisible

chart.NSeries[0].Line.IsVisible = false;

chart.NSeries[1].Line.IsVisible = false;


//Set the Plot Area Formatting Automatic

chart.PlotArea.Area.Formatting = FormattingType.Automatic;


//Delete the Legend

chart.Legend.LegendEntries[0].IsDeleted = true;

chart.Legend.LegendEntries[1].IsDeleted = true;


//Save the workbook

workbook.Save(“output.xlsx”);

Hi ,

We are using aspose.cells 7.5.2 . we are getting warning in the code which makes line invisible.

chart.NSeries[0].Line.IsVisible = false;
chart.NSeries[1].Line.IsVisible = false;

"Warning 1 'Aspose.Cells.Charts.Series.Line' is obsolete: '"Use Series.Border property instead."' D:\Aspose\Aspose\chart.aspx.cs 340 13 AsposeWarning 1 'Aspose.Cells.Charts.Series.Line' is obsolete: '"Use Series.Border property instead."' D:\Aspose\Aspose\chart.aspx.cs 340 13 Aspose"

Can u please post the code which works for this version of dll.

Thanks.

Hi Prakash,

Thanks for your posting and using Aspose.Cells.

Please try the following lines instead it should resolve your issue.

C#
chart.NSeries[0].Border.IsVisible = false;
chart.NSeries[1].Border.IsVisible = false;