示例#1
0
        public static PlotModel MinuteData_DateTimeAxis()
        {
            var pm = new PlotModel {
                Title = "Minute Data (DateTimeAxis)"
            };

            var timeSpanAxis1 = new DateTimeAxis {
                Position = AxisPosition.Bottom, StringFormat = "hh:mm"
            };

            pm.Axes.Add(timeSpanAxis1);
            var linearAxis1 = new LinearAxis {
                Position = AxisPosition.Left
            };

            pm.Axes.Add(linearAxis1);
            var candleStickSeries = new OldCandleStickSeries
            {
                CandleWidth         = 6,
                Color               = OxyColors.Black,
                IncreasingFill      = OxyColors.DarkGreen,
                DecreasingFill      = OxyColors.Red,
                DataFieldX          = "Time",
                DataFieldHigh       = "H",
                DataFieldLow        = "L",
                DataFieldOpen       = "O",
                DataFieldClose      = "C",
                TrackerFormatString = "High: {2:0.00}\nLow: {3:0.00}\nOpen: {4:0.00}\nClose: {5:0.00}",
                ItemsSource         = lst
            };

            pm.Series.Add(candleStickSeries);
            return(pm);
        }
示例#2
0
        public static PlotModel CandleStickSeries()
        {
            var model = new PlotModel {
                Title = "CandleStickSeries", LegendSymbolLength = 24
            };
            var s1 = new OldCandleStickSeries
            {
                Title = "CandleStickSeries 1",
                Color = OxyColors.Black,
            };
            var r     = new Random(314);
            var price = 100.0;

            for (int x = 0; x < 16; x++)
            {
                price = price + r.NextDouble() + 0.1;
                var high  = price + 10 + (r.NextDouble() * 10);
                var low   = price - (10 + (r.NextDouble() * 10));
                var open  = low + (r.NextDouble() * (high - low));
                var close = low + (r.NextDouble() * (high - low));
                s1.Items.Add(new HighLowItem(x, high, low, open, close));
            }

            model.Series.Add(s1);
            model.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, MaximumPadding = 0.3, MinimumPadding = 0.3
            });
            model.Axes.Add(new LinearAxis {
                Position = AxisPosition.Bottom, MaximumPadding = 0.03, MinimumPadding = 0.03
            });

            return(model);
        }