简体   繁体   English

C ++ Builder中图表中的固定步骤

[英]Fixed Step in Chart in C++ Builder

There is a TChart component in C++ Builde with one serie. C ++ Builde中有一个带有一个序列的TChart组件。

I add the data using AddXY method but I want the Y-Axis to have fixed minimum and maximum values and fixed step. 我使用AddXY方法添加数据,但我希望Y轴具有固定的最小值和最大值以及固定的步长。 I've managed to understand how the first two things are done. 我已经设法了解了前两件事是如何完成的。

So my question is: How can I define a fixed step for the Y-Axis in TChart component. 所以我的问题是:如何在TChart组件中为Y轴定义固定步骤。

Important: I've tried using Increment property but it gives me distance from the origin and that's not what I want. 重要说明:我已经尝试使用Increment属性,但是它使我与原点之间有距离,这不是我想要的。

Chart1->LeftAxis->Automatic = false;
Chart1->LeftAxis->Minimum = M - 2 * S;
Chart1->LeftAxis->Maximum = M + 2 * S;
Chart1->LeftAxis->Increment = S;    

Update : I'll try to explain more clearly what I want to be. 更新 :我将尝试更清楚地解释我想要成为的人。 After I defined the minimum and maximum for the chart, I want to make a fixed step for this. 在定义图表的最小值和最大值之后,我要为此确定一个固定步骤。 The code I posted above doesn't work properly because I need a fixed step beginning from Minimum value and not from zero value as the code in question does. 我上面发布的代码无法正常工作, 因为我需要一个固定的步骤,即从最小值开始而不是从值开始,就像所讨论的代码一样。

I've found the answer to my question. 我找到了我问题的答案。 I appreciate that you were helping me. 感谢您在帮助我。 Thank you. 谢谢。

I just needed to change the Items propery of the axis. 我只需要更改轴的Items属性。

Instead of Increment one should use 代替增量,应该使用

Chart1->LeftAxis->Items->Clear();
Chart1->LeftAxis->Items->Add(double Value);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM