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.
Tue Oct 11, 2016 4:15 pm
Hi, I have a Column3DStacked chart, how do I show the values in the data label above or inside the columns.
Regards
Mark
-
markfarrer
-
- Posts: 8
- Joined: Wed Sep 28, 2016 9:53 am
Wed Oct 12, 2016 6:06 am
Dear markfarrer ,
Thanks for your inquiry. Here are the codes for your reference.
- Code: Select all
Presentation ppt = new Presentation();
ppt.LoadFromFile(@"C:\Users\Administrator\Desktop\Test.pptx");
IChart chart = ppt.Slides[0].Shapes[0] as IChart;
ChartSeriesFormatCollection sers = chart.Series;
for (int i = 0; i < sers.Count; i++)
{
for (int j = 0; j < sers[i].Values.Count;j++ )
{
ChartDataLabel cd = sers[i].DataLabels.Add();
cd.LabelValueVisible = true;
}
}
ppt.SaveToFile("Result.pptx", FileFormat.Pptx2010);
Sincerely,
Nina
E-iceblue support team
-
Nina.Tang
-
- Posts: 1195
- Joined: Tue Sep 27, 2016 1:06 am
Wed Oct 12, 2016 8:59 am
Hi Nina
thank you, that work in a manner, however it also puts the category axis names in the data label with the value, I just need the value. I have attached some files to show you what I mean.
Regards
Mark
Login to view the files attached to this post.
-
markfarrer
-
- Posts: 8
- Joined: Wed Sep 28, 2016 9:53 am
Wed Oct 12, 2016 9:44 am
Dear markfarrer ,
Try to add the code
- Code: Select all
cd.CategoryNameVisible = false;
Sincerely,
Nina
E-iceblue support team
-
Nina.Tang
-
- Posts: 1195
- Joined: Tue Sep 27, 2016 1:06 am
Wed Oct 12, 2016 3:16 pm
Hi Nina
no, that didn't work, but after some playing around I found the answer by adding this property to my chart
chart.Series[0].DataLabels.LabelValueVisible = true;
Regards
Mark
-
markfarrer
-
- Posts: 8
- Joined: Wed Sep 28, 2016 9:53 am
Thu Oct 13, 2016 5:20 am
Dear markfarrer ,
I am glad that your issue is resolved. If you have any questions, welcome to contact us.
Sincerely,
Nina
E-iceblue support team
-
Nina.Tang
-
- Posts: 1195
- Joined: Tue Sep 27, 2016 1:06 am