当前位置: 首页>>代码示例>>C#>>正文


C# GraphPane.AddOHLCBar方法代码示例

本文整理汇总了C#中ZedGraph.GraphPane.AddOHLCBar方法的典型用法代码示例。如果您正苦于以下问题:C# GraphPane.AddOHLCBar方法的具体用法?C# GraphPane.AddOHLCBar怎么用?C# GraphPane.AddOHLCBar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZedGraph.GraphPane的用法示例。


在下文中一共展示了GraphPane.AddOHLCBar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetBarWidth_NonOrdinalAxisIntradayValues_2Pixels

        public void GetBarWidth_NonOrdinalAxisIntradayValues_2Pixels()
        {
            GraphPane myPane = new GraphPane();
            myPane.Rect = new RectangleF(0, 0, 640f, 480f);
            myPane.XAxis.Type = AxisType.Date;

            StockPointList spl = CreateStockPointList(5);

            OHLCBarItem myCurve = myPane.AddOHLCBar("trades", spl, Color.Black);

            AxisChangeAndDraw(myPane);

            Assert.That(myCurve.Bar.GetBarWidth(myPane, myPane.XAxis, 1.0f), Is.EqualTo(2f));
        }
开发者ID:Jungwon,项目名称:ZedGraph,代码行数:14,代码来源:OHLCBarItemTests.cs

示例2: DrawOHLCGraph

        /// <summary>
        /// Draws the Open High Low Close graph.
        /// </summary>
        /// <param name="data">The stock points to plot.</param>
        /// <param name="control">The control to plot on.</param>
        public void DrawOHLCGraph(ref StockPoints data, ref ZedGraph.ZedGraphControl control)
        {
            StockPointList pointList = new StockPointList();
            XDate date = new XDate();
            foreach (StockPoint s in data)
            {
                date = new XDate(s.PointDateTime.Year, s.PointDateTime.Month, s.PointDateTime.Day, s.PointDateTime.Hour, s.PointDateTime.Minute, 0);
                StockPt p = new StockPt(date.XLDate, s.High, s.Low, s.Open, s.Close, s.Volume);
                pointList.Add(p);
            }

            Color[] colors = { Color.Red, Color.Black };
            Fill myFill = new Fill(colors);
            myFill.Type = FillType.GradientByColorValue;
            myFill.SecondaryValueGradientColor = Color.Empty;
            myFill.RangeMin = 1;
            myFill.RangeMax = 2;

            MasterPane masterPane = control.MasterPane;
            masterPane.Margin.All = 10;
            masterPane.InnerPaneGap = 5;

            GraphPane ohlcPane = new GraphPane(new Rectangle(10, 10, 10, 10), "OHLC", "Time", "Price");

            ohlcPane.IsBoundedRanges = true;

            OHLCBarItem bar = ohlcPane.AddOHLCBar("Price", pointList, Color.Empty);
            bar.Bar.GradientFill = myFill;
            bar.Bar.IsAutoSize = true;
            bar.Bar.Size = 5;

            ohlcPane.Title.Text = "OHLC Graph";
            ohlcPane.XAxis.Type = AxisType.DateAsOrdinal;
            ohlcPane.XAxis.Title.Text = "Date";
            ohlcPane.YAxis.Title.Text = "Price";
            ohlcPane.Margin.All = 0;
            ohlcPane.Margin.Top = 10;
            ohlcPane.YAxis.MinSpace = 10;
            ohlcPane.Y2Axis.MinSpace = 10;
            ohlcPane.AxisChange();

            masterPane.Add(ohlcPane);

            control.IsShowHScrollBar = true;
            control.ScrollMinX = 0;
            control.ScrollMaxX = data.Count;
            control.GraphPane.XAxis.Scale.Max = data.Count;
            if (data.Count >= 99)
            {
                control.GraphPane.XAxis.Scale.Min = data.Count - 99;
            }
            else
            {
                control.GraphPane.XAxis.Scale.Min = 0;
            }

            using (Graphics g = control.CreateGraphics())
            {
                masterPane.SetLayout(g, PaneLayout.SingleColumn);
                masterPane.AxisChange(g);

                // Synchronize the Axes
                //// g.Dispose();
            }
        }
开发者ID:Kushagratrivedi,项目名称:GitHub,代码行数:70,代码来源:OHLCGraph.cs


注:本文中的ZedGraph.GraphPane.AddOHLCBar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。