Alex K.
Alex K.

Reputation: 3304

Flot chart multiple axes are not configured properly

I am expecting pretty weird problem with flot v.0.7. I have multiple axes, configured like that:

var plotData = [
    { data: data1 },
    { data: data2, yaxis: 2 }];

var options = {
    selection: { mode: "x" },
    xaxis: { mode: "time" },
    yaxis: [
      { min: 0 },
      {
        min: 0, 
position: "right",
zoomRange: false,
alignTicksWithAxis: 1,
tickFormatter: formatter,
      }
    ],
    grid: { markings: weekendAreas },
    zoom: { interactive: true },
    grid: {
        clickable: true,
        hoverable: true,
        borderWidth: 1,
    },
    legend: { show: false },
};

var plot = $jq.plot(container, plotData, options);

But what I get is that both Y series are located on the right (not only second Y series). There is no formatter for my second series tick. Y values can be less then zero, if zooming. If I don't use array type for yaxis and define it as it would only be one series, then everything works fine. What am I doing wrong?

Upvotes: 1

Views: 2507

Answers (1)

DNS
DNS

Reputation: 38219

Instead of yaxis: [ ... ], use yaxes: [ ... ].

See the section of the docs entitled Multiple Axes for more info.

Upvotes: 7

Related Questions