zoukankan      html  css  js  c++  java
  • Visifire的一些使用心得

    1.如何让图表的Y轴不从0开始显示:有时一系列的数据差别很小,如果从0开始显示,在Y轴上,会一堆数据都堆在某一个区间。例如期货的蜡烛图。将ViewportRangeEnabled设为true即可解决此问题。代码:

                Axis axis = new Axis();
                axis.ViewportRangeEnabled = true;
                chart.AxesY.Add(axis);

    2.设置图表类型:使用RenderAs属性即可。下面的代码设置成蜡烛图:

                DataSeries dataSeries = new DataSeries();
                dataSeries.RenderAs = RenderAs.CandleStick;

                dataSeries.PriceDownColor = new SolidColorBrush(Colors.Green);
                dataSeries.PriceUpColor = new SolidColorBrush(Colors.Red);

                DataPoint dataPoint = new DataPoint();
                dataPoint.YValues = new Double[] { 10, 20, 25, 5 };

                // Add DataPoint to DataSeries
                dataSeries.DataPoints.Add(dataPoint);

                // Add DataSeries to Chart
                chart.Series.Add(dataSeries);
                // Add chart to the LayoutRoot for display
                LayoutRoot.Children.Add(chart);

    3.实时更新:由于数据绑定了,只需要更新数据源即可:

                    WHDay day = new WHDay();
                    DataPoint dataPoint = new DataPoint();
                    day = (WHDay)_kList[_nIndex];
                    dataPoint.YValues = new Double[] { day.Close, day.Open, day.High, day.Low };
                    chart.Series[0].DataPoints.Add(dataPoint);

    目前还有两个问题没解决:

    1.蜡烛图的颜色:虽然设置了PriceDownColor、PriceUpColor的颜色,可上影线和下影线的颜色并未随着改变,非常奇怪,不知道是不是Visifire本身的Bug。

    2.每次数据出来时,都是显示在中央。例如我只显示一根K线,它也显示在中央。我希望的效果是显示在最左边,然后K线数量每次增加一根,从左向右排列。

  • 相关阅读:
    编写C#程序的IDE
    MacBook Pro装Win7后喇叭没有声音
    MacBook Pro装Win7后喇叭没有声音
    MacBook Pro装Win7后喇叭没有声音
    MacBook Pro装Win7后喇叭没有声音
    Linux从入门到精通系列之NFS
    Linux从入门到精通系列之NFS
    Linux从入门到精通系列之NFS
    Docker之docker设置系统的环境变量
    mq put 消息到远程队列
  • 原文地址:https://www.cnblogs.com/dancetime/p/3246261.html
Copyright © 2011-2022 走看看