Recent

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

CM630

  • Hero Member
  • *****
  • Posts: 885
  • Не съм сигурен, че те разбирам.
    • 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?
Лазар 2,0,6;W7 64bit or XP 32bit;FPC3,2,0;rev 62129

wp

  • Hero Member
  • *****
  • Posts: 7334
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.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

CM630

  • Hero Member
  • *****
  • Posts: 885
  • Не съм сигурен, че те разбирам.
    • 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 »
Лазар 2,0,6;W7 64bit or XP 32bit;FPC3,2,0;rev 62129

 

TinyPortal © 2005-2018