score:54
Highcharts 4.1.9+
Since 4.1.9, there is an option Axis.visible which can be used to show/hide an axis, demo: http://jsfiddle.net/3sembmfo/36/
Older versions of Highcharts
It's a new feature for Highcharts 3.0 - that allows to update axes in realtime: chart.yAxis[0].update(object)
- as object takes the same options as for creating chart. For example:
chart.yAxis[0].update({
labels: {
enabled: false
},
title: {
text: null
}
});
And jsFiddle: http://jsfiddle.net/39xBU/2/
EDIT:
Use below snippet to hide/show axis by just calling axis.hide()
and axis.show()
. Live demo: http://jsfiddle.net/39xBU/183/
(function (HC) {
var UNDEFINED;
HC.wrap(HC.Axis.prototype, 'render', function (p) {
if (typeof this.visible === 'undefined') {
this.visible = true;
}
if(this.visible) {
this.min = this.prevMin || this.min;
this.max = this.prevMax || this.max;
} else {
this.prevMin = this.min;
this.prevMax = this.max;
this.min = UNDEFINED;
this.max = UNDEFINED;
}
this.hasData = this.visible;
p.call(this);
});
HC.Axis.prototype.hide = function () {
this.visible = false;
this.render();
HC.each(this.plotLinesAndBands, function (plotLine) {
plotLine.render();
});
};
HC.Axis.prototype.show = function () {
this.visible = true;
this.render();
HC.each(this.plotLinesAndBands, function (plotLine) {
plotLine.render();
});
};
})(Highcharts);
score:-1
We can hide Yaxis label without hiding the y-Axis without hiding the series by returning the empty string as follows:
yAxis: {
title: '',
labels: {
formatter: function() {
return '';
},
style: {
color: '#4572A7'
}
}
},
score:-1
For newer versions (I'm using the 6.2.0), the yAxis
property has a parameter called gridLineWidth. Just set it to 0 and the grids for that axis are going to disappear. In this JSFiddle there is an example of it.
However, if you are in styled mode this it's trickier. Here, you have to set a className for the target axis and then set the CSS like this:
.highcharts-yaxis-grid {
&.right-axis {
path {
stroke: none;
}
}
}
For example, this will make dissapear the grids of the axis with a className
set as right-axis. This allow to have different styles for the multiple axis.
score:4
It's actually gotten simpler. You only have to set the yAxis title attribute to false:
yAxis: {
title: false
},
Here is an example: jsfiddle example
Source: stackoverflow.com
Related Query
- Highchart - show / hide an y-Axis without hiding the series
- How to show the transition in highchart series graph without refreshing the html webpage?
- Hiding a Highcharts series without using the legend
- How to place labels on opposite Y axis in Highchart without a second series
- How do I hide a Highcharts series from the chart, but always show it in the tooltip?
- Enable Drilldown in highchart without modifying the series
- How to add a vertical plot line in multiple line series and show the tooltip on Plot line in highchart
- Highchart Line chart – data series with multiple axis - 2nd series placed in the middle of X axis
- Highchart doesn't show the graph : error adding javascript array in series
- How to show series dataLabels inside the Highchart pyramid in angular
- Show multiple Y axis stacked one upon the Other in Highchart Line type graph
- Hide Series without hiding y-Axis
- Add Y axis to highchart dynamically at bottom of the 1st chart without reducing the size of the previous chart
- Unable to load the series without duplication on highchart using angular 4
- Like to show all the labels of x axis in highchart
- I'm trying to have a hide series button on my highchart but it makes the chart disappear
- In the following code i want to show the WHOLE names on x axis nd dont want them to overlap with the legend
- HighCharts Hide Series Name from the Legend
- how to hide highchart x - axis data values
- How can i hide all the Series in highcharts at a time
- Change series data dynamically in react-highcharts without re-render of the chart
- Show specific series values in the stack label using highcharts
- Having trouble just getting the Highchart to show
- Hiding a highchart series is very slow
- How can I extend the lines of this Highchart series to the edges of my chart area?
- How to hide series via the legend in highstock ?
- How can I hide ALL series with the same ID with a button on highcharts? (line graph)
- Highcharts hide series without change legend color
- Show Highchart series horizontally below each other
- Highcharts: show series on legend but hide on chart
More Query from same tag
- Highcharts async tooltip is drawn on top of point
- Highcharts, get the percentage in relation of a total numeric value
- To display legend of the chart outside the canvas of the chart in highcharts
- Highcharts - Scatter plot single series with multicolor plots (points)
- Styling Highcharts
- Highcharts / JavaScript month is incompatible with MySQL
- getJSON function is not executing
- How can I put the Highchart to the html page
- Creating a Highchart with multiple series from a JSON file
- JavaScript - iterating through an array for checking condition
- Highcharts will not render if element in series data is empty
- Highcharts donut customize legend
- How to point the range(dataClasses) for 2nd index in data using highcharts?
- evaluateJavaScript in PyQt - function is not called
- Heatmap With Custom Data Cannot Display anything
- Highcharts button at hide/show multiple series at once
- Chartkick Pie chart legend customisation
- Highcharts bar chart with fixed bar widths and gaps
- Highcharts Chart.container Issue IE8
- Highcharts stacked bar chart Likert scale centering
- How to dynamically alter Highcharts radius option for a specific user?
- Unable to add point into highchart area
- Two highchart update issue
- Remove spaces between columns in HighChart
- If statement for line colours
- Sql DataReader and Multiple Object Variables
- Rails - Create array for Highcharts Chart data
- Highchart point is not right in its line
- Converting JS to CoffeScript, missing operand?
- Is it possible to populate grouped categories dynamically in the grouped-categories plugin using an array?