[SOLVED] Changing FastReport Chart by code-script

edited June 2016 in FastReport VCL 5
I want to share my knowledge, hoping it is useful to anyone.

Working with FastReport, I implemented a Chart, that contains a simple FastLine serie, into the Report.
In the code-section of FastReport, I make some changes according to the Chart (called Chart1).
Changing colors:
// Changing the color of a serie:
TBarSeries(Chart1.Series[0]).SeriesColor := clRed;

// Changing the color of the axis' title:
TTeePen(Chart1.Chart.LeftAxis.Title.Font).Color := clRed;

// Changing the color of an axis:
TPen(Chart1.Chart.LeftAxis.Axis).Color := clRed;

Changing values:
// Changing the datasource of a serie:
Chart1.SeriesData[0].Source2 := '<Dataset1."Field1">';

// Changing the title of a serie (visible in the ledgend):
TBarSeries(Chart1.Series[0]).Title := 'My Series Title';

// Changing the title of an axis:
Chart1.Chart.LeftAxis.Title.Caption := 'Temperature / ?°C';

Best regards!

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.