JavaScript
var chart = new Highcharts.Chart({
chart: { renderTo: 'container' },
title: { text: 'Logarithmic y-axis' },
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
type: 'logarithmic',
title: { text: null },
lineColor: '#e7e7e7',
alternateGridColor: '#f7f7f7',
gridLineColor: '#e7e7e7',
allowDecimals: false,
startOnTick: false,
labels: {
formatter: function() {
return (this.value % 1 != 0 ? (this.value != 0.1 ? '' : 0) : this.value);
}
}
},
tooltip: {
shared: true,
formatter: function() {
var s = '<strong>abcde</strong>';
$.each(this.points, function(i, point) {
s += '<br /><span>'+point.series.name +':</span> '+ (point.y == 0.1 ? 0 : point.y);
});
return s;
}
},
series:[
{
name: 'apples',
data: [0.1, 3, 5, 8, 7, 2, 0.1, 108, 4, 7, 6, 10250]
}, {
name:'pears',
data: [1, 2, 2, 0.1, 0.1, 1, 2, 2, 2, 0.1, 0.1, 0.1],
visible: false
}, {
name:'oranges',
data: [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
visible: false
}
],
plotOptions: {
series: {
events: {
legendItemClick: function(event) {
var selected = this.index;
var allSeries = this.chart.series;
$.each(allSeries, function(index, series) {
selected == index ? series.show() : series.hide();
});
return false;
}
}
}
}
});
var chart = new Highcharts.Chart({
chart: { renderTo: 'container2' },
title: { text: 'Linear y-axis'...