javascript - Update flot chart with slider -
hi have 2 scripts , want make 1 of them. value of slider chart if use slider chart don't make changes. tried different plot.draw(); don't find working solution.
what must do? can me please?
$(function () { /*-------------------------------------------------- plugin: slider --------------------------------------------------*/ /* increment slider */ $( "#incrementslider" ).slider({ range: "min", value:1500, min: 0, max: 10000, step: 100, slide: function( event, ui ) { $( "#incrementamount" ).text ("txt: " + ui.value + "€"); } }); $( "#incrementamount" ).text ( "txt: " + $( "#incrementslider" ).slider( "value" ) + "€" ); var ds = []; var data = []; ds.push ([[1,$( "#incrementslider" ).slider( "value" )]]); ds.push ([[1,$( "#incrementslider" ).slider( "value" ) - $( "#incrementslider" ).slider( "value" ) / 100 * 19,5]]); ds.push ([[1,$( "#incrementslider" ).slider( "value" ) / 100 * 19,5]]); data.push ({ data: ds[0], label: 'graph1', bars: { barwidth: 0.15, order: 1 } }); data.push ({ data: ds[1], label: 'graph2', bars: { barwidth: 0.15, order: 2 } }); data.push ({ data: ds[2], label: 'graph3', bars: { barwidth: 0.15, order: 3 } }); charts.vertical ('#vertical-chart', data); });
plot.draw() wont reset data or scale axis, easier re-plot whole graph (performance-wise wont notice difference)
Comments
Post a Comment