c# - WPF Canvas as a math graphing area -
c# - WPF Canvas as a math graphing area -
in graphic calculator, using canvas plane on graphs of functions rendered. have noticed whenever input complex functions (i utilize bezier curves that, more complex function -> more points need render graph smooth-looking) gets quite laggy , overally doesn't perform well.
which of these solutions to the lowest degree computationally costly / best approach?
1. (my current solution) using huge canvas within scrollviewer limits view area
cons have found:
the whole canvas rendered, non-visible part
starts lag when there more 50k elements on canvas
2. using canvas not big, , management of panning / zooming through transformmatrix
cons think there might (solution not tried):
won't more laggy when have redraw , recalculate dynammically?3. other solutions?
any help appreciated.
if can avoid it, don't want using discrete visuals represent things charts/graphs; heavy, , participating in input handling , layout. recommend using wpf's drawing/geometry apis directly. suggest implementing custom command performs own rendering (see onrender
). suggest implementing iscrollinfo
can manage own scrolling: know viewport size , position, gives alternative of invalidating geometry when scrolling, , rebuilding only parts of graph in view. should cut down overhead significantly.
c# wpf xaml math canvas
Comments
Post a Comment