WPF Low performance with Axis grid lines

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

Gimly wrote at 2013-09-19 18:27:

I have a rather complex graph (16 series composed of 10 data points each, 4 scatter, 12 lines). And I get very slow refresh performances when I'm adding the axis grid lines, without them, everything runs smooth and without any issues.

I did a minimal test, and it seems to be even struggling with only 1 serie... Am I doing something wrong?

Here's the code for the "minimal" version.
            var plotModel1 = new PlotModel();
            plotModel1.LegendPosition = LegendPosition.TopLeft;
            var linearAxis1 = new LinearAxis();
            linearAxis1.MajorGridlineStyle = LineStyle.Solid;
            linearAxis1.MinorGridlineStyle = LineStyle.Dot;
            linearAxis1.Position = AxisPosition.Bottom;
            plotModel1.Axes.Add(linearAxis1);
            var linearAxis2 = new LinearAxis();
            linearAxis2.MajorGridlineStyle = LineStyle.Solid;
            linearAxis2.MinorGridlineStyle = LineStyle.Dot;
            plotModel1.Axes.Add(linearAxis2);
            var lineSeries12 = new LineSeries();
            lineSeries12.Color = OxyColor.FromArgb(255, 164, 196, 0);
            lineSeries12.MarkerFill = OxyColor.FromArgb(255, 164, 196, 0);
            lineSeries12.MarkerSize = 5;
            lineSeries12.MarkerType = MarkerType.Circle;
            lineSeries12.Points.Add(new DataPoint(0, 1.24931413366607E-06));
            lineSeries12.Points.Add(new DataPoint(2.1067699074214E-05, 1.26694618923807E-06));
            lineSeries12.Points.Add(new DataPoint(5.02464626567535E-05, 1.29136658651057E-06));
            lineSeries12.Points.Add(new DataPoint(9.06380069247887E-05, 1.32517122510278E-06));
            lineSeries12.Points.Add(new DataPoint(0.00014072807797715, 1.36709279011516E-06));
            lineSeries12.Points.Add(new DataPoint(0.000198638830168781, 1.41555966811938E-06));
            lineSeries12.Points.Add(new DataPoint(0.000262199225377347, 1.46875486596933E-06));
            lineSeries12.Points.Add(new DataPoint(0.000329026423873679, 1.52468412874539E-06));
            lineSeries12.Points.Add(new DataPoint(0.000396615115502864, 1.58125070313242E-06));
            lineSeries12.Points.Add(new DataPoint(0.000462431442205522, 1.63633394339889E-06));
            lineSeries12.Points.Add(new DataPoint(0.000524007990782276, 1.68786881308793E-06));
            plotModel1.Series.Add(lineSeries12);
            return plotModel1;
(The ctrl-alt-c command is a reaaaaly clever idea by the way :))

Love the library, I'm in the process of reviewing several commercial plot libraries and OxyPlot is one of the simpler in terms of development. If I can get over that performance issue, it will make it perfect for my needs !

I just find it kind of sad that we cannot configure all the look of the plot in XAML, in the end it's where it should go. Maybe an amelioration for the future?

objo wrote at 2013-09-20 09:06:

See https://oxyplot.codeplex.com/wikipage?title=Performance&referringTitle=Documentation
Dotted lines are not performing well in WPF. There is nothing we can do about that, I think.

Gimly wrote at 2013-09-20 10:54:

Thanks for the link!

I just switched to solid lines and indeed it's faster.