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

DataViz Widgets and MVVM

0 Answers 79 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Alexey
Top achievements
Rank 1
Alexey asked on 28 Mar 2012, 05:47 PM
Is it any chance to have Pie Chart or other DataViz widget refreshed after property of my VM was changed?
I've tried to init charts with VM wrapped by kendo.observable like:
var viewModel = kendo.observable({
                theme: "default",
                title: { text: "Break-up of Spain Electricity Production for 2008" },
                legend: { position: "bottom" },
                seriesDefaults: { labels: { visible: true, format: "{0}%" }},
                series: [{ type: "pie",
                    data: [ { category: "Hydro", value: 10 }, { category: "Solar", value: 20 }, 
       { category: "Nuclear", value: 30 }, { category: "Wind", value: 40}]         
 }]
            });
            $("#chart").kendoChart(viewModel);

but no luck - my chart was not generated at all.
It works better if wrap only data for series
var viewModel = {
                theme: "default",
                title: { text: "Break-up of Spain Electricity Production for 2008" },
                legend: { position: "bottom" },
                seriesDefaults: { labels: { visible: true, format: "{0}%" }},
                series: [{ type: "pie",
                    data: kendo.observable([ { category: "Hydro", value: 10 }, { category: "Solar", value: 20 }, 
       { category: "Nuclear", value: 30 }, { category: "Wind", value: 40}])
 }]
            };
            $("#chart").kendoChart(viewModel); 
but no refresh happened after i changed the collection:
viewModel.series[0].data.pop();
viewModel.series[0].data.pop();
viewModel.series[0].data.push({ category: "New", value: 70 });
even after i call
$("#chart").data("kendoChart").refresh();
Is it any chance to refreshing DataViz control without recreating it?

Thank you.

PS: I want to add one more voice for knockoutJS and drill down option for charts :)

No answers yet. Maybe you can help?

Tags
MVVM
Asked by
Alexey
Top achievements
Rank 1
Share this question
or