當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。