dev express 15.2图表绘制性能问题(dotnet绘图表)

dev express 15.2

绘制曲线

  • 前端代码
dotnet 复制代码
<dxc:ChartControl Grid.Row="1">
    <dxc:XYDiagram2D EnableAxisXNavigation="True">
        <dxc:LineSeries2D x:Name="series" CrosshairLabelPattern="{}{A} : {V:F2}"/>
    </dxc:XYDiagram2D>
</dxc:ChartControl>
  • 后端代码
dotnet 复制代码
Dispatcher.BeginInvoke(new Action(() =>
{
    Random random = new Random();
    series.Points.BeginInit();
    series.Points.Clear();
    for (int i = 0; i < 100000; i++)
        series.Points.Add(new SeriesPoint((double)i, random.NextDouble()));
    series.Points.EndInit();
}), DispatcherPriority.Background);

执行的结果图标很卡,一样的代码和dev express的demo性能差距很大

窗口不要最大化,窗口太大显示效率明显降低,devexpress demo最大化之后也存在这个问题。

ScottPlot

dotnet中绘图可以使用scottplot,基于opengl比livechart的基于skia效率高很多

nuget安装scottplot.wpf

  • 前端代码
dotnet 复制代码
xmlns:sp="clr-namespace:ScottPlot;assembly=ScottPlot.WPF"
...
<sp:WpfPlot Grid.Row="1" Name="series"></sp:WpfPlot>
  • 后端代码
dotnet 复制代码
Random random = new Random();
double[] pointCollection = new double[1000000];
Parallel.For(0, 1, (i) =>
{
    for (int j = 0; j < pointCollection.Length; j++)
        pointCollection[j] = random.NextDouble();
});
series.Plot.AddSignal(pointCollection);
Crosshair = series.Plot.AddCrosshair(0, 0);
series.Plot.SetAxisLimitsY(0, 1);
series.Plot.XAxis.SetBoundary(0, pointCollection.Length);
series.Plot.YAxis.LockLimits(true);
series.Refresh();
//MouseMove Event-----------------------------------------------------
(double coordinateX, double coordinateY) = series.GetMouseCoordinates();
Crosshair.X = coordinateX;
Crosshair.Y = coordinateY;
series.Refresh();

scichart

https://www.scichart.com/example/wpf-chart/wpf-line-chart-example/

有免费的版本可以在网上下载

相关推荐
Json____几秒前
node-电商商城平台实战项目(管理端+用户端)
node·vue2·express·element-ui·电商商城
星光开发者1 天前
基于springboot电动汽车租赁管理系统-计算机毕设 附源码 11217
javascript·spring boot·mysql·django·php·html5·express
一袋米扛几楼986 天前
【报错问题】解决 Vercel 部署报错:Express 类型失效与 TypeScript 2349/2339/2769 错误排查
ubuntu·typescript·express
懒人村杂货铺7 天前
Express + TypeScript 后端通用标准规范
javascript·typescript·express
前端小超人rui8 天前
【Node.js Express中间件理解及中间件分类和作用】
中间件·node.js·express
前端小超人rui8 天前
封装Express 自定义中间件
中间件·node.js·express
Aolith8 天前
从前端模拟到全栈认证:我的论坛 JWT 实战复盘
node.js·express
Aolith11 天前
全栈论坛笔记:异步、HTTP 与安全基础
express
Aolith13 天前
学 Express 被 app.use 绕晕了?用流水线思维一次性搞懂 5 种中间件
后端·express
森叶13 天前
告别端口占用!用 Unix Domain Socket 管道让 Express 飞起来
服务器·unix·express