javascript - How to plot data points with two y values? -


i've been searching answer while , although there come near, have yet find right solution.

i want plot line chart of water levels on time. want have depth (ex: 25m) y axis on 1 side , height above sea level (ex: 1300m) on other. there should 1 line data points on chart.

at moment config looks this:

var config = {     title: {         text: 'borehole water level'     },     options: {         tooltip: {             formatter: function() {                 var tooltip = '<b><u>' + boreholename + '</u></b>';                  $.each(this.points, function() {                     tooltip += '<br/><strong>date : </strong>' + baseservice.formatdate(this.x);                     tooltip += '<br/><strong>' + this.series.name + ': </strong>' +                     this.y + 'm';                 });                 return tooltip;             },             shared: true         }     },     xaxis: {         type: 'datetime',         datetimelabelformats: {             month: '%e. %b',             year: '%b'         }     },     yaxis: [{         title: {             text: 'depth [m]'         }         }, {             opposite: true,             title: {                 text: 'level above sea [m]'             }         }],         series: [{             name: 'water level depth',             data: chartdata,         }, {             name: 'water level above sea level',             data: chartdata2,             yaxis: 1         }]     };     return config; }; 

at moment have 2 separate lines want one.

the easiest way achieve want link second yaxis first 1 , modify labels of second using formatter.

api reference:
http://api.highcharts.com/highcharts/yaxis.linkedto http://api.highcharts.com/highcharts/yaxis.labels.formatter

example:
http://jsfiddle.net/d9ruh9n1/


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -