Page 1 of 1

gdi+ with webbroker?

Posted: Tue Apr 24, 2012 10:50 pm
by 16461466
Hi,

We use tchart to create graphs, save them to jpegs or pings, and stream them down to a web browser. It works well. However, we would like to use the new tTeegdiplus component to anti-alias and streamline the charts.

We have tried creating a teegdiplus at runtime and assigning its teechart property, e.g.,
gdiCanvas := tTeeGDIPlus.create(nil);
gdiCanvas.TeePanel := mynewchart;

However when we set the gdicanvas.active property to true we get a "no parent window control message".

We also tried creating a form at runtime, then assigning the teechart and the TeeGDIPlus component to it (e.g., gdiCanvas := tTeeGDIPlus.create(mynewform)) but still get the same error message.

Any help would be appreciated.

Thanks.

Re: gdi+ with webbroker?

Posted: Fri Apr 27, 2012 8:16 am
by yeray
Hi Charlie,

I haven't tried it with WebBroker, but creating a simple chart with GDIPlus and exporting it to jpg/png seems to work fine for me here.

Code: Select all

uses Chart, TeeGDIPlus, Series, TeeJPEG, TeePNG;

procedure TForm1.FormCreate(Sender: TObject);
var mynewchart: TChart;
    gdiCanvas: tTeeGDIPlus;
begin
  mynewchart:=TChart.Create(nil);
  mynewchart.Parent:=Self;

  gdiCanvas := tTeeGDIPlus.create(nil);
  gdiCanvas.TeePanel:=mynewchart;
  gdiCanvas.Active:=true;

  mynewchart.AddSeries(TBarSeries).FillSampleValues;

  TeeSaveToJPEG(mynewchart, 'C:\tmp\mynewchart.jpg', mynewchart.Width, mynewchart.Height);
  TeeSaveToPNG(mynewchart, 'C:\tmp\mynewchart.png');
end;
mynewchart.png
mynewchart.png (11.62 KiB) Viewed 2574 times
mynewchart.jpg
mynewchart.jpg (52.9 KiB) Viewed 2582 times