Hello,
I tried to find answer on your demo, but I failed.
Could you tip me, how to rotate annotation ?
or how to write a sideways character
best regards
# Windows7(64) / Delphi10
Hi,
You can achieve this with the following code (please note that the drawing is based on pointindex 4 in this sample and the text is drawn from the top of the chart to the bottom:
procedure TForm112.AdvGDIPChartView1AfterDrawSeries(Sender: TObject;
ARect: TRect; ACanvas: TCanvas; APaneIndex: Integer);
var
r: TRect;
s: TChartSerie;
xm, ym: Integer;
tf: TFont;
lf: TLogFont;
str: string;
tw, th: integer;
pt: Integer;
begin
tf := TFont.Create;
tf.Size := 18;
tf.Color := clRed;
GetObject(tf.Handle, SizeOf(lf), @lf);
lf.lfEscapement := 900;
lf.lfOrientation := 900;
tf.Handle := CreateFontIndirect(lf);
ACanvas.Font.Assign(tf);
tf.Free;
s := AdvGDIPChartView1.Panes[0].Series[0];
r := AdvGDIPChartView1.Panes[0].Series.SeriesRectangle;
str := 'Hello World !';
tw := ACanvas.TextWidth(str);
th := ACanvas.TextHeight(str);
pt := 4;
xm := s.GetDrawPoint(pt).X - th div 2;
ym := r.Top + tw;
ACanvas.Brush.Style := bsClear;
ACanvas.TextOut(xm, ym, str);
end;
Kind Regards,
Pieter