Never worked a lot with the nogui widgetset, so maybe the following thoughts are not correct...
But when you compare the contents of the directory (lazarus)/lcl/interfaces/nogui with those of, say, (lazarus)/lcl/interfaces/win32 you see that there almost no files. This means that most of the features available in the win32 or gtk2 or qt widgetsets is not available. Under "Project options" > "Additions and overrides" add a new option "-gw2" which forces rebuilding all required units with Dwarf-2 debug information. Then set a breakpoint on AChart.SaveToBitmap and step into the procedure. This will lead you to TCanvas.Requiredstate where a handle for the canvas is created (CreateHandle). Debugging into CreateHandle finally leads you to RawImage_CreateBitmaps which is a widgetset function; but for nogui this is not implemented and it will do nothing. No way to create a bitmap image under nogui this way...
Rather than that, you must follow the steps proposed by the noguidemo of TAChart: Create an FPMemoryImage and an associated FPImageCanvas and paint on this handle-free canvas.
Here is a simple demo how this could be done:
program project1;
{$mode objfpc}{$H+}
uses
Classes,
FPCanvas, FPImage, FPImgCanv, FPWriteBmp;
const
W = 300;
H = 200;
var
img: TFPMemoryImage;
c: TFPImageCanvas;
writer: TFPWriterBMP;
stream: TFileStream;
begin
img := TFPMemoryImage.Create(W, H);
try
c := TFPImageCanvas.Create(img);
try
c.Brush.FPColor := colYellow;
c.FillRect(0, 0, W, H);
c.Pen.FPColor := colRed;
c.Pen.Width := 3;
c.Line(0, 0, W, H);
c.Line(0, H, W, 0);
writer := TFPWriterBMP.Create;
try
stream := TFileStream.Create('test.bmp', fmCreate + fmOpenWrite);
try
writer.ImageWrite(stream, img);
finally
stream.Free;
end;
finally
writer.Free;
end;
finally
c.Free;
end;
finally
img.Free;
end;
WriteLn('Done.');
ReadLn;
end.
This code does not require the Graphics unit and thus is independent of the LCL. In case of TAChart, however, this becomes more difficult because it DOES use the Graphics unit, and in case of the nogui widgetset all its graphics calls would run into nowhere. Therefore, TAChart has the concept of drawing backends which redirects all drawing commands to an internal "drawer" class. In our case, the correct drawer is the TFPCanvasDrawer, which paints on a TFPCanvas like in above example. All drawing codes require this drawer as a parameter.
Please study the noguidemo of the TAChart installation. Tell me what is not working here (except for the fonts issue which I already know).