code_junkie

Prevent series from using clWhite with Delphi TChart

Nov 11th, 2011
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. SetDefaultColorPalette; // Make sure we start with the default
  2. ColorPalette[4] := $007FFF; // Change White to Orange
  3. try
  4. // add series to the chart
  5. finally
  6. SetDefaultColorPalette; // Set it back to Default
  7. end;
  8.  
  9. procedure TForm1.setColors(aChart: TChart; aColorArray: array of TColor);
  10. var
  11. chi : Integer;
  12. coi : Integer;
  13. begin
  14. coi := low(aColorArray);
  15. for chi := 0 to aChart.SeriesList.Count - 1 do begin
  16. aChart.SeriesList[chi].Color := aColorArray[coi];
  17. inc(coi);
  18. if coi > high(aColorArray) then
  19. coi := low(aColorArray);
  20. end;
  21. end;
  22.  
  23. procedure TForm1.FormShow(Sender: TObject);
  24. var
  25. ca : array of TColor;
  26. begin
  27. setLength(ca, 3);
  28. ca[0] := clRed;
  29. ca[1] := clBlue;
  30. ca[2] := clGreen;
  31. setColors(Chart1, ca);
  32. end;
Add Comment
Please, Sign In to add comment