Hi Carlos,
I've made a simple example that seems to works fine for me here.
I'm using random values, so I've calculated a threshold between the minimum and maximum values in the series (t) and I'm using it instead of your zero.
I'm also using a TColorLineTool to highlight that threshold. This the code I used:
Code: Select all
uses Series, TeeTools;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
t: Double;
begin
Chart1.View3D:=false;
with Chart1.AddSeries(TLineSeries) do
begin
FillSampleValues;
t:=YValues.MinValue+(YValues.MaxValue-YValues.MinValue)/5;
for i:=0 to Count-1 do
if YValue[i] >= t then
ValueColor[i]:=clLime
else
ValueColor[i]:=clRed;
end;
with Chart1.Tools.Add(TColorLineTool) as TColorLineTool do
begin
Axis:=Chart1.Axes.Left;
Value:=t;
end;
end;
And this is what I get:
- 2015-02-19_1121.png (35.55 KiB) Viewed 7478 times
Note that TeeChart draws the line segments in the color defined by the ValueColor on the index of the point in the right of the segment.
Also note the TLineSeries has to be set to use dsSegments DrawStyle; dsAll and dsCurve use the series Color property to draw all the series at once. dsSegments is the default DrawStyle so I didn't set it in the example above but I found it was worth mentioning it:
Code: Select all
(Chart1[0] as TLineSeries).DrawStyle:=dsSegments;