Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Apr 30, 2019 11:14 am

Hi again,

is there a way to add a unit like $, € or £ to the Datalables over the Datapoints from example an Barchart?

i create the data over EnteredDirectlyValues as numeric.

Semjasa
 
Posts: 36
Joined: Wed Dec 19, 2018 11:50 am

Wed May 01, 2019 7:58 am

Hi,

Thank you for your inquiry.
Please refer to the following code to add a unit to the Datalables. If there is any question, please feel free to write back.
Code: Select all
 Workbook workbook = new Workbook();
 workbook.Worksheets.Clear();
 Worksheet sheet = workbook.Worksheets.Add("sheet1");
 //create the barchart
 Chart chart = sheet.Charts.Add(ExcelChartType.BarClustered);
 var serie = chart.Series.Add();
 serie.EnteredDirectlyValues = new object[] { 100, 200, 300 };
 serie.EnteredDirectlyCategoryLabels = new object[] { "Label1", "Label2", "Label3" };
 chart.Series[0].DataPoints.DefaultDataPoint.DataLabels.HasValue = true;
 //use "\"$\"#,##0","\"€\"#,##0","\"£\"#,##0" to set unit for the dataLabels
 chart.Series[0].DataPoints.DefaultDataPoint.DataLabels.NumberFormat = "\"$\"#,##0";
 workbook.SaveToFile("result.xlsx", ExcelVersion.Version2013);

Sincerely,
Nancy
E-iceblue support team
User avatar

nancy.yang
 
Posts: 184
Joined: Wed Apr 03, 2019 2:33 am

Mon May 06, 2019 10:08 am

Hi,

Did my code help you? Could you please give us some feedback at your convenience? Thanks in advance.

Sincerely,
Nancy
E-iceblue support team
User avatar

nancy.yang
 
Posts: 184
Joined: Wed Apr 03, 2019 2:33 am

Mon Jun 03, 2019 7:48 am

Yes this is helpfull sorry for the late answer

Semjasa
 
Posts: 36
Joined: Wed Dec 19, 2018 11:50 am

Mon Jun 03, 2019 8:42 am

Hi,

Thanks for your feedback.
If there is anything we can do for you in the future, please do not hesitate to contact us.
Wish you all the best!

Sincerely,
Nancy
E-iceblue support team
User avatar

nancy.yang
 
Posts: 184
Joined: Wed Apr 03, 2019 2:33 am

Return to Spire.XLS