highcharts / draggable-points

MIT License
32 stars 34 forks source link

Cant get redraw to fire when i want to reset the data in the series #42

Closed JGuymer closed 8 years ago

JGuymer commented 8 years ago

Hi

We are developing a system to allow users to drag values on a graph but we want a reset button so they can reset the data back to its original form.

i'm using this code and can get it to work if i remove the " draggableY: true," from the options but then we loose the ability to drag.

$("#ResetButton").click(function () {
        if (confirm('Are you sure?')) {
            var chart = $('#forecast').highcharts();
            chart.series[2].setData(userForecastedConsumptionData);
            chart.redraw();
        }

        return false;
    }); 

any ideas would be appreciated.

Thanks

James

JGuymer commented 8 years ago

Following on from this, if i destroy the graph and rebuild it, if i have dragged any points on the previous graph i get 2 points on the bar that i dragged on the previously

see attachment

capture

TorsteinHonsi commented 8 years ago

The original data gets mutated when dragging, so you have to pass a copy (by .slice): http://jsfiddle.net/highcharts/AyUbx/3059/.

PS: This is an issue tracker. For general tech support, please use www.highcharts.com/support in the future.

JGuymer commented 8 years ago

Thanks Torstein, Apologies i thought this was a bug at the time

TorsteinHonsi commented 8 years ago

No worries!​