Search code examples
delphiteechartdelphi-10.3-rio

Delphi - How to change t chart series's colourpalette?


I have an TAreaGraph with

(series[0] as tareaseries).coloreachpoint := true;
with chart1 do
    series[0].addXY( {the x-value} , {the y-value}, {name} , clTeeColor);
end;

So now, the bars, or points, are all different colours, but i hate the colour palette. I saw in the object inspector, there is an option when adding a new series and selecting the type, to change the colour palette to Mac Os.

I have tried everything to do this at runtime, because I am adding the series dynamically, to no avail. Any help would greatly be appreciated!

Regards, Romans.


Solution

  • Putting a chart on a form and changing the palette to iOS then viewing the form as text gives:

      object Chart1: TChart
        Left = 176
        Top = 136
        Width = 400
        Height = 250
        Title.Text.Strings = (
          'TChart')
        TabOrder = 0
        DefaultCanvas = 'TGDIPlusCanvas'
        ColorPaletteIndex = 18
      end
    

    So the property is ColorPaletteIndex and for the iOS color palette you would use 18. There might be an enumeration with nice values somewhere but the number will work fine.

      chart1.ColorPaletteIndex := 18;