Recent

Author Topic: Is it possible to have separate color and font props for points' marks and point  (Read 3203 times)

CM630

  • Hero Member
  • *****
  • Posts: 1091
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Is it possible to have separate color and font properties for points' marks and pointers?


Here is my source code:
Code: [Select]
procedure TForm1.Button1Click(Sender: TObject);
var
  ls: TLineSeries;
begin
  ls := TLineSeries.Create(Self);
  chart1.AddSeries (ls);
  TLineSeries(Chart1.Series[0]).LineType:=ltNone;
  TLineSeries(Chart1.Series[0]).Pointer.Visible:=True;
  TLineSeries(Chart1.Series[0]).Pointer.Style:= TSeriesPointerStyle.psCross;
  TLineSeries(Chart1.Series[0]).ShowPoints:=True;
  TLineSeries(Chart1.Series[0]).Marks.Visible:=True;
  TLineSeries(Chart1.Series[0]).Marks.Style:=smsLabel;
  TLineSeries(Chart1.Series[0]).Marks.Frame.Visible:=False;
 // TLineSeries(Chart1.Series[0]).Marks.LabelBrush.Style:=bsNone;  //I cannot find the USES for that

 TLineSeries(Chart1.Series[0]).Marks.LabelFont.Color:=clRed;
  TLineSeries(Chart1.Series[0]).Pointer.Pen.Color:=clRed;
  TLineSeries(Chart1.Series[0]).AddXY (2,1,'Point 0', clRed);

  TLineSeries(Chart1.Series[0]).Marks.LabelFont.Color:=clBlue;
  TLineSeries(Chart1.Series[0]).Pointer.Pen.Color:=clBlue;
  TLineSeries(Chart1.Series[0]).AddXY (1,1,'Point 1', clBlue);
end;
       
In the end I have two blue pointers with blue text, instead of one red and one blue.
Can I set these proiperties seprately or I have to use seprate series for each pointer?


Also, what uses is needed for the commented line in my source?
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

wp

  • Hero Member
  • *****
  • Posts: 11923
Adding a color specification to the Add calls of the series allows to modify the color of that particular data point. In case of a line series with pointers this affects the fill color of the symbol. Since you are using cross symbols which do not have a fill color you don't see an effect.

Marks.LabelFont is the same for all labels of the same series.

The only way to achieve what you want is in my opinion to use separate series.

CM630

  • Hero Member
  • *****
  • Posts: 1091
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
I was just starting to convert my code from separate series to single, because currently I have problems.  :(
I have to start thinking :'( , about a different solution.


Edit: I think I found a non-worse solution.
« Last Edit: January 14, 2014, 12:19:39 pm by paskal »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

 

TinyPortal © 2005-2018