[SOLVED] tachart legend colorbar lazarus / 55-TAChart ---------------------------------------------------------------------- apeoperaio · 2014-09-11 09:15 I posted an analogous message on the forum (Programming »  LCL). Since the problem was not solved I try to post on the correct forum place. I checked the legend demo but I got black squares instead of the text on the legend (Lazarus 1.2.5 r45573M FPC 2.6.4 i386-win32-win32/win64). See attached image. The modifications to TAChart  (and the demo too, in order to have a legend colorbar) have been merged to 1.2.4: r44583    TAChart   Add event OnDrawLegend to TChart r44588    TAChart   add code to legenddemo to demonstrate the ownerdrawn legend, fix some layout issues. ---------------------------------------------------------------------- wp · 2014-09-11 11:37 Yes it is a good idea to post questions on TAChart in its own board. I don't see the issue on trunk, but I do see it on 1.2.4. By chance, your issue was fixed along with modifications for supporting BiDiMode which have not yet been backported to the release version. There is a merge-request now for 1.2.6. In the meantime you can do this: Open tadrawercanvas.pas (in tachart folder)Find the procedure TADrawerCanvas.SimpleTextOut() and replace the entire procedure by the following procedureSaveRecompile TAChartLazarusPkgI tested with 1.2.4 which compiles the modification, and the demo runs fine.Code: [Select]procedure TCanvasDrawer.SimpleTextOut(AX, AY: Integer; const AText: String);   procedure DrawSimpleText(ACanvas: TCanvas; x, y: Integer; const txt: String);   // add right-to-left mode. Cannot use TextOut since it does not respect TextStyle   var     r: TRect;     ts: TTextStyle;   begin     ts := ACanvas.TextStyle;     ts.RightToLeft := false; //FRightToLeft;  -- wp: removed here because variable is unknown in 1.2.4     ts.Clipping := false;     r := Bounds(x, y, 1, 1);     ACanvas.TextRect(r, x, y, txt, ts);   end;   procedure DrawXorText;   var     bmp: TBitmap;     p, ext, bmpSize: TPoint;     a: Double;   begin     ext := GetCanvas.TextExtent(AText);     a := OrientToRad(GetCanvas.Font.Orientation);     bmpSize := MeasureRotatedRect(ext, a);     p := bmpSize div 2 - RotatePoint(ext div 2, -a);     bmp := TBitmap.Create;     try       bmp.SetSize(bmpSize.X, bmpSize.Y);       bmp.Canvas.Brush.Style := bsClear;       bmp.Canvas.Font := GetCanvas.Font;       bmp.Canvas.Font.Color := clWhite;       DrawSimpleText(bmp.Canvas, p.X, p.Y, AText);       bmp.Canvas.Pen.Color := clWhite;       BitBlt(         GetCanvas.Handle, AX - p.X, AY - p.Y, bmpSize.X, bmpSize.Y,         bmp.Canvas.Handle, 0, 0, SRCINVERT);     finally       bmp.Free;     end;   end; begin   if FXor then     DrawXorText   else     DrawSimpleText(GetCanvas, AX, AY, AText); end; ---------------------------------------------------------------------- apeoperaio · 2014-09-12 10:38 thanks!