how to set the series data in a chart?
Following instructions in user guide pg 149 I have form with a TfrxDBDataSet, TfrxChart and TfrxReport components on it. (the TfrxDBDataSet is linked to a database) and following pages 150- 152 I manually set, under 'Values', the properties 'Label' and 'Y' to point to fields in my dataset (in my case frxDBDataset1."BetweenPeople" and frxDBDataset1."AvgReplyTimeHours" respectively.
This sucessfully created a bar chart. - Great!!!
Now I want about 9 similar reports with the only change being the field selected for the 'Y' value.
I could just make another 8 almost identical forms but would prefer to use one report and set the 'Y' property of the chart by code in the same way that I use script variables to set other things the report like title etc.
(I tried the advice from user guide page 155 but cannot see how to reference the 'Y' property of the chart.)
My form is called TFrm_ReplyTimeCharts and contains
frxDBDataset1 : TfrxDBDataset;
frxReportReplyTimes : TfrxReport;
frxChartObject1 : TfrxChartObject;
The bit of the code that shows the report is
Frm_ReplyTimeCharts.frxReportReplyTimes.Script.Variables := The_Title;
Frm_ReplyTimeCharts.frxReportReplyTimes.Script.Variables := The_Sub_Title;
//---> need to insert code to set Y value of series here
Frm_ReplyTimeCharts.frxReportReplyTimes.ShowReport(true);
So before the 'ShowReport line I want to say something like
Frm_ReplyTimeCharts.frxReportReplyTimes.frxChartObject1.SeriesData[0].Y := frxDBDataset1."Inital_Reply_Time";
but I get an 'erronous type' error on frxChartObject1.
What is the correct syntax for these lines?
Howard
This sucessfully created a bar chart. - Great!!!
Now I want about 9 similar reports with the only change being the field selected for the 'Y' value.
I could just make another 8 almost identical forms but would prefer to use one report and set the 'Y' property of the chart by code in the same way that I use script variables to set other things the report like title etc.
(I tried the advice from user guide page 155 but cannot see how to reference the 'Y' property of the chart.)
My form is called TFrm_ReplyTimeCharts and contains
frxDBDataset1 : TfrxDBDataset;
frxReportReplyTimes : TfrxReport;
frxChartObject1 : TfrxChartObject;
The bit of the code that shows the report is
Frm_ReplyTimeCharts.frxReportReplyTimes.Script.Variables := The_Title;
Frm_ReplyTimeCharts.frxReportReplyTimes.Script.Variables := The_Sub_Title;
//---> need to insert code to set Y value of series here
Frm_ReplyTimeCharts.frxReportReplyTimes.ShowReport(true);
So before the 'ShowReport line I want to say something like
Frm_ReplyTimeCharts.frxReportReplyTimes.frxChartObject1.SeriesData[0].Y := frxDBDataset1."Inital_Reply_Time";
but I get an 'erronous type' error on frxChartObject1.
What is the correct syntax for these lines?
Howard
Comments
TfrxChartView(frxReport1.FindObject('Chart1')).SeriesData.Items[0].YSource := 'frxDBDataset1."field1"';
Now that I can see the principle, ie find the object, cast it as a chart and then use the same chart properties that can be seen in the editor, it opens up loads of possibilities for fine tuning other bits of the chart through code as well.
Most grateful.
Howard