0

如何在烛台系列中添加线系列?就像股票图表中的指标一样。当我添加它时,它只会划分图表。 烛台图

        var pm = new PlotModel{Title="Chart"};
        var timeSpanAxis1 = new DateTimeAxis { Position = AxisPosition.Bottom, StringFormat = "yyyyMMdd", MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot };
        pm.Axes.Add(timeSpanAxis1);
        var linearAxis1 = new LinearAxis { Position = AxisPosition.Left, MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot };
        pm.Axes.Add(linearAxis1);
        
        var lineseries = new LineSeries();

        for (int x = 0; x < obj.Count(); x++)
        {
            var close = Convert.ToDouble(obj[x].ClosePrice);
            lineseries.Points.Add(new DataPoint(close, close));
        }
               
        var candleStickSeries = new CandleStickSeries
        {
            Color = OxyColors.Black,
            IncreasingColor = OxyColors.DarkGreen,
            DecreasingColor = OxyColors.Red,
            DataFieldX = "QTime",
            DataFieldHigh = "H",
            DataFieldLow = "L",
            DataFieldOpen = "O",
            DataFieldClose = "C",
            TrackerFormatString = "High: {3:0.00}\nLow: {4:0.00}\nOpen: {5:0.00}\nClose: {6:0.00}\nAsOf:{2:yyyy-MM-dd}",
            ItemsSource = ls
        };

        pm.Series.Add(candleStickSeries);
        pm.Series.Add(lineseries);

提前致谢。

4

1 回答 1

0

感谢 VisualMelonlineseries.Points.Add(new DataPoint(DateTimeAxis.ToDouble(As_Of), close));

链接到 Github

于 2021-04-16T18:38:56.260 回答