我正在使用Fast Reports 4.13.1。我需要在彙總樂隊上顯示多個圖表,並且我試圖在樂隊的OnBeforePrint
事件處理程序中動態創建它們。問題是,當圖表正確創建時,系列不顯示我添加到它們的數據。這是我的OnBeforePrint
事件:如何在代碼中創建TfrxChartView?
var
dsSections,
dsTests,
dsHistory: TfrxDataSet;
Chart: TfrxChartView;
ChartCount: Integer;
begin
dsSections := Report.GetDataSet('frdTestSections');
dsTests := Report.GetDataSet('frdResults');
dsHistory := Report.GetDataSet('frdTestHistory');
ChartCount := 0;
dsSections.First;
while not dsSections.Eof do
begin
dsTests.First;
while not dsTests.Eof do
begin
if dsHistory.RecordCount > 0 then
begin
Chart := TfrxChartView.Create(rsHistory);
Chart.Left := (ChartCount mod 2) * 8 + 1;
Chart.Top := (ChartCount div 2) * 5 + 0.5;
Chart.Width := 8;
Chart.Height := 5;
Chart.Chart.Title.Text.Text := dsTests.Value('Name');
Chart.Chart.View3D := False;
Chart.AddSeries(csLine);
dsHistory.First;
while not dsHistory.Eof do
begin
ShowMessage(dsTests.Value('Name') + #13#10 + IntToStr(dsHistory.RecNo + 1) + ' ' +dsHistory.Value('Result')); // this is for debugging only
Chart.Series[0].Add(dsHistory.Value('Result'), IntToStr(dsHistory.RecNo + 1), clBlue);
dsHistory.Next;
end;
Inc(ChartCount);
end;
dsTests.Next;
end;
dsSections.Next;
end;
end;
我在想什麼?有沒有TfrxChartView
的任何屬性我應該設置我正在省略?