How To…Create a Chart in Code


“How do I create a TeeChart inside my report completely in code?”


Begin by creating a TppTeeChart object and adding it to the report.  Then leverage the TppTeeChart.Chart property to add Series objects to the chart.

The key to being successfull at creating charts in code is to include the proper TeeChart units in your uses clause.  A nice trick to determining the correct units to include is to create a similar chart in Delphi using the TChart component(s) on a form, then running your application.  This will automatically add any units needed to the uses clause and give you an idea which units need to be added for your own reporting application.


Sample Delphi code: