3

Fast Reports 4.13.1 を使用しています。OnBeforePrintサマリー バンドに多数のグラフを表示する必要があり、バンドのイベント ハンドラでそれらを動的に作成しようとしています。問題は、グラフが正しく作成されているにもかかわらず、シリーズに追加したデータが表示されないことです。これが私のOnBeforePrintイベントです:

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私が省略していることを設定する必要があるプロパティはありますか?

4

2 に答える 2

2

Chart.Series[0].Addの代わりに、SeriesData の XValues と YValues を使用できます。

//.....
  while not dsHistory.Eof do
  begin
    Chart.SeriesData[0].XValues := Chart.SeriesData[0].XValues + IntToStr(dsHistory.RecNo + 1) + ';';
    Chart.SeriesData[0].YValues := Chart.SeriesData[0].YValues + FloatToStr(dsHistory.Value('Result')) + ';';
    dsHistory.Next;
  end;

//.....
于 2013-09-25T15:56:18.460 に答える