0
votes

I am using FLOT chart to plot charts. The min and max value of Y-axis is getting set by itself(autoscale). Now I want to retrieve the min and max value of Y-axis and post it in some text boxes.I used the following code, but its not working.

$.plot($("#placehoder"),dataset,options);
var a=plot.getOptions().yaxes[0].min;
alert(a);
2

2 Answers

0
votes

You try to access the variable plot which you have not set before, change your code to this and it should work:

var plot = $.plot($("#placehoder"), dataset, options);
var a = plot.getOptions().yaxes[0].min;
alert(a);
0
votes
$(function () {

    var data = [];
    for (var i = 0; i < 14; i++) {
        data.push([i, Math.sin(i)]);
    }

    var options = {
        grid: {
            hoverable: true,
            autoHighlight: true
        },
        yaxis: {
            min: -1.2,
            max: 1.2
        }
    };

    var plot = $.plot("#placeholder", [data], options);

    var a = plot.getAxes().yaxis.datamin;
    alert(a);
});