如何设置最小值和最大值为烛台系列的TeeChart底轴? [英] How do I set min and max for bottom axis for candlestick series in TeeChart?

查看:1333
本文介绍了如何设置最小值和最大值为烛台系列的TeeChart底轴?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示烛台系列的TeeChart库。

I'm trying to display a candlestick series with TeeChart library.

Everyting是罚款只是我无法控制显示的数据的范围。现在的问题是,当我的新数据添加到我的系列,我想我的滚动轴下方显示上次的 N 的值。例如。当我添加一个新的蜡烛,我想scrol +1指数显示此栏。

Everyting is fine except I can't control the range of data displayed. The question is when I add new data to my series, I want to scroll my bottom axis to display the last N values. E.g. when I add a new candle, I want to scrol +1 index to display this bar.

我发现,轴类有2个方法实现此目的:

I found that Axis class has 2 methods for doing this:

axis.setMinMax(DateTime arg0, DateTime arg1)
axis.setMinMax(double arg0, double arg1)

这与蜡烛一起使用正确的方法?我想,这是第一次重载需要2日期时间参数,可以,但我添加值蜡烛系列没有一个具体的日期:

Which is the right method to use in conjunction with Candles? I guess that this is the 1st overload that takes 2 DateTime params, but I'm adding values to the Candle series without a specific date:

Candle series = ...
...
series.add(bar.getOpen(), bar.getHigh(), bar.getLow(), bar.getClose());

让所有的点有一个默认的日期。

so all of the points have a default date.

我也试过用 axis.setMinMax(双为arg0,ARG1双)指定的的startIndex 的和的 endIndex的的我想显示,但它似乎并不奏效...

Also I tried to use axis.setMinMax(double arg0, double arg1) specifying startIndex and endIndex I wanted to display, but it doesn't seem to be working...

是否有可能与蜡烛控制范围,我的情况不指定每个系列的值的DateTime值?

Is it possible to control range in my case with candles without specifying a DateTime value for each series' value?

推荐答案

如果您知道的的startIndex 的和的 endIndex的的,你可以这样做:

If you know the startIndex and endIndex, you could do this:

axis.setMinMax(series.getXValues().getValue(startIndex), series.getXValues().getValue(endIndex));

另一种选择,如果知道偏移应用到轴,将调用轴滚动的方法,即:

Another alternative, if you know the offset to apply to the axis, would be calling the axis scroll method, ie:

int myOffset = 1;
axis.scroll(myOffset, true);

和另一种选择,如果你知道值的数量来显示:

And another alternative, if you know the number of values to display:

int nValuesToShow = 10;
axis.setMinMax(series.getXValues().getValue(series.getCount()-nValuesToShow-1), series.getXValues().getValue(series.getCount()-1);

最后注意,添加()覆盖无日期(不XValue)是加入与getCount将()作为XValue你的价值。

Finally note the Add() override without date (without XValue) is adding your value with getCount() as XValue.

这篇关于如何设置最小值和最大值为烛台系列的TeeChart底轴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆