![]() |
Setting the category Label source for a Pie chart
I have a macro to set up the source data for a Piechart as below
With Worksheets("Summary_report").chartobjects(9).chart .setsourcedata source:=range(range_string), plotby:=xlcolumn end with The range_string is constructed by the macro before. As this is a Pie chart the range is a single column only but the range values are not contiguous. Similarly I want to set the category labels also programmatically but unable to find a suitable method / property in Chart object that will achieve this. The chartwizard method has an optional variant "categorylabels" but does not seem to work for Pie chart. Any help would be greatly appreciated Thanks, Sesh |
Setting the category Label source for a Pie chart
Hi Sesh,
Have you tried the macro recorder? The bare minimum for "categorylabels", ie x-axis value ..SeriesCollection(1).ApplyDataLabels xlDataLabelsShowLabel Alternatively for a bit more control Dim sr As Series, dlbls As Datalabels set sr = cht.SeriesCollection(1) sr.HasDataLabels = True Set dlbls = sr.DataLabels stop now look at dlbls in Locals, Alt-v, s Regards, Peter T "Seshadrinathan" wrote in message ... I have a macro to set up the source data for a Piechart as below With Worksheets("Summary_report").chartobjects(9).chart .setsourcedata source:=range(range_string), plotby:=xlcolumn end with The range_string is constructed by the macro before. As this is a Pie chart the range is a single column only but the range values are not contiguous. Similarly I want to set the category labels also programmatically but unable to find a suitable method / property in Chart object that will achieve this. The chartwizard method has an optional variant "categorylabels" but does not seem to work for Pie chart. Any help would be greatly appreciated Thanks, Sesh |
All times are GMT +1. The time now is 09:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com