1

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.

Tom Brunberg
  • 20,312
  • 8
  • 37
  • 54
Romans
  • 469
  • 1
  • 4
  • 17
  • 1
    *I have tried everything*, but you don't show a single thing you've tried. – Ken White Jul 26 '20 at 13:04
  • I am referring to just randomly typing possible names for methods or properties. My apologies if that was unclear. – Romans Jul 26 '20 at 15:18
  • After using the designer view the form as text to see what property is set and to what. To view a form as text right click on it in the designer and near the bottom is an entry for _view as text_. To get back right click again and _view as form_ is in the middle of the menu. – Brian Jul 26 '20 at 16:00
  • So, in stead of random trial and error, maybe create your own palette as an array of `TColor`, where each entry is a combination of BGR color components. E.g. $FFFFFF for white, $FF0000 for blue, $00FF00 for lime, $0000FF for red. Or use ready made color constants like `clCream ($F0FBFF)` and others. Then in `series[0].addXY()` replace `clTeeColor` with a color from your own palette. You get exactly the result you write. – Tom Brunberg Jul 26 '20 at 16:20

1 Answers1

2

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;
Brian
  • 6,717
  • 2
  • 23
  • 31
  • Hello, Brian. How do you view it as text? I would like to know so that I could check if I have similar question in the future. – Romans Oct 08 '20 at 10:58
  • 1
    @Romans right click on the form with the chart, in the menu that comes up there should be a ''View as Text" near the bottom. Right clicking in the text there will be a "View as form" in the middle to get back. Look through the text for the object you are looking for what properties to set etc. – Brian Oct 08 '20 at 12:08