This is a migrated thread and some comments may be shown as answers.

Issues using MVVM and calling setOptions...

2 Answers 142 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Robin
Top achievements
Rank 1
Robin asked on 25 Sep 2013, 06:32 PM
I have a chart built using MVVM, and am trying to programmatically set the select to and from on the categoryAxis.

I can get this to work using a non-mvvm chart (http://jsbin.com/OXESAyi/2/edit),
but on an MVVM chart the chart just craps out with no console error (http://jsbin.com/ifeZAZU/3/edit).
Even following the sample from http://docs.kendoui.com/api/dataviz/chart#methods-setOptions and just trying to change the theme, does the same thing.

Is there some better way of programmatically setting the select than using the setOptions method ?

Thanks.

Robin

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 27 Sep 2013, 08:26 AM
Hi Robin,

Thank you for the provided examples. Using the MVVM approach binds the dataSource after the widget is initialized and currently the setOptions method decides whether to refresh or redraw the Chart based on whether or not there is a dataSource in the original Chart options. This is the reason for that unexpected behavior, and until a fix is released  I would recommend either adding an empty dataSource to the data-attributes or call the Chart's refresh method right after calling setOptions. Here is an example illustrating both of the approaches I suggested.

As a small token of appreciation for bringing this to our attention, I updated your Telerik points.
 

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Robin
Top achievements
Rank 1
answered on 27 Sep 2013, 11:39 AM
That is an easy work-around. 

Thank you for the reply.
Tags
Charts
Asked by
Robin
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Robin
Top achievements
Rank 1
Share this question
or