microcharts-dotnet / Microcharts

Create cross-platform (Xamarin, Windows, ...) simple charts.
MIT License
2.03k stars 360 forks source link

[Bug] Performance hit with MaxValue and MinValue of Axis based charts #290

Closed brett-estabrook closed 3 years ago

brett-estabrook commented 3 years ago

Describe the bug For each point that is drawn there are a couple places where it references MaxValue. Unfortunately, MaxValue has a linq statement that goes over every point to to determine the max value. For small datasets this is not noticeable, but for large data sets this becomes problematic fast.

Which platform and version is this for? Latest codebase

To Reproduce Steps to reproduce the behavior:

  1. Create a chart with a large number of data points

Expected behavior Move the calculation of MaxValue out of the loop so it the value can be cached per render

Additional information I'm working on a PR for this: Working Branch

brett-estabrook commented 3 years ago

I'm almost done with this. I'll be making a PR shortly.

eman1986 commented 3 years ago

Thanks I appreciate your contribution