Is there a way to have two y axis linked together

35 views
Skip to first unread message

luyi...@3sigmasoftware.com

unread,
Jun 24, 2016, 10:13:55 AM6/24/16
to Flot graphs
Hi all,

I am working on a plot require two y axis, one axis is labeled as KG, and the other is labeled as LB. I only have one data set like [age,weight(kg)]. Is it possible that I can add another axis, which will calculate data from the same data set or from another axis?
GLA_675.gif

Ced

unread,
Jun 24, 2016, 11:16:53 AM6/24/16
to Flot graphs
Use a single Y-axis but define a tickFormatter function that displays both units.
In this example, the input data is in KG.

var options = {
  yaxis: {
    tickFormatter: function(v) {
      // 1KG = 2.20462 lb
      var lbs = (v * 2.20462).toFixed(1);
      return v.toFixed(1) + ' KG | ' + lbs + " lbs";
    }
  }
}

luyi...@3sigmasoftware.com

unread,
Jun 27, 2016, 10:09:04 AM6/27/16
to Flot graphs
Thanks Ced. It works perfectly.
Reply all
Reply to author
Forward
0 new messages