Hello!
My application has a feature to allow the users to save a group of graphs as BMP files. Prior to calling Chart.SaveToBitmapFile, the code must redraw the chart on the screen. This goes slowly and we would like to eliminate the need to draw each graph prior to saving as a BMP.
Is there any way to update the canvas (or whatever is appropriate within the Chart object) and then save to a BMP without redrawing the graph on the screen?
Thanks,
Erzsebet
Save charts as a bmp files without redrawing on screen?
-
- Newbie
- Posts: 5
- Joined: Fri Jul 22, 2011 12:00 am
Re: Save charts as a bmp files without redrawing on screen?
Hello Erzsebet,
Do you have a testing application where the behavior is reproduced?
Do you have a testing application where the behavior is reproduced?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 5
- Joined: Fri Jul 22, 2011 12:00 am
Re: Save charts as a bmp files without redrawing on screen?
Hello, Yeray -
No, I don't have an application where I'm doing this; I just wanted to know if it can be done. Right now our application goes through ever user selection and redraws the chart on the monitor before saving it to the BMP. This means that if the user has 100 selections, they have to sit and wait while 100 different charts are drawn on screen just for those charts to get sent to file. I was wondering if there was a way to go through the selections, update whatever TChart components need to be updated, and then send that information to file without having to redraw on the screen. Does that help clarify things any?
Thanks for thinking about my (sort of oddball!) question!
-erzsebet
No, I don't have an application where I'm doing this; I just wanted to know if it can be done. Right now our application goes through ever user selection and redraws the chart on the monitor before saving it to the BMP. This means that if the user has 100 selections, they have to sit and wait while 100 different charts are drawn on screen just for those charts to get sent to file. I was wondering if there was a way to go through the selections, update whatever TChart components need to be updated, and then send that information to file without having to redraw on the screen. Does that help clarify things any?
Thanks for thinking about my (sort of oddball!) question!
-erzsebet
Re: Save charts as a bmp files without redrawing on screen?
Hello Erzsebet,
But if you find any problem with it, please, don't hesitate to let us know.
We've heard worse, you can believe me!erzsebet_carmean wrote:Thanks for thinking about my (sort of oddball!) question!
Yes! Let me try to explain. First of all, TeeChart needs a parent to be drawn, and it needs to be drawn at least once to be exportable to an image. After it, if you don't modify the chart, the image generated internally should be reused everytime you export the chart.erzsebet_carmean wrote: Does that help clarify things any?
But if you find any problem with it, please, don't hesitate to let us know.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 5
- Joined: Fri Jul 22, 2011 12:00 am
Re: Save charts as a bmp files without redrawing on screen?
Yeray, hi!
Thanks for making me feel right at home here on the Steema forum & thanks, too, for the explanation of the TeeChart export to file mechanism.
-erzsebet
Thanks for making me feel right at home here on the Steema forum & thanks, too, for the explanation of the TeeChart export to file mechanism.
-erzsebet
Re: Save charts as a bmp files without redrawing on screen?
Hi Erzsebet,
You're welcome!
You're welcome!
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Save charts as a bmp files without redrawing on screen?
Well after some trial and error I understand that I first have to "actually see" the chart before I can successfully use SaveToBitmapFile.
The issue is that my application has different tabs. One of the tabs is the chart, another tab has a button with which I save, among other things, the chart to a file with SaveToBitmapFile. It works fine except when the chart is not "seen" before.
Apparently you have to draw the chart first. But I do not know how to do that. the aChart.draw(). Does not what I expect it should do. Do I have to add something to that command? What? Can you give a clear example?
Your help is appreciated.
The issue is that my application has different tabs. One of the tabs is the chart, another tab has a button with which I save, among other things, the chart to a file with SaveToBitmapFile. It works fine except when the chart is not "seen" before.
Apparently you have to draw the chart first. But I do not know how to do that. the aChart.draw(). Does not what I expect it should do. Do I have to add something to that command? What? Can you give a clear example?
Your help is appreciated.
Re: Save charts as a bmp files without redrawing on screen?
Hello,
With the current version the chart doesn't need a parent to be exported. This means you can export a chart that hasn't been seen. Ie, in a form with just a TButton you can do this:
With the current version the chart doesn't need a parent to be exported. This means you can export a chart that hasn't been seen. Ie, in a form with just a TButton you can do this:
Code: Select all
uses Chart, Series;
var Chart1: TChart;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1:=TChart.Create(Self);
Chart1.AddSeries(TBarSeries).FillSampleValues();
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Chart1.SaveToBitmapFile('E:\tmp\Chart_NoParent.bmp');
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |