Beispiel #1
0
        public PlotModel CandleStickSeries(TrendbarJson[] data)
        {
            var model = new PlotModel {
                Title = "CandleStickSeries",
                LegendSymbolLength = 24,
            };
            var s1 = new OxyPlot.Series.CandleStickSeries {
                Title = currentSymbol.SymbolName,
                Color = OxyColors.Black,
            };

            foreach (TrendbarJson item in data)
            {
                s1.Items.Add(new HighLowItem(item.Timestamp, item.High, item.Low, item.Open, item.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
            });

            var arrowAnnotation = new LineAnnotation {
                Type = LineAnnotationType.Horizontal,
                Y    = data[data.Length - 1].Close,
                Text = data[data.Length - 1].Close.ToString()
            };

            model.Annotations.Add(arrowAnnotation);
            return(model);
        }
		public PlotModel CandleStickSeries (TrendbarJson[] data)
		{
			var model = new PlotModel { 
				Title = "CandleStickSeries",
				LegendSymbolLength = 24,
			};
			var s1 = new OxyPlot.Series.CandleStickSeries {
				Title = currentSymbol.SymbolName,
				Color = OxyColors.Black,
			};
			foreach (TrendbarJson item in data) {
				s1.Items.Add (new HighLowItem (item.Timestamp, item.High, item.Low, item.Open, item.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 });

			var arrowAnnotation = new LineAnnotation {
				Type = LineAnnotationType.Horizontal,
				Y = data[data.Length - 1].Close,
				Text = data[data.Length - 1].Close.ToString()
			};
			model.Annotations.Add(arrowAnnotation);
			return model;
		}