Hello Team,
We are using Aspose.Slides in our .Net Core application and trying to create ChartType.WaterFall by adding chart into slide using slide.Shapes.AddChart() method.
We are facing issue in formatting the numbers and currency values based on current culture information and need your help.
Is this possible to apply the current culture number and currency format in WaterFall chart dynamically based on selected culture?
Please find the below screenshot1(Currency) and screenshot2(Number) for desire output, screenshot3(Currency) and screenshot4(Number) for current output** and code snippet for your reference and any help in this issue is really appreciated.
screenshot1
image.png (48.8 KB)
screenshot2
image.png (39.2 KB)
screenshot3
image.png (7.3 KB)
screenshot4
image.png (6.8 KB)
Code Snippet
public void AddChart(ISlide slide)
{
var categories = new List<string>();
var values = new List<double>();
var costValues = new List<double>();
var showCost = values.Count() == 0 ? true : false;
var chart = slide.Shapes.AddChart(Aspose.Slides.Charts.ChartType.Waterfall, 350, 280, 1400, 650);
chart.ChartData.Categories.Clear();
chart.ChartData.Series.Clear();
var workbook = chart.ChartData.ChartDataWorkbook;
for (int i = 0; i < categories.Count; i++)
{
chart.ChartData.Categories.Add(workbook.GetCell(0, i + 1, 0, categories[i]));
}
var seriesTitle = "Title Series";
var series = chart.ChartData.Series.Add(workbook.GetCell(0, 0, 1, seriesTitle), chart.Type);
// Set bars width
series.ParentSeriesGroup.GapWidth = Convert.ToUInt16(20);
var data = showCost ? costValues : values;
for (int i = 0; i < data.Count; i++)
{
var dp = series.DataPoints.AddDataPointForWaterfallSeries(workbook.GetCell(0, i + 1, 1, Math.Round(data[i], 2)));
dp.Label.DataLabelFormat.ShowValue = true;
dp.Label.DataLabelFormat.TextFormat.PortionFormat.FillFormat.FillType = FillType.Solid;
dp.Label.DataLabelFormat.TextFormat.PortionFormat.FillFormat.SolidFillColor.Color = chartConfig.DataLabelFontColor;
dp.Label.DataLabelFormat.Position = Color.White;
}
chart.HasTitle = false;
chart.HasLegend = false;
chart.Axes.HorizontalAxis.HasTitle = false;
chart.Axes.VerticalAxis.HasTitle = false;
}