以时间为X轴绘制TChart [英] Plotting a TChart with time as the X-axis
本文介绍了以时间为X轴绘制TChart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一系列3600个值,每个小时一个小时。我想在Delphi 7中使用TChart将它们绘制为单个系列。
I have a series of 3,600 values, one every second for an hour. I want to chart them as a single series, using TChart in Delphi 7.
这些值应在Y轴上绘制。我应该将X值传递给AddXY()吗?点数?
The values should be plotted on the Y-axis. What should I pass to AddXY() as the X-axis value? The count of points?
我想将X轴标记为MM:SS,该怎么做?除此之外,我还需要什么? ...
I want to label the X-axis as MM:SS, how do I do that? What do I need beyond this? ...
Chart1.Series[0].XValues.DateTime := True;
Chart1.BottomAxis.DateTimeFormat := 'nn:ss';
我被这个卡住了一段时间。谁能张贴一些示例代码?谢谢
I have been stuck for a while with this one. Can anyone post some sample code? Thanks
推荐答案
如果我没记错的话,这就是你想要的
If I am not wrong, this is what you want
Series1.AddXY(<Pass the data value>, <Pass Your value>, '', clRed);
Series1.AddXY(now, 1, '', clRed);
Series1.AddXY(now + ( 1 /(24*60*60)), 2, '', clRed); //After 1 seconds
Series1.AddXY(now + ( 2 /(24*60*60)), 3, '', clRed); //After 2 seconds
这篇关于以时间为X轴绘制TChart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文