I have a TAreaSeries filled with data like this:

I’m using this code to draw vertical lines on the chart:
procedure TfrmDistributionChart.dbcDistributionAfterDraw(Sender: TObject);
var
XPos: Integer;
begin
dbcDistribution.Canvas.Pen.Width := 3;
dbcDistribution.Canvas.Pen.Color := clBlack;
XPos := dbcDistribution.BottomAxis.CalcPosValue(0);
dbcDistribution.Canvas.DoVertLine(XPos, dbcDistribution.LeftAxis.IStartPos,
dbcDistribution.LeftAxis.IEndPos);
dbcDistribution.Canvas.Pen.Color := clBlue;
XPos := dbcDistribution.BottomAxis.CalcPosValue(-SD);
dbcDistribution.Canvas.DoVertLine(XPos, dbcDistribution.LeftAxis.IStartPos,
dbcDistribution.LeftAxis.IEndPos);
XPos := dbcDistribution.BottomAxis.CalcPosValue(SD);
dbcDistribution.Canvas.DoVertLine(XPos, dbcDistribution.LeftAxis.IStartPos,
dbcDistribution.LeftAxis.IEndPos);
dbcDistribution.Canvas.Pen.Color := clGreen;
XPos := dbcDistribution.BottomAxis.CalcPosValue(-2 * SD);
dbcDistribution.Canvas.DoVertLine(XPos, dbcDistribution.LeftAxis.IStartPos,
dbcDistribution.LeftAxis.IEndPos);
XPos := dbcDistribution.BottomAxis.CalcPosValue(2 * SD);
dbcDistribution.Canvas.DoVertLine(XPos, dbcDistribution.LeftAxis.IStartPos,
dbcDistribution.LeftAxis.IEndPos);
dbcDistribution.Canvas.Pen.Color := clRed;
XPos := dbcDistribution.BottomAxis.CalcPosValue(-3 * SD);
dbcDistribution.Canvas.DoVertLine(XPos, dbcDistribution.LeftAxis.IStartPos,
dbcDistribution.LeftAxis.IEndPos);
XPos := dbcDistribution.BottomAxis.CalcPosValue(3 * SD);
dbcDistribution.Canvas.DoVertLine(XPos, dbcDistribution.LeftAxis.IStartPos,
dbcDistribution.LeftAxis.IEndPos);
end;
I would like to change the color of the series to match the color of its outer border (e.g. blue for the central slices, green for the middle ones, and red for the outermost ones). Is this possible with TeeChart Standard v2011.03.32815 32bit VCL?
Also, I couldn’t find the correct way of trimming my vertical lines in order to refrain from expanding beyond the area they are drawn on. How should I calculate the proper height of each of these 7 lines?
There are two ways to set the colors:
When you add values to the series.
Where
clYourColorBasedOnX( x : Double): TColor;is a function you define.Before presenting the series.
A set of calls with your ranges.
As for the user drawn lines max value, try walking Series.XValues[i] until you find the closest limit value, take the index and set max to Series1.YValues[index].
Repeat until all limits are set.