Reputation: 10161
I am using column chart
with drilldown
. Here is my JSFIDDLE.
Now my problem is:
As you would be able to notice from my fiddle that I have already tried to apply formatting on the x-axis labels by using the code like:
xAxis: {
type: 'category',
labels:{
style:{
color: 'red',
textDecoration:"none"
}
}
},
and used following code to format dataLabels:
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true,
format: '{point.y:.1f}%',
style:{
color: 'blue',
textDecoration:"none"
}
}
}
}
But the problem is: The formatting only works for that x-axis labels and dataLabels that does not have drilldown data. While it works on all the x-axis labels and dataLabels of drilldowned data !
Useful references: http://api.highcharts.com/highcharts#xAxis.labels.style http://api.highcharts.com/highcharts#series.data.dataLabels
Any help would be greatly appreciated !
Upvotes: 5
Views: 7362
Reputation: 109
{...
series: [],
drilldown: {
activeAxisLabelStyle: {
cursor: 'default',
color: '#3E576F',
fontWeight: 'normal',
textDecoration: 'none'
},
activeDataLabelStyle: {
cursor: 'default',
color: '#3E576F',
fontWeight: 'normal',
textDecoration: 'none'
}
}
}
Upvotes: 2
Reputation: 1296
We can use drilldown option to control the drilldown.
drilldown: {
//for axis label
activeAxisLabelStyle: {
textDecoration: 'none',
fontStyle: 'italic'
},
//for datalabel
activeDataLabelStyle: {
textDecoration: 'none',
fontStyle: 'italic'
}
}
Upvotes: 5
Reputation: 1723
In case you have a chart where only a selection of columns have drilldowns, Sebastian Bochan's answer needs to be modified so that all columns have the same label:
(function (H) {
//DATALABELS
H.wrap(H.Series.prototype, 'drawDataLabels', function (proceed) {
var css = this.chart.options.drilldown.activeDataLabelStyle;
proceed.call(this);
css.textDecoration = 'none';
css.fontWeight = 'normal';
css.cursor = 'default';
css.color = 'blue';
H.each(this.points, function (point) {
if (point.dataLabel) { // <-- remove 'point.drilldown &&'
point.dataLabel
.css(css)
.on('click', function () {
return false;
});
}
});
});
})(Highcharts);
Also note that these settings are global, so also affect any other charts you may have.
Upvotes: 0
Reputation: 1
In drilldown just put
activeAxisLabelStyle: {
cursor: 'pointer',
color: '#0d233a',
fontWeight: 'bold',
textDecoration: 'none'
}
Upvotes: 0
Reputation: 580
Or you can do it with css
.highcharts-drilldown-axis-label{
text-decoration: none !important;
}
Upvotes: 3
Reputation: 37588
You need to overwrite drilldown function, to avoid add action to labels.
http://jsfiddle.net/phpdeveloperrahul/FW64T/
(function (H) {
H.wrap(H.Point.prototype, 'init', function (proceed, series, options, x) {
var point = proceed.call(this, series, options, x),
chart = series.chart,
tick = series.xAxis && series.xAxis.ticks[x],
tickLabel = tick && tick.label;
if (point.drilldown) {
// Add the click event to the point label
H.addEvent(point, 'click', function () {
point.doDrilldown();
});
// Make axis labels clickable
if (tickLabel) {
if (!tickLabel._basicStyle) {
tickLabel._basicStyle = tickLabel.element.getAttribute('style');
}
tickLabel.addClass('highcharts-drilldown-axis-label') .css({
'text-decoration': 'none',
'font-weight': 'normal',
'cursor': 'auto'
})
.on('click', function () {
if (point.doDrilldown) {
return false;
}
});
}
} else if (tickLabel && tickLabel._basicStyle) {
}
return point;
});
})(Highcharts);
Upvotes: 4