[Lazarus] Get JPEG from TAChart in CGI app

classic Classic list List threaded Threaded
56 messages Options
123
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Get JPEG from TAChart in CGI app

Leonardo M. Ramé
Hi, I would like to know how can I let a CGI app return a JPeg image
from a TChart.

Here's what I'm doing:

procedure TFPWebModule1.getchartRequest(Sender: TObject; ARequest:
TRequest;
  AResponse: TResponse; var Handled: Boolean);
var
  lRect: TRect;
  lChart: TChart;
  lJPegImage: TFPMemoryImage;
  lJPegWriter: TFPWriterJPEG;
  lCanvas: TFPCustomCanvas;
begin
  lChart := TChart.Create(nil);
  lJPegImage := TFPMemoryImage.Create(100, 100);
  lJPegImage.UsePalette := False;
  lCanvas := TFPImageCanvas.create(lJPegImage);
  lJPegWriter := TFPWriterJPEG.Create;
  try
    lChart.Width := 100;
    lChart.Height := 100;
    DoSomeStuffWithTheChart(lChart);
    lRect := Rect(0,0, lChart.Width, lChart.Height);
    lCanvas.CopyRect(0,0,TFPCustomCanvas(lChart.Canvas),lRect);
    lJPegWriter.ImageWrite(AResponse.ContentStream, lJPegImage);
  finally
    lChart.Free;
    lJPegWriter.Free;
    lCanvas.Free;
    lJPegImage.Free;
  end;
  Handled := True;
end;      

After executing the method I'm getting "Control '' has no parent
window' at the CopyRect line. I'm sure there is another method to copy a
TCanvas to a TFPCustomCanvas.

Any hint?

Thanks in advance,
--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
On Mon, Mar 21, 2011 at 03:22, Leonardo M. Ramé <[hidden email]> wrote:

>    lCanvas.CopyRect(0,0,TFPCustomCanvas(lChart.Canvas),lRect);

> After executing the method I'm getting "Control '' has no parent
> window' at the CopyRect line. I'm sure there is another method to copy a
> TCanvas to a TFPCustomCanvas.

Use Chart.PaintOnCanvas instead. See savedemo for an example.
Note that you must give it full TCanvas -- just TFPCanvas is not enough.

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Leonardo M. Ramé
On 2011-03-21 03:58:12 +1000, Alexander Klenin wrote:

> On Mon, Mar 21, 2011 at 03:22, Leonardo M. Ramé <[hidden email]> wrote:
>
> >    lCanvas.CopyRect(0,0,TFPCustomCanvas(lChart.Canvas),lRect);
>
> > After executing the method I'm getting "Control '' has no parent
> > window' at the CopyRect line. I'm sure there is another method to copy a
> > TCanvas to a TFPCustomCanvas.
>
> Use Chart.PaintOnCanvas instead. See savedemo for an example.
> Note that you must give it full TCanvas -- just TFPCanvas is not enough.
>

Yes, but, how can I use a TCanvas in a CGI app?

If I write:

Chart.PaintOnCanvas(TCanvas(lCanvas), Rect(0, 0, 100, 100));  

I get an Access Violation.

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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Michael Van Canneyt


On Sun, 20 Mar 2011, Leonardo M. Ramé wrote:

> On 2011-03-21 03:58:12 +1000, Alexander Klenin wrote:
>> On Mon, Mar 21, 2011 at 03:22, Leonardo M. Ramé <[hidden email]> wrote:
>>
>>>    lCanvas.CopyRect(0,0,TFPCustomCanvas(lChart.Canvas),lRect);
>>
>>> After executing the method I'm getting "Control '' has no parent
>>> window' at the CopyRect line. I'm sure there is another method to copy a
>>> TCanvas to a TFPCustomCanvas.
>>
>> Use Chart.PaintOnCanvas instead. See savedemo for an example.
>> Note that you must give it full TCanvas -- just TFPCanvas is not enough.
>>
>
> Yes, but, how can I use a TCanvas in a CGI app?
>
> If I write:
>
> Chart.PaintOnCanvas(TCanvas(lCanvas), Rect(0, 0, 100, 100));
>
> I get an Access Violation.
Simply said: you can't.

The current TAChart is not suitable for a CGI application. It expects a GUI.

Michael.
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
2011/3/21 Michael Van Canneyt <[hidden email]>:
>> Yes, but, how can I use a TCanvas in a CGI app?
>>
>> If I write:
>>
>> Chart.PaintOnCanvas(TCanvas(lCanvas), Rect(0, 0, 100, 100));
>>
>> I get an Access Violation.

Of course, since you are converting an object to the type it does not belong to.
You should create a TBitmap or another similar object.
Did you look at the savedemo as I proposed in a previous mail?

> Simply said: you can't.
> The current TAChart is not suitable for a CGI application. It expects a GUI.

Why do you think so?
TAChart should be prefectly capable of rendering on bitmap-based canvas.

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Leonardo M. Ramé
On 2011-03-21 04:38:46 +1000, Alexander Klenin wrote:

> 2011/3/21 Michael Van Canneyt <[hidden email]>:
> >> Yes, but, how can I use a TCanvas in a CGI app?
> >>
> >> If I write:
> >>
> >> Chart.PaintOnCanvas(TCanvas(lCanvas), Rect(0, 0, 100, 100));
> >>
> >> I get an Access Violation.
>
> Of course, since you are converting an object to the type it does not belong to.
> You should create a TBitmap or another similar object.
> Did you look at the savedemo as I proposed in a previous mail?

Yes, if I try to PaintOnCanvas of a TBitmap, for example. I get "Canvas
does not allow drawing".

>
> > Simply said: you can't.
> > The current TAChart is not suitable for a CGI application. It expects a GUI.
>

I'm afraid Michael is right.

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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Michael Van Canneyt
In reply to this post by Alexander Klenin


On Mon, 21 Mar 2011, Alexander Klenin wrote:

> 2011/3/21 Michael Van Canneyt <[hidden email]>:
>>> Yes, but, how can I use a TCanvas in a CGI app?
>>>
>>> If I write:
>>>
>>> Chart.PaintOnCanvas(TCanvas(lCanvas), Rect(0, 0, 100, 100));
>>>
>>> I get an Access Violation.
>
> Of course, since you are converting an object to the type it does not belong to.
> You should create a TBitmap or another similar object.
> Did you look at the savedemo as I proposed in a previous mail?
>
>> Simply said: you can't.
>> The current TAChart is not suitable for a CGI application. It expects a GUI.
>
> Why do you think so?
> TAChart should be prefectly capable of rendering on bitmap-based canvas.

Because both TCanvas and TBitmap suppose a GUI. TFPCustomCanvas does not.

Yes, I know about the 'nogui' widgetset, and no, I don't think that's a
proper solution.

Michael.

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
In reply to this post by Leonardo M. Ramé
On Mon, Mar 21, 2011 at 04:44, Leonardo M. Ramé <[hidden email]> wrote:
>> Of course, since you are converting an object to the type it does not belong to.
>> You should create a TBitmap or another similar object.
>> Did you look at the savedemo as I proposed in a previous mail?
>
> Yes, if I try to PaintOnCanvas of a TBitmap, for example. I get "Canvas
> does not allow drawing".

That is very strange. I have created a nogui demo in r29942,
which does not have any gui, and creates a bitmap file with the chart.
Does it work for you?

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
In reply to this post by Michael Van Canneyt
On Mon, Mar 21, 2011 at 04:46, Michael Van Canneyt
<[hidden email]> wrote:
>> Why do you think so?
>> TAChart should be prefectly capable of rendering on bitmap-based canvas.
>
> Because both TCanvas and TBitmap suppose a GUI. TFPCustomCanvas does not.
>
> Yes, I know about the 'nogui' widgetset, and no, I don't think that's a
> proper solution.

Hm. For me GUI means "graphical user interface" -- that is, windows (aka forms),
interacting with mouse, etc.
I have just committed a demo which does not have any of this,
and yet successfully draws TChart to a file -- see previous mail.
Maybe for you GUI means a different thing?

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Leonardo M. Ramé
In reply to this post by Alexander Klenin
On 2011-03-21 04:54:45 +1000, Alexander Klenin wrote:

> On Mon, Mar 21, 2011 at 04:44, Leonardo M. Ramé <[hidden email]> wrote:
> >> Of course, since you are converting an object to the type it does not belong to.
> >> You should create a TBitmap or another similar object.
> >> Did you look at the savedemo as I proposed in a previous mail?
> >
> > Yes, if I try to PaintOnCanvas of a TBitmap, for example. I get "Canvas
> > does not allow drawing".
>
> That is very strange. I have created a nogui demo in r29942,
> which does not have any gui, and creates a bitmap file with the chart.
> Does it work for you?
>

It works when compiled with Gtk2 widgetset. If you set the nogui
widgetset you'll get the "Canvas does not allow drawing error".

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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
On Mon, Mar 21, 2011 at 05:14, Leonardo M. Ramé <[hidden email]> wrote:

> On 2011-03-21 04:54:45 +1000, Alexander Klenin wrote:
>> On Mon, Mar 21, 2011 at 04:44, Leonardo M. Ramé <[hidden email]> wrote:
>> >> Of course, since you are converting an object to the type it does not belong to.
>> >> You should create a TBitmap or another similar object.
>> >> Did you look at the savedemo as I proposed in a previous mail?
>> >
>> > Yes, if I try to PaintOnCanvas of a TBitmap, for example. I get "Canvas
>> > does not allow drawing".
>>
>> That is very strange. I have created a nogui demo in r29942,
>> which does not have any gui, and creates a bitmap file with the chart.
>> Does it work for you?
>>
>
> It works when compiled with Gtk2 widgetset. If you set the nogui
> widgetset you'll get the "Canvas does not allow drawing error".

That is true.
You have to link you CGI app with some graphic widgetset,
which will unfortunately bloat an executable, but should otherwise work.

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Leonardo M. Ramé
On 2011-03-21 05:27:49 +1000, Alexander Klenin wrote:

> On Mon, Mar 21, 2011 at 05:14, Leonardo M. Ramé <[hidden email]> wrote:
> > On 2011-03-21 04:54:45 +1000, Alexander Klenin wrote:
> >> On Mon, Mar 21, 2011 at 04:44, Leonardo M. Ramé <[hidden email]> wrote:
> >> >> Of course, since you are converting an object to the type it does not belong to.
> >> >> You should create a TBitmap or another similar object.
> >> >> Did you look at the savedemo as I proposed in a previous mail?
> >> >
> >> > Yes, if I try to PaintOnCanvas of a TBitmap, for example. I get "Canvas
> >> > does not allow drawing".
> >>
> >> That is very strange. I have created a nogui demo in r29942,
> >> which does not have any gui, and creates a bitmap file with the chart.
> >> Does it work for you?
> >>
> >
> > It works when compiled with Gtk2 widgetset. If you set the nogui
> > widgetset you'll get the "Canvas does not allow drawing error".
>
> That is true.
> You have to link you CGI app with some graphic widgetset,
> which will unfortunately bloat an executable, but should otherwise work.
>

Well, I tested that, but I get "Internal Server Error" from my Apache.

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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
On Mon, Mar 21, 2011 at 05:30, Leonardo M. Ramé <[hidden email]> wrote:
>> You have to link you CGI app with some graphic widgetset,
>> which will unfortunately bloat an executable, but should otherwise work.
>>
>
> Well, I tested that, but I get "Internal Server Error" from my Apache.

What does the log show?

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Leonardo M. Ramé
On 2011-03-21 05:39:01 +1000, Alexander Klenin wrote:
> On Mon, Mar 21, 2011 at 05:30, Leonardo M. Ramé <[hidden email]> wrote:
> >> You have to link you CGI app with some graphic widgetset,
> >> which will unfortunately bloat an executable, but should otherwise work.
> >>
> >
> > Well, I tested that, but I get "Internal Server Error" from my Apache.
>
> What does the log show?
>

[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




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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
On Mon, Mar 21, 2011 at 05:42, Leonardo M. Ramé <[hidden email]> 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).

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Leonardo M. Ramé
On 2011-03-21 06:00:20 +1000, Alexander Klenin wrote:

> On Mon, Mar 21, 2011 at 05:42, Leonardo M. Ramé <[hidden email]> 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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Henry Vermaak
In reply to this post by Leonardo M. Ramé
On 20 March 2011 19:42, Leonardo M. Ramé <[hidden email]> wrote:

> On 2011-03-21 05:39:01 +1000, Alexander Klenin wrote:
>> On Mon, Mar 21, 2011 at 05:30, Leonardo M. Ramé <[hidden email]> wrote:
>> >> You have to link you CGI app with some graphic widgetset,
>> >> which will unfortunately bloat an executable, but should otherwise work.
>> >>
>> >
>> > Well, I tested that, but I get "Internal Server Error" from my Apache.
>>
>> What does the log show?
>>
>
> [Sun Mar 20 16:30:09 2011] [error] [client ::1] (cgicharts:16246):
> Gtk-WARNING **: cannot open display:

Try using xvfb.  This uses a virtual framebuffer that doesn't need a
display.  I've had to use it with a webserver before.

Henry

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
In reply to this post by Leonardo M. Ramé
On Mon, Mar 21, 2011 at 06:14, Leonardo M. Ramé <[hidden email]> wrote:
> 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?

There are two problems here:
1) I suspect that the error you see is generated at the application
startup, not when TChart tries to paint something.
So to work around it, it is not enough to remove TCanvas in one place
-- EVERY instance of TCanvas should be removed
(so that Graphics unit is not used any more).
Unfortunately, this is poses a serious compatibility hazard.
2) Even is the previous is possible (I believe it is, although difficult --
TChart should be split into several classes in different units, with
only the descendants depending on Graphics),
TFPCanvas version it will still have serious limitations -- no TColor,
no font orientation, etc.

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Sven Barth
On 20.03.2011 21:21, Alexander Klenin wrote:

> On Mon, Mar 21, 2011 at 06:14, Leonardo M. Ramé<[hidden email]>  wrote:
>> 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?
>
> There are two problems here:
> 1) I suspect that the error you see is generated at the application
> startup, not when TChart tries to paint something.
> So to work around it, it is not enough to remove TCanvas in one place
> -- EVERY instance of TCanvas should be removed
> (so that Graphics unit is not used any more).
> Unfortunately, this is poses a serious compatibility hazard.
> 2) Even is the previous is possible (I believe it is, although difficult --
> TChart should be split into several classes in different units, with
> only the descendants depending on Graphics),
> TFPCanvas version it will still have serious limitations -- no TColor,
> no font orientation, etc.
>

Can it be that hard as TCanvas inherits from TFPCustomCanvas? (putting
point 2 aside)

Regards,
Sven

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Leonardo M. Ramé
In reply to this post by Henry Vermaak
On 2011-03-20 20:16:19 +0000, Henry Vermaak wrote:

> On 20 March 2011 19:42, Leonardo M. Ramé <[hidden email]> wrote:
> > On 2011-03-21 05:39:01 +1000, Alexander Klenin wrote:
> >> On Mon, Mar 21, 2011 at 05:30, Leonardo M. Ramé <[hidden email]> wrote:
> >> >> You have to link you CGI app with some graphic widgetset,
> >> >> which will unfortunately bloat an executable, but should otherwise work.
> >> >>
> >> >
> >> > Well, I tested that, but I get "Internal Server Error" from my Apache.
> >>
> >> What does the log show?
> >>
> >
> > [Sun Mar 20 16:30:09 2011] [error] [client ::1] (cgicharts:16246):
> > Gtk-WARNING **: cannot open display:
>
> Try using xvfb.  This uses a virtual framebuffer that doesn't need a
> display.  I've had to use it with a webserver before.
>
> Henry
>

Thanks Henry, it seems to almost work, at least I don't get the Cannot
Open Display error, but...

When I do this:

    lChart.Width := 100;
    lChart.Height := 100;
    with lChart.SaveToImage(TJPEGImage) do
    begin
      SaveToStream(AResponse.ContentStream);
      AResponse.ContentType := 'image/jpeg';
      AResponse.ContentLength := AResponse.ContentStream.Size;
      AResponse.SendContent;
    end;

I get a black square of 100 x 100 pixels.

If I try this:

    lChart.SaveToBitmapFile('test.bmp');

I get the error "Image palette is too big or absent" from my CGI.


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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
123