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.
Mon Nov 26, 2018 3:38 am
Hello,
I want to change format of data label of doughnut chart in Excel chart.
I set DataLabels.HasValue = true; DataLabels.HasPercentage = true;
Format of data label now, for example, is 330, 21% or 1239, 79%
I want it will be 330 (21%) and 1239 (79%)
Could it happen?
Current situation in attachment.
Thanks!
- Attachments
-
- ClosedXMLResultDonutChart.rar
- (7.1 KiB) Downloaded 195 times
-
rickyjessy
-
- Posts: 16
- Joined: Fri Nov 23, 2018 8:20 am
Mon Nov 26, 2018 6:59 am
Hi,
Thanks for your inquiry.
Please refer to below code to get the result you expected.
- Code: Select all
DataLabels.HasValue = true;
DataLabels.HasPercentage = true;
DataLabels.NumberFormat = "(##0%)"; // set the format of the number
DataLabels.Delimiter = " "; // set the separator
Any question, just feel free to contact us.
Sincerely,
Mike
E-iceblue support team
-
Mike.Zhang
-
- Posts: 93
- Joined: Thu Sep 27, 2018 7:11 am
Mon Nov 26, 2018 8:42 am
Hi Mike,
Thanks you for your response.
It's really help me!
I am pretty grateful.
But if I furtherly hope that data is divided into two lines.
Just like :
330
(21%)
Could it happen?
Thanks you!
-
rickyjessy
-
- Posts: 16
- Joined: Fri Nov 23, 2018 8:20 am
Mon Nov 26, 2018 9:29 am
Hi,
Thanks for your feedback.
Please refer to below code.
- Code: Select all
DataLabels.HasValue = true;
DataLabels.HasPercentage = true;
DataLabels.NumberFormat = "(##0%)"; // set the format of the number
DataLabels.Delimiter = "\n"; // wrap line
Sincerely,
Mike
E-iceblue support team
-
Mike.Zhang
-
- Posts: 93
- Joined: Thu Sep 27, 2018 7:11 am
Thu Nov 29, 2018 8:35 am
Hi,
Greeting from e-iceblue.
Have you tried the code? Could you please give us some feedback at your convenience? Thanks in advance.
Sincerely,
Mike
E-iceblue support team
-
Mike.Zhang
-
- Posts: 93
- Joined: Thu Sep 27, 2018 7:11 am
Mon Dec 03, 2018 8:06 am
HI,
Sorry for the late reply.
It's pretty useful for me to solve my problem.
Thanks!
-
rickyjessy
-
- Posts: 16
- Joined: Fri Nov 23, 2018 8:20 am
Mon Dec 03, 2018 8:22 am
Hi,
Thanks for your feedback.
Any question, just feel free to contact us.
Sincerely,
Mike
E-iceblue support team
-
Mike.Zhang
-
- Posts: 93
- Joined: Thu Sep 27, 2018 7:11 am
Thu Dec 27, 2018 3:44 am
Hi Mike,
Now If I want to show decimal point, like 330 (21.03%) and 1239 (78.97%).
Could it happened?
Thanks!
-
rickyjessy
-
- Posts: 16
- Joined: Fri Nov 23, 2018 8:20 am
Thu Dec 27, 2018 6:26 am
Hi,
Thanks for your inquiry.
As for showing 2 decimal points, you just need to set the number format as "#0.00%".
- Code: Select all
DataLabels.NumberFormat = "(#0.00%)"
Below is the setting format for your kind reference:
- Code: Select all
"#" - Digit placeholder
"0" - Zero placeholder
"," - Decimal point
"." - Decimal separator
"[Red]" - Color specifier
"%" - Percentage placeholder
If there is any question, welcome to get it back to us.
Sincerely,
Betsy
E-iceblue support team
-
Betsy.jiang
-
- Posts: 3099
- Joined: Tue Sep 06, 2016 8:30 am
Thu Dec 27, 2018 8:21 am
Hi, Betsy
It's pretty useful for me to solve my problem.
Thanks!
-
rickyjessy
-
- Posts: 16
- Joined: Fri Nov 23, 2018 8:20 am
Thu Dec 27, 2018 9:25 am
Hi,
Thanks for your feedback.
Please feel free to contact us if there is any question.
Sincerely,
Betsy
E-iceblue support team
-
Betsy.jiang
-
- Posts: 3099
- Joined: Tue Sep 06, 2016 8:30 am