Highcharts mulitple y axis unit not display -


i new in highcharts. creating multiple series reading java server side json list, json objects consist multiple series , each series have 'electric irms' following 'temperature' mapping 2 y axis label.

the problem encounter 2nd y axis unit not display. json list format are

{name, "serialnumber1_type1", {"data", [[timestamp1, value1],                                         [[timestamp2, value2], ... {name, "serialnumber1_type2", {"data", [[timestamp1, value1],                                         [[timestamp2, value2], ... {name, "serialnumber2_type1", {"data", [[timestamp1, value1],                                         [[timestamp2, value2],  {name, "serialnumber2_type2", {"data", [[timestamp1, value1],  ... {"title","highcharts title"} 

e.g json list

[{"name":"5004672_irms"},{"data":[[1373958000000,53],[1373958300000,53]....  {"name","5004672_temperature"},{"data":[[1373958000000,80],[1373958300000,81]....  {"name":"5004687_irms"},{"data":[[1373958000000,54],[1373958300000,53]..  {"name","5004687_temperature"},{"data":[[1373958000000,82],[1373958300000,83]...  ....  {"title", "highcharts_title"} ] 

my code below

$(function() {  var titlename='';      var options = {                 chart: {                     renderto: 'container',                     type: 'spline'                 },                 rangeselector : {                   {                  type: 'day',                  count: 1,                  text: '1 d'                   },{                  type: 'week',                   count: 1,                   text: '1 wk'                   }, {                  type: 'all',                  text: 'all'                  }],                  selected: 1                 },                  title: {                   text: '(irms & temperature)'                 },                   xaxis: {                      title: {                          text: 'time (utc)'                      },                      type: 'datetime',                      labels: {                          align: 'left',              formatter: function() {             return highcharts.dateformat('%i:%m %p', this.value);              }                      },              gridlinedashstyle: 'dot',              gridlinewidth: 1,              tickinterval: 60 * 60 * 1000,              linewidth: 2,              linecolor: '#92a8cd',                          tickwidth: 3,                          ticklength: 6,                          tickcolor: '#92a8cd',                 },                 yaxis: [{              labels: {                 formatter: function() {                     return this.value;                 }              },                      title: {                          text: ''                      },          opposite: true          },          {              gridlinewidth: 0,              title: {                 text: '',                 style: {                    color: '#4572a7'                 }              },              labels: {                 formatter: function() {                     return this.value +'°f';                 }             }                               }         ],                  plotoptions: {                     series: {                         cursor: 'pointer',                         point: {                             events: {                                 ...                                         width: 200                                     });                                      sname = this.series.name;                                     $.getjson('/em/em/historypointdetail?pointid=' + sname, function(response) {                                         ......                                     });                                 }                             }                         },                          marker: {                             linewidth:                          }                     },                  series: []      };  var serialnumber; $.getjson('/em/em/lli?id=<c:out value="${elementids}" />',function(data)  {     $.each(data, function(key,value) {        $.each(value, function(key,val) {          if (key == 'name') {                 serialnumber = val;          }          else if (key == 'data') {           var dataseries = { data: []};               $.each(val, function(key,val) {                         dataseries.data.push(val);               });               dataseries.name=serialnumber;           var names = serialnumber.split('_');           if (names[1] == 'irms') {                options.title.text = 'current';                options.series.yaxis = 0;                options.yaxis[0].title.text = 'current';           }           else if (names[1] == 'temperature') {                  options.title.text = 'temperature';                  options.series.yaxis = 1;                  options.yaxis[1].title.text = 'temperature';           }               options.series.push(dataseries);           }            else if (key == 'title') {                 htext = val;           }       });                    });                    chart = new highcharts.stockchart(options);         chart.settitle({text: htext});       }).error(function() {console.log('error');}); 

i created 2 y axis , 2nd y axis have labels return this.value + " f". 2nd y axis label not display when chart draw.

thanks

when adding series different yaxis, need specify index of yaxis, or id, example:

var dataseries = { data: [], yaxis: 1}; 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -