Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于Chart曲线界面的代码设计 #157

Open
mt6595 opened this issue Mar 6, 2024 · 1 comment
Open

关于Chart曲线界面的代码设计 #157

mt6595 opened this issue Mar 6, 2024 · 1 comment

Comments

@mt6595
Copy link

mt6595 commented Mar 6, 2024

您的功能请求是否与解决某些问题有关?请描述一下。/ Is your feature request related to a problem? Please describe.

优化

描述您想要的解决方案 / Describe the solution you'd like

优化

描述您想要的详细使用步骤描述 / Describe the solution you'd like to use in what way

使用

            for (int i = 0; i < DataY.Length; i++)
            {
                if (DataY[i] == null)
                    DataY[i] = new double[MaxPoints];
                Plot.Plot.AddSignal(DataY[i]);
            }

替代

            DataX = new double[MaxPoints];
            for (int i = 0; i < MaxPoints; i++)
                DataX[i] = i - MaxPoints + 1;
            for (int i = 0; i < Data.Length; i++)
            {
                if(Data[i] == null)
                    Data[i] = new double[MaxPoints];
                Plot.Plot.AddSignalXY(DataX, Data[i]);
            }

--------------------------------------------------分割线-------------------------------------------------
使用

            Plot.Plot.AxisAuto();

替代

            Plot.Plot.SetAxisLimitsX(-MaxPoints, 0);
            //防止最大值最小值错误
            var min = Data.Min(x => x.Min());
            var max = Data.Max(x => x.Max());
            if(min < max)
                Plot.Plot.SetAxisLimitsY(min, max);

--------------------------------------------------分割线-------------------------------------------------
使用

            Array.Copy(DataY[line], 1, DataY[line], 0, DataY[line].Length - 1);

替代

            for(int i = 0;i < MaxPoints - 1;i++)
                Data[line][i] = Data[line][i + 1];

--------------------------------------------------分割线-------------------------------------------------
十字光标掉帧严重,建议提高刷新率或者移除十字光标

其他备注信息或截图 / Add any other context or screenshots about the feature request here

No response

@chenxuuu
Copy link
Owner

DataY是什么

AxisAuto里面的代码,比我写的还复杂好多,而且会擅自调整可视范围,用户会被不停地强制缩放到自适应尺寸

Array.Copy确实快

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants