Visual Studio | WPF > 그래프 > LiveCharts > 꺾은선형 차트 그리기 성능 > 1000점: zooming과 panning이 무거운 | 1만점: 표시되지 않음

운영 환경
Windows 8.1 Pro (64bit)
Microsoft Visual Studio 2017 Community
Sublime Text 2

관련



c++ builder > TeeChart > 한 그래프: 데이터 수 20만 건으로 굳어짐 / 다중 그래프: 총 데이터 수 20만 건으로 굳어짐

C++ Builder에서는 20만건의 데이터 포인트로 그래프가 굳어졌다.
WPF+LiveCharts에서는 어떨까.

운영 환경
Windows 8.1 pro (64bit)
Core i7-6700 3.40GHz
4.0GB RAM

code



MainWindow.xaml
<Window x:Class="_171127_t1200_tooManyPoints.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:_171127_t1200_tooManyPoints"
        xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <StackPanel>
            <lvc:CartesianChart Series="{Binding seriesCollection}" Height="250"
                                LegendLocation="Right"
                                Zoom="Xy"/>
        </StackPanel>
    </Grid>
</Window>

MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
// 以下を追加した
using LiveCharts;
using LiveCharts.Wpf;

namespace _171127_t1200_tooManyPoints
{
    /// <summary>
    /// MainWindow.xaml の相互作用ロジック
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            graph_init();
        }

        private void graph_init()
        {
            gd = new GraphData();

            var sc = new SeriesCollection {
                new LineSeries
                {
                    Title = "napier",
                    Values = new ChartValues<double> { 2, 7, 1, 8, 2, 8, 1, 8 }                    
                }
            };

            graph_add_series(sc);
            gd.seriesCollection = sc;
            this.DataContext = gd;
        }

        static readonly int kNumPoint = 1000; /****************************/

        private void graph_add_series(SeriesCollection sc)
        {
            var lnsr1 = new LineSeries();
            lnsr1.Title = "pi";
            lnsr1.Values = new ChartValues<double> { };
            lnsr1.Fill = Brushes.Transparent;
            lnsr1.PointGeometry = null;
            //
            var gen = new System.Random();
            for (int idx = 0; idx < kNumPoint; idx++)
            {
                var tmp = gen.NextDouble() * 10.0;
                lnsr1.Values.Add(tmp);
            }
            sc.Add(lnsr1);
        }

        GraphData gd;
        public class GraphData
        {
            public SeriesCollection seriesCollection { get; set; }
        }
    }
}

결과



1000점



그림은 한다.
zooming이나 panning의 동작이 무겁게 느껴진다.



1만점



30초 정도 기다렸지만 그려지는 기색은 없다.

최적의 묘화 방법은 별도 있는 것일까.

30 Series 10k points each
를 보면, 더 경쾌한 느낌이 아닐까 생각하지만 무엇이 다른 것일까.
Geared(68.9 USD)를 사용하지 않으면 무리일까.


and plot millions of points in practically no time,

30 Series 10k points each에서는 아래와 같은 처리로 묘화 점수를 줄이고 있는 것 같다.
Values = values.AsGearedValues().WithQuality(Quality.Low)

성능 튜닝



Improve Performance

좋은 웹페이지 즐겨찾기