In this fiddle, with out changing the series data, Is it possible to show x-axis labels as text i.e. {"apple","orange","mango"}
instead of decimals i.e {0,1,2}
with out separating labels from JSON and providing it to Categories.
$(function () {
$('#container').highcharts({
chart: {
},
xAxis: {
labels: {
enabled: true
}
},
series: [{
data: [["apple",29.9], ["orange",71.5], ["mango",106.4]]
}]
});
});
Try this:
$(function () {
var seriesData = [["apple",29.9], ["orange",71.5], ["mango",106.4]];
$('#container').highcharts({
chart: {
},
xAxis: {
tickInterval: 1,
labels: {
enabled: true,
formatter: function() { return seriesData[this.value][0];},
}
},
series: [{
data: seriesData
}]
});
});
SEE DEMO
You can use catgories
in xAxis
xAxis: {
categories: ["apple", "orange", "mango"],
}
I've updated your fiddle: http://jsfiddle.net/Lq6me/1/
If you don't want to use categories you can go for
labels: {
formatter: function() {}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With