OxyPlot图表起点的换行点

问题描述 投票:0回答:1

我有一个程序,该程序从access(.mbd)数据库接收一个日期戳和一个值,并将它们保存到两个列表(分别为dates和dataPoints)。当我将OxyPlot图表与DateTimeAxis一起使用以绘制点时,它会在某些时间相同但日期不同的点上加倍。有没有办法使OxyPlot也考虑日期?

public void CreatePlot(List<float> dataPoints, List<DateTime> dates, DateTime fromDate, DateTime toDate, string craneName)
    {
        PlotView plotView = new PlotView();
        this.Controls.Add(plotView);

        PlotModel plotModel = new PlotModel();
        DateTimeAxis xAxis = new DateTimeAxis();
        xAxis.Position = AxisPosition.Bottom;
        //xAxis.Minimum = DateTimeAxis.ToDouble(fromDate);
        //xAxis.Maximum = DateTimeAxis.ToDouble(toDate);
        //Console.WriteLine(xAxis.Minimum.ToString());
        //Console.WriteLine(xAxis.Maximum.ToString());
        plotModel.Axes.Add(xAxis);
        LinearAxis yAxis = new LinearAxis();
        plotModel.Axes.Add(yAxis);
        LineSeries lineSeries = new LineSeries();
        for (int i = 0; i < dataPoints.Count; i++)
        {
            lineSeries.Points.Add(new OxyPlot.DataPoint(DateTimeAxis.ToDouble(dates[i]), dataPoints[i]));
            LogFileHandling.LogWrite(dates[i].ToString() + dataPoints[i].ToString());
        }
        plotModel.Series.Add(lineSeries);
        plotView.Model = plotModel;
    }

Exported chart

c# winforms charts oxyplot
1个回答
1
投票

[没关系,是来自数据库的数据才引起了问题。执行压缩并对其进行修复将其固定。

© www.soinside.com 2019 - 2024. All rights reserved.