Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.
Thu Feb 22, 2018 9:09 am
Hi there,
As title, i want to show the max value of line chart. (Please see attachment).
Can you show me the way to achieving this?
Thanks,
Nhat
Login to view the files attached to this post.
-
nhatnlh
-
- Posts: 8
- Joined: Fri Jan 19, 2018 6:42 am
Fri Feb 23, 2018 8:08 am
Hello,
Thanks for your inquiry. If the max value you mentioned is Data Lable of Chart, you could use the following method to achieve it, if not, please provide us with the document you expect, you could create it directly with MS PowerPoint, and then we will look into it and provide you with the corresponding method.
- Code: Select all
int[] value = new int[chart.Series[0].Values.Count];
for (int i = 0; i < chart.Series[0].Values.Count; i++)
{
value[i] = (int)chart.Series[0].Values[i].Value;
}
for (int i = 0; i < chart.Series[0].Values.Count; i++)
{
if ((int)chart.Series[0].Values[i].Value == value.Max())
{
ChartDataLabel lable = chart.Series[0].DataLabels.Add();
lable.LabelValueVisible = true;
}
else
{
chart.Series[0].DataLabels.Add();
}
}
Sincerely,
Gary
E-iceblue support team
-
Gary.zhang
-
- Posts: 1380
- Joined: Thu Apr 04, 2013 1:30 am
Fri Mar 16, 2018 1:56 am
This code worked like a charm. I'm very happy to resolve this issue.
Thank you for your quick response.
-
nhatnlh
-
- Posts: 8
- Joined: Fri Jan 19, 2018 6:42 am
Fri Mar 16, 2018 5:53 am
Hello,
Thanks for your feedback. If there is any other question, welcome to write to us.
Best regards,
Simon
E-iceblue support team
-
Simon.yang
-
- Posts: 620
- Joined: Wed Jan 11, 2017 2:03 am