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/

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

相关推荐
掉头发类型的选手1 天前
Node.js: express 使用 Open SSL
express
不写八个6 天前
Express教程【006】:使用Express写接口
express
課代表6 天前
Adobe LiveCycle ES、LiveCycle DS 与 BlazeDS 关系解析与比较
数据库·adobe·pdf·express·livecycle·lcds·soa平台
不写八个9 天前
Express教程【002】:Express监听GET和POST请求
前端·javascript·express
不写八个9 天前
Express教程【003】:Express获取查询参数
开发语言·express
爱编程的小学究12 天前
【node】Express创建服务器
运维·服务器·express
码农捻旧14 天前
基于GitHub Actions+SSH+PM2的Node.js自动化部署全流程指南
node.js·自动化·ssh·github·express
漫谈网络15 天前
基于TypeScript的全栈待办事项应用Demo
前端·javascript·typescript·node.js·express
xx240616 天前
什么是Express
express
码农捻旧18 天前
Node.js Express 项目现代化打包部署全指南
javascript·node.js·github·express