> Note that you must avoid using text functions
Yes, I changed my demo to:
program noguidemo;
{$mode objfpc}{$H+}
uses
Interfaces,
Classes,
FPCanvas,
FPImage,
FPImgCanv,
TATools,
TAGraph,
TASeries,
TADrawerCanvas,
TADrawUtils,
BGRABitmap,
TAChartUtils,
TADrawerBGRA;
var
chart: TChart;
bs: TBarSeries;
img: TBGRABitmap;
d: IChartDrawer;
begin
chart := TChart.Create(nil);
chart.Color := $FFA0A0;
chart.BackColor := $FFFFFF;
bs := TBarSeries.Create(nil);
chart.AddSeries(bs);
bs.AddXY(1, 10);
bs.AddXY(2, 7);
bs.AddXY(3, 8);
img := TBGRABitmap.Create(chart.Width, chart.Height);
d := TBGRABitmapDrawer.Create(img);
chart.Draw(d, Rect(0, 0, chart.Width, chart.Height));
img.SaveToFile('test.png');
img.Free;
bs.Free;
chart.Free;
end.
And the error is:
C:\Users\silvioprog\Desktop\nogui_bgra>noguidemo.exe
[FORMS.PP] ExceptionOccurred
Sender=EAccessViolation
Exception=Access violation
Stack trace:
$00000000
$0053C0AC TCHARTTEXTELEMENT__APPLYLABELFONT, line 279 of C:/lazarus/componen
ts/tachart/tatextelements.pas
$00539969 TGENERICCHARTMARKS$3$CRC16F2AB4F__APPLYLABELFONT, line 594 of C:/l
azarus/components/tachart/tatextelements.pas
$0053CABC TCHARTTEXTELEMENT__MEASURELABEL, line 426 of C:/lazarus/components
/tachart/tatextelements.pas
$00538DDB TCUSTOMCHARTAXISMARKS__MEASURE, line 577 of C:/lazarus/components/
tachart/tachartaxisutils.pas
$00535DBD TCHARTAXIS__MEASURE, line 698 of C:/lazarus/components/tachart/tac
hartaxis.pas
$005371E4 TCHARTAXISLIST__MEASURE, line 1028 of C:/lazarus/components/tachar
t/tachartaxis.pas
$00432451 TCHART__PREPAREAXIS, line 1203 of C:/lazarus/components/tachart/ta
graph.pas
$00430B9A TCHART__DRAW, line 772 of C:/lazarus/components/tachart/tagraph.pa
s
$00401AAC main, line 36 of noguidemo.lpr
TApplication.HandleException Access violation
Stack trace:
$00000000
$0053C0AC TCHARTTEXTELEMENT__APPLYLABELFONT, line 279 of C:/lazarus/componen
ts/tachart/tatextelements.pas
$00539969 TGENERICCHARTMARKS$3$CRC16F2AB4F__APPLYLABELFONT, line 594 of C:/l
azarus/components/tachart/tatextelements.pas
$0053CABC TCHARTTEXTELEMENT__MEASURELABEL, line 426 of C:/lazarus/components
/tachart/tatextelements.pas
$00538DDB TCUSTOMCHARTAXISMARKS__MEASURE, line 577 of C:/lazarus/components/
tachart/tachartaxisutils.pas
$00535DBD TCHARTAXIS__MEASURE, line 698 of C:/lazarus/components/tachart/tac
hartaxis.pas
$005371E4 TCHARTAXISLIST__MEASURE, line 1028 of C:/lazarus/components/tachar
t/tachartaxis.pas
$00432451 TCHART__PREPAREAXIS, line 1203 of C:/lazarus/components/tachart/ta
graph.pas
$00430B9A TCHART__DRAW, line 772 of C:/lazarus/components/tachart/tagraph.pa
s
$00401AAC main, line 36 of noguidemo.lpr
Exception at 00000000: EAccessViolation:
Access violation.
C:\Users\silvioprog\Desktop\nogui_bgra>