javascript - Highcharts label formatter return inside and outside if statement? Is this correct? -
using highcharts label formatter
http://api.highcharts.com/highcharts#yaxis.labels.formatter
i'm using code below customize first label, , return values others. how should use return
twice within formatter? while works i'm checking there isn't better way write function. i'm little new js , wondering if returned data combined how?
thanks
$(function () { $('#container').highcharts({ chart: { marginbottom: 80 }, xaxis: { categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] }, yaxis: { labels: { //align: 'left', //x: 0, //y: -2, usehtml: true, formatter:function(){ if(this.isfirst){ return 'test'; } return this.value; } } }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); });
Comments
Post a Comment