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/

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

相关推荐
q***46417 小时前
使用Node.js搭配express框架快速构建后端业务接口模块Demo
node.js·express
T***16073 天前
ConfigMap:解耦应用配置的利器
hdfs·ruby·express
java_logo4 天前
GPUSTACK Docker 容器化部署指南
运维·mongodb·docker·云原生·容器·eureka·express
java_logo7 天前
MONGO-EXPRESS Docker 容器化部署指南
linux·运维·mongodb·docker·容器·express
天蓝色的鱼鱼8 天前
前端小白Express入门:初识Web框架与项目搭建
前端·node.js·express
k***85848 天前
使用Node.js搭配express框架快速构建后端业务接口模块Demo
node.js·express
q***0569 天前
使用Node.js搭配express框架快速构建后端业务接口模块Demo
node.js·express
2503_928411569 天前
11.11 Express-generator和文件上传和身份认证
数据库·node.js·express
小二李10 天前
第7章 Node框架实战篇 - Express 中间件与RESTful API 接口规范
中间件·express
防火墙在线14 天前
前后端通信加解密(Web Crypto API )
前端·vue.js·网络协议·node.js·express