How to change Display Unit for column/bar chart


#1

My chart value start from 0 to 1000000, how can I set the Display Unit To Thousands?


#2

Currently you can only use the following code to set the display unit to hundreds:

valueAxis.DisplayUnit = DisplayUnitType.Hundreds;

I will allow to set it to Thousands soon.


#3

I am using Aspose.Cells 4.0.2.0 and cannot find valueAxis.DisplayUnit? Where I can find that?


#4

This is not included in v4.0.2 yet. Tomorrow I will add this property in the fix.


#5

Thanks. Can I know what date will have next update?


#6

Please try this attached version with following sample code:

Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
Cells cells = sheet.Cells;

cells["A1"].PutValue(10000);
cells["A2"].PutValue(20000);
cells["A3"].PutValue(30000);

Chart chart = sheet.Charts[sheet.Charts.Add(ChartType.Column, 3, 3, 13, 8)];
chart.NSeries.Add("A1:A3", true);

chart.ValueAxis.DisplayUnit = DisplayUnitType.Thousands;
workbook.Save("d:\\test\\abc.xls");


#7

DisplayUnit is working fine. Thank you for that.

Another question is how can I change the display unit label (text, format, orientation etc) and is it possible to set not showing Display Unit title?


#8

Currently setting display unit label is not supported.

We will refactoring chart APIs to support all chart settings in MS Excel. It will take about 2-3 months.