none
Changing colour of chart data series in Powerpoint RRS feed

  • Question

  • Hi,

    I'm trying to create an addin which will recolour the object the user has selected with a specific colour. This is easy to do with Shape objects, but I'm having trouble with Charts. I want to be able to recolour either a data series or a data point which is selected by the user. However I havent found a way to do it in Powerpoint (easy in Excel). If I just try to apply the shape formatting when a data point is selected, it will just colour the charts background.

     

    Any help?

    Edit: Forgot to add, this is in C#
    • Edited by ruggider Monday, November 21, 2011 3:28 AM
    Monday, November 21, 2011 3:28 AM

Answers

  • Hi Ruggider,

    What is the verison of your powerpoint? Mine is 2010.

    I knew your problem, and test on my side, but I haven't got the suitable workarounds. It seems that powerpoint does not support customizing accoring to the selection. I tested on my side, in Excel, we can set via the Selection :

    Sub SetSeriesColor()
    Dim s
    Set s = Selection
    s.LegendKey.Format.Fill.ForeColor.RGB = 1222222
    End Sub

    While in Powerpoint, the Selection does not stand for the the LengendKey, it is the shape which contains the chart, so the following code changes the chart's background:

    Sub Test()

     Dim s As Selection
     Set s = ActiveWindow.Selection
     s.ShapeRange.Fill.ForeColor.RGB = 111111

    End Sub

    Thank you for your understanding.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by ruggider Wednesday, November 23, 2011 12:53 AM
    Tuesday, November 22, 2011 7:49 AM

All replies

  • I've found how to colour a particular single series, e.g.

    Powerpoint.Chart chart = shape.Chart;

    Powerpoint.SeriesCollection sc = (Powerpoint.SeriesCollection) chart.SeriesCollection();

    Powerpoint.Series series = (Powerpoint.Series)sc.Item(1);

    series.Format.Fill.ForeColor.RGB = rgb;

     

    This would only colour the first series. The problem is I still cant work out how to get the particular series the user has selected

    Tuesday, November 22, 2011 6:29 AM
  • Hi Ruggider,

    What is the verison of your powerpoint? Mine is 2010.

    I knew your problem, and test on my side, but I haven't got the suitable workarounds. It seems that powerpoint does not support customizing accoring to the selection. I tested on my side, in Excel, we can set via the Selection :

    Sub SetSeriesColor()
    Dim s
    Set s = Selection
    s.LegendKey.Format.Fill.ForeColor.RGB = 1222222
    End Sub

    While in Powerpoint, the Selection does not stand for the the LengendKey, it is the shape which contains the chart, so the following code changes the chart's background:

    Sub Test()

     Dim s As Selection
     Set s = ActiveWindow.Selection
     s.ShapeRange.Fill.ForeColor.RGB = 111111

    End Sub

    Thank you for your understanding.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by ruggider Wednesday, November 23, 2011 12:53 AM
    Tuesday, November 22, 2011 7:49 AM
  • Thanks, I suspected it wasnt possible
    Wednesday, November 23, 2011 12:54 AM
  • Hi Ruggider,

    Maybe I am wrong,I found the thread unitentionally just now:
    http://social.msdn.microsoft.com/Forums/en-US/officegeneral/thread/8df1014d-c0c9-4ce5-ad76-cf81455b8f3c/#ee350325-392c-4bf3-8600-ed436f0409fd
    which is very similiar to your problem. The customer try to read the information from the ribbon via Windows API in Powerpoint 2007.

    See whether you can make use of the code snippet. Good luck.
    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us

    • Edited by Bruce Song Wednesday, November 23, 2011 1:23 AM
    Wednesday, November 23, 2011 1:23 AM
  • Hi Bruce Song,

    Can you help me to set the custom RGB colors to series in column chart in powerpoint? 

    I have 10 RGB values, which i want to set to chart for highest value one color and another color for lower value in chart and son on.. for all 10 value in column chart.

    Thanks in advance,

    kulchandra

    Tuesday, January 30, 2018 11:17 AM