【问题标题】:Custom datetime step on teechartteechart上的自定义日期时间步骤
【发布时间】:2015-05-19 11:36:15
【问题描述】:

我正在制作一个软件,我在 teechart 图表上绘制从电路测量的样本。

用户需要能够在屏幕上选择样本的时间窗口。例如,图表在屏幕上有 10 个固定的分区,每个分区可以代表一个 0,5s、1s、2s 或 5s 的窗口。

问题在于 teechart 只有固定的日期时间增量,例如 1 秒或 5 秒。我需要做的是能够在 teechart 的日期时间底轴上选择自定义增量。

我正在使用此代码设置底部轴增量:

Form1.Osc.BottomAxis.Increment := DateTimeStep[dtonesecond];

【问题讨论】:

    标签: delphi teechart


    【解决方案1】:

    Increment 属性是TDateTime 类型,它被声明为Double。 因此,只需使用普通数学来设置自定义增量。

    示例如何设置不同的增量:

    Form1.Osc.BottomAxis.Increment := 0.5*DateTimeStep[dtonesecond];  // 0.5 sec
    Form1.Osc.BottomAxis.Increment := DateTimeStep[dtonesecond];      // 1 sec
    Form1.Osc.BottomAxis.Increment := 2*DateTimeStep[dtonesecond];    // 2 sec
    Form1.Osc.BottomAxis.Increment := 5*DateTimeStep[dtonesecond];    // 5 sec
    

    Form1.Osc.BottomAxis.Increment := 0.5*(1.0/SecsPerDay);  // 0.5 sec
    Form1.Osc.BottomAxis.Increment := 1.0/SecsPerDay;        // 1 sec
    Form1.Osc.BottomAxis.Increment := 2.0/SecsPerDay;        // 2 sec
    Form1.Osc.BottomAxis.Increment := 5.0/SecsPerDay;        // 5 sec
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多