Delphi Tchart左轴时间标签

时间:2018-07-14 10:42:59

标签: delphi teechart

我想使用TChart评估时间。 (例如1:12; 1:15; 1:13; ...)为此,我想在X轴上显示实验(1,2,3 ...)。 Y轴应该是时间图例。 (如在X轴上的照片所示)。 不幸的是,我只在X轴上成功。

我希望在Y轴上显示时间传奇

The time legend I wish on the Y-axis

我尝试过的事情:

procedure kMyDiagram.config;
Begin
    mychart.LeftAxis.LabelStyle := taltext;
    DataLine:=TLineSeries(MyChart.Series[0]);
end;

procedure kMyDiagram.myDiagramMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer)
begin
    timecounter:=timecounter +10;
    time:=strtotime('00:0'+ timecounter);
    DataLine.AddXY(DataLine.XScreenToValue(x),DataLine.YScreenToValue(y),timetostr(time));
end;

这会创建类似的内容... Time Labels at Y-Axis but also at X-Axis(and there should be integers like 1,2,3...)

Y轴和X轴的时间标签(应该有1,2,3 ...等整数)

那我怎么做这个自定义的Y轴呢?

预先感谢您的回答。

1 个答案:

答案 0 :(得分:1)

我用TChart创建了一个新的TLineSeries,并进行了唯一的设置:Series1-General-Vertical Axis-DateTime复选框。

下面的代码现在生成在X轴上带有0..7标签并且在Y轴上带有0:00, 0:30...7:00标签的图表(1/24是一小时)

var
  i: integer;
begin
  for i := 0 to 7 do
    Series1.AddXY(i, (i * i) / 7 * 1/24);
相关问题