Take the 2-minute tour ×

I am using the Teechart component that comes with Delphi XE3. I need to have multiple graphs and then save them out to a jpg file. The user can select a keyword and that displays each graph.

What I need to do is for each keyword, draw the graph and then save it out to a file, without user interaction.

I have tried the event OnAfterDraw and then save the chart as an image and then call for another keyword. However this does not work because when you save the image it recalls the OnAfterDraw and I either end up an endless loop OR if I set the event to nil and then reset it back, it never gets called again.

Does anyone have any suggestions on how to do this please ?

Regards Anthoni

share|improve this question

2 Answers 2

You could try calling TChart.Draw(); the chart to force the chart being rendered before exporting so that you don't have the need to use the OnAfterDraw event.

share|improve this answer

OK, So I've found a way but it seems very kludgy to me.

Basically, I placed a Timer on the form and moved the teechart OnAfterDraw event to the private section. Then I build my keyword list and then start the timer.

The timer, first disables itself then adds the OnAfterDraw event to the TeeChart before calling a procedure to fill in the chart information.

Inside OnAfterDraw I save out the chart as an image, check if any more keywords are available and if so, reactivate the timer, otherwise fire my own event.

Like I said, this works but not sure of the overall ramifications of it. If anyone has any suggestions or comments on this method I would greatly aprpeciate it.

Regards Anthoni

share|improve this answer

Your Answer


