0

我的图表的图像

我有一个用 DevExpress 的 cxGrid 制作的图表,在 X 轴上我有一个日期但是当图表中有很多数据时,这些日期被削减到只有 2 或 4 位数字

如何更改它以使 X 轴仅在每 5 或 10 个值处显示文本?

4

1 回答 1

0

您应该在应用程序中实现分页。您可以通过覆盖网格的 ChartView.DataController 的 OnDataChanged 和 OnFilterRecord 来做到这一点:

   aChartView.DataController.OnDataChanged  := cvChartDataControllerDataChanged;
   aChartView.DataController.OnFilterRecord := cvChartDataControllerFilterRecord;

关键是使用 OnFilterRecord 一次只显示有限数量的记录。这会让你的图表看起来很漂亮,否则你会得到太多的数据点。最重要的是 OnFilterRecord。这是一个例子:

procedure TSomeGrid.cvChartDataControllerFilterRecord(ADataController: TcxCustomDataController; ARecordIndex: Integer; var Accept: Boolean);
begin
// inspect the number of all records
   FNoOfRecords := ADataController.RecordCount;
//FStartRecordNo and FEndRecordNo are relative to the FCurrentPageNo
//calculated elsewhere OnDataChanged
   if FCurrentPageNo > 0 then
      Accept := (ARecordIndex >= FStartRecordNo) and (ARecordIndex <= FEndRecordNo)
   else
      Accept := ARecordIndex < FMaxChartRecords;
end;
于 2012-03-05T16:39:48.647 回答