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/

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

相关推荐
张人玉17 小时前
基于 Vue2 + ECharts + Express + SQLite 的南阳市专题数据可视化系统
sqlite·echarts·express
2301_768103494 天前
HarmonyOS宠物邻里实战第16篇:寄养申请状态机、记录时间线与回归测试
mongodb·集成测试·express·harmonyos·状态机
万亿少女的梦1689 天前
基于Node.js和Express的旅游信息管理平台设计与开发
mysql·node.js·express·系统设计·旅游信息管理
森鹿20 天前
express中间件原理以及大致实现
前端·express
weixin_471383031 个月前
Node.js + Express 入门实战笔记-01-基础
node.js·lua·express
铁打的阿秀1 个月前
SQL server2025 Express安装及管理工具安装使用教程(Windows)
windows·sqlserver·express
代码搬运媛1 个月前
Express 入门到精通笔记
笔记·express
zzqssliu1 个月前
基于Laravel + Express.js的代购系统多语言多货币架构设计
javascript·express·laravel
星空1 个月前
Node.js (Express) + Vue2 Axios 前后端交互 CRUD
vue.js·node.js·express
火山上的企鹅1 个月前
Codex实战:APP远程升级服务搭建(一)NodeJS_Express
express