Search code examples
javascriptjqueryflot

jQuery Flot with multi yaxis and checkbox


Need help to set options for multiple y axes in Flot. This is the current graph: enter image description here

I want to apply these properties to the y axes:

$.plot("#placeholder", data, {
        xaxis: {
          tickDecimals: 0
        },
        yaxis: [{
          position: "left",
          min: 0,
          tickFormatter: function (val, axis) {
            return val + "v";
          },
        },{
          min: 0,
          position: "right",
          tickFormatter: function (val, axis) {
            return val + "M";
          },
        }]
});

But I do not understand why my code does not work here: Fiddle here


Solution

  • The option for multiple axes is yaxes instead of yaxis. See this update fiddle and the documentation.

    enter image description here