How to create Tornado chart

Hi, I want to create a tornado chart using aspose.net. For this to work, I have to make the value of 1 of the 2 columns I want to compare negative. This will cause the 2nd column to display in the opposite direction from the first column. However, the actual value of the 2nd column is positive, so how to change it back to positive value while keeping the display of the chart (If there is any other way, please guide me). Thanks a lot.

@quanggiap299,
When the data in the Tornado Chart has negative values, you can set the number format to display positive values. If both columns have positive values, you can add a Tornado Chart using Conditional Formatting. Please refer to the attachment (15.2 KB) and the following sample code.

The sample code as follows:

Workbook wb = new Workbook(filePath + "sample.xlsx");
Worksheet sheet = wb.Worksheets[0];
ChartCollection charts = sheet.Charts;
// Add bar chart
int index = charts.Add(ChartType.Bar, 8, 1, 24, 8);
Chart chart = charts[index];

// Set data for bar chart
chart.SetChartDataRange("A1:C5", true);

// Set properties for bar chart
chart.Title.Text = "Tornado chart";
chart.Style = 2;
chart.PlotArea.Area.BackgroundColor = Color.White;
chart.PlotArea.Border.Color = Color.White;
chart.Legend.Position = LegendPositionType.Bottom;

Axis valueAxis = chart.ValueAxis;
valueAxis.TickLabels.NumberFormat = "#,##0;#,##0";


// Create and get the conditional formatting of the worksheet
int idx = sheet.ConditionalFormattings.Add();
FormatConditionCollection fcc = sheet.ConditionalFormattings[idx];
fcc.AddCondition(FormatConditionType.DataBar);
fcc.AddArea(CellArea.CreateCellArea("J2", "J5"));

// Access the conditional formatting databar
DataBar dbar = fcc[0].DataBar;
dbar.Direction = TextDirectionType.RightToLeft;
dbar.Color = Color.Red;

// Create and get the conditional formatting of the worksheet
int idx2 = sheet.ConditionalFormattings.Add();
FormatConditionCollection fcc2 = sheet.ConditionalFormattings[idx2];
fcc2.AddCondition(FormatConditionType.DataBar);
fcc2.AddArea(CellArea.CreateCellArea("K2", "K5"));

// Access the conditional formatting databar
DataBar dbar2 = fcc2[0].DataBar;
dbar2.Direction = TextDirectionType.LeftToRight;
dbar2.Color = Color.Green;

wb.Save(filePath + "out.xlsx");

Hope helps a bit.