[SOLVED] Print an arrow into a TAChart lazarus / 55-TAChart ---------------------------------------------------------------------- donnie · 2016-12-05 12:55 Hi there, I have drawn an arrow from a start point A(x0,y0 let's say 0,0) to an end point B(x1,y1). The shape of the arrow shows that direction from A to B (A->B). The code I used is this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var Arrow1: TFieldSeries; .....begin        Line1 := TLineSeries.Create(self);       Chart1.AddSeries(Line1);           Arrow1 := TFieldSeries.Create(self);      Chart1.AddSeries(Arrow1);       for i := Low(Array1) to High(Array1) do        Line1.AddXY(Array1[i].y, Array2[i].y); // Array1 and Array2 have the same Length       Arrow1.AddVector(Array1[High(Array1)].y/2, Array2[High(Array2)].y/2, Array1[High(Array1)].y, Array2[High(Array2)].y, '', $0000FF);      Arrow1.Pen.Width:=3;      Arrow1.Arrow.BaseLength := ArrowPView1.Arrow.Length;    end; As I want the arrow to start from (0,0) and end to the my last point I use the Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Arrow1.AddVector(Array1[High(Array1)].y/2, Array2[High(Array2)].y/2, Array1[High(Array1)].y, Array2[High(Array2)].y, '', $0000FF);When I draw the chart everything seems ok. But when I print the chart the arrow get too much bigger. I believe that the problem must be the GraphToImage(DoublePoint(x1, y1)). I also need to draw that arrow above all lines in the TAChart (so its Zposition must be the bigger). ---------------------------------------------------------------------- wp · 2016-12-05 13:33 Could you post a little demo showing the issue? Only pas, lfm, lpi and lpr files packed into common zip, please. And remove everything which is not needed to demonstrate the bug. ---------------------------------------------------------------------- donnie · 2016-12-05 14:27 Yes after a little hour I manage to keep the necessary. Click Draw first and after that Print. ---------------------------------------------------------------------- wp · 2016-12-05 15:13 Please try r53560. I had to modify your demo since I don't have two required packages (lz_report, lz_tachart - what are these?), but I think it is working now. P.S. Seems to be CodeTyphoon... In this case my patch does not help you immediately. Open ]"]>Blockedltiseries.pas, go to procedure TFieldSeries.DrawVector. After the line "if FArrow.Visible" there's an assignment to len. Divide this calculation by ADrawer.Scale(1). The entire DrawVector method should read: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TFieldSeries.DrawVector(ADrawer: IChartDrawer;  AStartPt, AEndPt: TDoublePoint; APen: TPen);var  p1, p2: TPoint;  arr: TChartArrow;  len: Double;begin  p1 := ParentChart.GraphToImage(AStartPt);  p2 := ParentChart.GraphToImage(AEndPt);  ADrawer.Pen := APen;  ADrawer.Line(p1.x, p1.y, p2.x, p2.y);  if FArrow.Visible then begin  len := sqrt(sqr(p2.x - p1.x) + sqr(p2.y - p1.y)) * 0.01 / ADrawer.Scale(1);    // Be aware that the drawer scales pixels. But the arrow length here is    // already at the correct size!    arr := TChartArrow.Create(nil);    arr.Assign(FArrow);    arr.SetOwner(nil);  // avoid repainting due to next commands    arr.BaseLength := round(FArrow.BaseLength * len);    arr.Length := round(FArrow.Length * len);    arr.Width := round(FArrow.Width * len);    arr.Draw(ADrawer, p2, arctan2(p2.y-p1.y, p2.x-p1.x), APen);    arr.Free;  end;end; ---------------------------------------------------------------------- donnie · 2016-12-06 08:04 Yeap, exactly that!!! Now the print is perfect. You are the master of the chart my friend. Thanks once again wp!!!