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线数量每次增加一根,从左向右排列。

  • 相关阅读:
    XenServer 7 上Linux单用户模式下修改密码
    python pysnmp使用
    处理一则MySQL Slave环境出现ERROR 1201 (HY000): Could not initialize master info structure的案例。
    H3C交换机端口聚合
    H3C交换机密码策略
    使用Chrome远程调试GenyMotion上的WebView程序
    CefGlue在WinXP下闪退的排查方法
    Visual Studio 2015 开发Android Cordova出现unsupported major minor version 52.0错误的解决方法
    股票涨跌预测器
    javascript模块化编程-详解立即执行函数表达式IIFE
  • 原文地址:https://www.cnblogs.com/dancetime/p/3246261.html
Copyright © 2011-2022 走看看