Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用Zedgraph时线处于混乱状态_C#_Zedgraph - Fatal编程技术网

C# 使用Zedgraph时线处于混乱状态

C# 使用Zedgraph时线处于混乱状态,c#,zedgraph,C#,Zedgraph,我在zedgraph窗格中画了一条线,但有时会是这样: 虽然它应该是: 我从我的代码中找不到任何错误,任何人都知道如何解决这个问题,非常感谢 以下是我的部分代码: MasterPane master = zdg_stock.MasterPane; var stockValueList = new PointPairList(); for (int i = 0; i < _dtUserStockHistory.Rows.Count; i++

我在zedgraph窗格中画了一条线,但有时会是这样:

虽然它应该是:

我从我的代码中找不到任何错误,任何人都知道如何解决这个问题,非常感谢

以下是我的部分代码:

        MasterPane master = zdg_stock.MasterPane;
        var stockValueList = new PointPairList();
        for (int i = 0; i < _dtUserStockHistory.Rows.Count; i++)
        {
            XDate time = XDate.DateTimeToXLDate((DateTime)_dtUserStockHistory.Rows[i]["ush_time"]);
            stockValueList.Add(
                time,
                double.Parse(_dtUserStockHistory.Rows[i]["stock_value"].ToString()));
        }
        var pValue = new GraphPane();
        LineItem lValue = pValue.AddCurve(string.Empty, stockValueList, Color.Red);
        master.Add(pValue);
        using (Graphics g = zdg_stock.CreateGraphics())
        {
            master.SetLayout(g, PaneLayout.SingleColumn);
            zdg_stock.AxisChange();
            zdg_stock.IsSynchronizeXAxes = true;
            zdg_stock.IsAutoScrollRange = true;
            zdg_stock.IsShowHScrollBar = true;
            zdg_stock.IsEnableVZoom = false;
            zdg_stock.IsShowPointValues = true;
        }

        zdg_stock.AxisChange();
MasterPane master=zdg_stock.MasterPane;
var stockValueList=new PointPairList();
对于(int i=0;i<\u dtUserStockHistory.Rows.Count;i++)
{
XDate time=XDate.DateTimeToXLDate((DateTime)dtUserStockHistory.Rows[i][“ush_time”]);
股票价值表。添加(
时间
Parse(_dtUserStockHistory.Rows[i][“stock_value”].ToString());
}
var pValue=新的GraphPane();
LineItem lValue=pValue.AddCurve(string.Empty,stockValueList,Color.Red);
主添加(pValue);
使用(Graphics g=zdg_stock.CreateGraphics())
{
master.SetLayout(g,PaneLayout.SingleColumn);
zdg_stock.AxisChange();
zdg_stock.IsSynchronizeXAxes=true;
zdg_stock.IsAutoScrollRange=true;
zdg_stock.IsShowHScrollBar=true;
zdg_stock.IsEnableVZoom=false;
zdg_stock.IsShowPointValues=真;
}
zdg_stock.AxisChange();

打印前进行排序如何?

请发布一些代码来演示如何绘制线条。谢谢。我已经发布了部分代码。是在SQL中排序还是在DataTable中排序?我试图在我的sql中添加“按时间排序”。这与位置无关,但在第一个图形中,这条线也在倒转,这表明您的数据没有按时间排序。但这种情况不是经常发生的,我没有做任何更改,只是重新打开表单,这一切正常。不管怎样,我添加了“按时间排序”,并观察它是否会再次发生。谢谢~