Skip to content Skip to sidebar Skip to footer

Jqplot - How Do Get Array Back From Already Created Graph

I plotted a graph with jqplot and included the dragable functionality. The whole point is a user can modify the graph based on what they want. $.jqplot.config.enablePlugins = true

Solution 1:

You'll find the updated data in the chart series[serieIndex].data property:

http://jsfiddle.net/coma/jvGHH/10/

$(function(){

    $.jqplot.config.enablePlugins = true;

    var data = [['23-May-08', 1],['24-May-08', 4],['25-May-08', 2],['26-May-08', 6]];

    var chart = $.jqplot('chart', [data], {
        title : 'My Graph',
        seriesDefaults: {
            fill: true
        },
        axes : {
            xaxis : {
                label: 'My X axis',
                renderer: $.jqplot.DateAxisRenderer
            },

            yaxis : {
                label: 'My Y axis'
            }               
        },
        highlighter: {
            sizeAdjust: 10
        }
    });

    var log = function(seriesIndex, pointIndex, pixelposition, data) {

        console.log(chart.series[0].data);

    };

    $('#chart')
    .bind('jqplotSeriesPointChange', log)
    .bind('jqplotDragStop', log);

});

Btw, there are several events you'll fine useful.


Post a Comment for "Jqplot - How Do Get Array Back From Already Created Graph"