Labels on top of CandleSeries !!
Posted: Mon Jan 16, 2006 2:45 am
I need help to write text (3-4 chars) on top of the highest point of selected candlesticks. The code stub I am using is given below (does not draw text):-
procedure TFChart01.plotcspatterns;
var i:integer;
FromPoint,ToPoint:TPoint;
begin
// Skip first 2 candles
for i:=2 to Series1.Count-1 do
begin
/Chart1.Canvas.ClipRectangle(Chart1.ChartRect);
// Series1 is TCandleSeries
ToPoint.X := Series1.CalcXPos(i);
ToPoint.Y := Series1.CalcYPosValue(Series1.HighValues.Value);
FromPoint.X := ToPoint.X;
FromPoint.Y := ToPoint.Y - 10;
Series1.ParentChart.Canvas.Pen.Color:=clRed;
Series1.ParentChart.Canvas.Pen.Style:=psSolid;
Series1.ParentChart.Canvas.Brush.Color := clLime;
Series1.ParentChart.Canvas.Brush.Style := bsSolid;
// Next two statements do not work
if i=10 then Series1.ParentChart.Canvas.TextOut(FromPoint.X,FromPoint.Y,'DJ');
Chart1.Canvas.TextOut(500,500,'DJ');
Chart1.Canvas.UnClipRectangle;
end;
end;
Will appreciate if you could let me know what I am missing in the above code. A small functioning code segment for writing text on the chart will be appreciated.
Please also let me know how to determine the minimum and maximum values assigned to a scale in case of automatic scaling of Y axis. I need to draw horizontal (pivot) lines at certain levels but have to first check that
it falls within the maximum & minimum Y scale.
Regards,
Satish
Regards,
Satish
procedure TFChart01.plotcspatterns;
var i:integer;
FromPoint,ToPoint:TPoint;
begin
// Skip first 2 candles
for i:=2 to Series1.Count-1 do
begin
/Chart1.Canvas.ClipRectangle(Chart1.ChartRect);
// Series1 is TCandleSeries
ToPoint.X := Series1.CalcXPos(i);
ToPoint.Y := Series1.CalcYPosValue(Series1.HighValues.Value);
FromPoint.X := ToPoint.X;
FromPoint.Y := ToPoint.Y - 10;
Series1.ParentChart.Canvas.Pen.Color:=clRed;
Series1.ParentChart.Canvas.Pen.Style:=psSolid;
Series1.ParentChart.Canvas.Brush.Color := clLime;
Series1.ParentChart.Canvas.Brush.Style := bsSolid;
// Next two statements do not work
if i=10 then Series1.ParentChart.Canvas.TextOut(FromPoint.X,FromPoint.Y,'DJ');
Chart1.Canvas.TextOut(500,500,'DJ');
Chart1.Canvas.UnClipRectangle;
end;
end;
Will appreciate if you could let me know what I am missing in the above code. A small functioning code segment for writing text on the chart will be appreciated.
Please also let me know how to determine the minimum and maximum values assigned to a scale in case of automatic scaling of Y axis. I need to draw horizontal (pivot) lines at certain levels but have to first check that
it falls within the maximum & minimum Y scale.
Regards,
Satish
Regards,
Satish