TeeChart TLineSeries - 是否可以为每个系列绘制多条线?

发布于 2024-12-29 06:40:24 字数 106 浏览 3 评论 0原文

是否可以使用 TeeChart 用单个 TLineSeries 绘制多条线?我想在数据集中指定系列应分组的字段,每组绘制一条线。或者这是不可能的,并且应该为应该显示的每个组/线添加一个系列到图表中?

Is it possible to draw multiple lines with a single TLineSeries using TeeChart? I would like to specify a field in the dataset that the series should group by, drawing one line per group. Or is this not possible and a series should be added to the chart for each group/line that should be displayed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱给你人给你 2025-01-05 06:40:24

您可以将 XValues.Order 设置为 loNone 并在每次想要开始新行时添加一个空点来实现它。但是,为了加快绘图和点处理速度,TFastLineSeries 对所有点使用相同的颜色 (SeriesColor)。如果您想对各个点使用不同的颜色,您应该使用 TLineSeries。

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i, j: Integer;
begin
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  with Chart1.AddSeries(TFastLineSeries) as TFastLineSeries do
  begin
    XValues.Order:=loNone;
    TreatNulls:=tnDontPaint;
    for i:=0 to 4 do
    begin
      if i>0 then AddNullXY(0,0);  //start a new line

      AddXY(0,Random*1000);
      for j:=1 to 24 do
        AddXY(j, Chart1[0].YValue[Chart1[0].Count-1] + random*10 - 5);
    end;
  end;
end;

无论如何,我不明白为什么有人愿意执行上述操作而不是创建多个 TFastLine 系列。

--

谨致问候,

Yeray Alonso

Steema 支持中心

You could achieve it setting XValues.Order to loNone and adding a null point each time you want to start a new line. However, to speed up drawing and point handling TFastLineSeries uses the same color (SeriesColor) for all points. If you want to use diferent colors for individual points you should use the TLineSeries instead.

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i, j: Integer;
begin
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  with Chart1.AddSeries(TFastLineSeries) as TFastLineSeries do
  begin
    XValues.Order:=loNone;
    TreatNulls:=tnDontPaint;
    for i:=0 to 4 do
    begin
      if i>0 then AddNullXY(0,0);  //start a new line

      AddXY(0,Random*1000);
      for j:=1 to 24 do
        AddXY(j, Chart1[0].YValue[Chart1[0].Count-1] + random*10 - 5);
    end;
  end;
end;

Anyway, I don't see why one would like to do the above instead of creating several TFastLine series.

--

Best Regards,

Yeray Alonso

Steema Support Central

坐在坟头思考人生 2025-01-05 06:40:24

您还可以尝试使用 DBCrosstabSource 组件,该组件连接到任何数据集并使用“组”和“标签”字段以及公式(总和或计数值)自动从数据库数据创建系列。您可以在“所有功能”->“所有功能”中找到示例。欢迎! ->数据库图表 ->新功能演示中的 DB Crosstab 源代码部分可在此处获取。

You could also try using the DBCrosstabSource component which connects to any dataset and automatically creates series from database data, using Group and Label fields and formula (sum or count values). You'll find examples at the All Features -> Welcome! -> Database Charts -> DB Crosstab source section in the new features demo available here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文