[Lazarus] Get JPEG from TAChart in CGI app

Leonardo M. Ramé l.rame at griensu.com
Sun Mar 20 21:14:02 CET 2011


On 2011-03-21 06:00:20 +1000, Alexander Klenin wrote:
> On Mon, Mar 21, 2011 at 05:42, Leonardo M. Ramé <l.rame at griensu.com> wrote:
> >
> > [Sun Mar 20 16:30:09 2011] [error] [client ::1] (cgicharts:16246):
> > Gtk-WARNING **: cannot open display:
> > [Sun Mar 20 16:30:09 2011] [error] [client ::1] Premature end of script
> > headers: cgicharts
> 
> Unfortunately, I am not an expert in GTK -- it seems that it tries to
> initialize display even if there is nothing to draw.
> I am not sure if it is fixable -- the demo I posted does work as a CGI
> under Apache on Windows, so it may be GTK problem, Lazarus problem,
> or X-server/GTK/Apache configuration problem.
> You might want to try fpgui widgetset -- it depends only on X,
> which may work even if GTK does not.
> 
> Of course, it would be ideal to create a version of TAChart that does not
> require a widgetset, but the task is complicated by compatibility requirements.
> I have already made some progress in this direction -- see
> IChartDrawer infrastructure.
> TAChart is mostly independent of TCanvas -- it only needs one for events
> and interactive tools.
> Few drawing back-ends exist -- AggPas, OpenGL, and more are planned,
> in particular SVG, which will probably be most suitable for web apps.
> Unfortunately, all back-ends have limitations compared to TCanvas
> (for example OpenGL has very limited text rendering capabilities,
> and "pure" TFPCanvas does not even support TColor).
> 

Thanks for the explanation Alexander.

Looking at the TChart.PaintOnCanvas method, I see you use a TCanvasDrawer class to draw over a TCanvas. I
think it shouldn't be too difficult to use a TFPImageCanvas when using
NoGui widgetset. What do you think?

-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com




More information about the Lazarus mailing list