c# - Adding series to OxyPlot chart programmatically: nothing displayed -


i'm trying use oxyplot in scenario i'm setting chart type, , adding 1 or more series programmatically. end:

  • in xaml view, add plotview control.
  • in code, class has plotmodel property (notifying changes), , addseries method. whenever invoked, setup plot model if not yet configured (i create new plotmodel object , add linearaxis), create random data lineseries, , add series collection of plot model. finally, invoke invalidateplot(true) on force redraw.

yet, nothing displayed when execute code, raises no error.

i googled around bit code samples found refer typical scenario xaml view binds bound datasource; here i'm recreating plotmodel each time, according chart type , series count. can find dummy repro solution here: http://1drv.ms/1r8efbc . compile , run, , click add series. suggest solution?

the bound property plotmodel never updated due to:

private void setuppiechart() {     if (_plot == null) _plot = new plotmodel();     else _plot.axes.clear(); } 

change following , should work:

private void setuppiechart() {     if (plotmodel == null) plotmodel = new plotmodel();     else plotmodel.axes.clear(); } 

since :

private plotmodel _plot; public plotmodel plotmodel {     { return _plot; }     set     {         _plot = value;         onpropertychanged(); // <=== update here     } } 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -