Hide first yAxis tag in Highcharts

I want to hide the first yAxis shortcut in highcharts. I can not find how to do this. This question closely revises this question: Hide the first label of the label . However, the solution I'm looking for is for high graphics.

yaxis hide

From the image above, I just would like -10 to be hidden.

What do I need to add options to accomplish this?

The code added below is just a general function that I created that takes a parameter, which I called the parameters (object) that I set, with a list of parameters (for example, name, subtitles, series ...).

 var hc_bubble = function(options){ $(options.target).highcharts({ chart: { type: 'bubble', zoomType: 'xy' }, title: { text: options.title || 'unknown' }, subtitle: { text: options.subtitle || '' }, xAxis: { type: options.date || 'datetime', labels: { formatter: function() { return Highcharts.dateFormat("%b %Y", this.value) } }, title: { enabled: true, text: options.xTitle || 'unknown' }, startOnTick: true, endOnTick: true, showLastLabel: true }, yAxis: { title: { text: options.yTitle || 'unknown' } }, tooltip:{ headerFormat: '<b>{series.name}</b><br>', pointFormat: '{point.y} ' + options.yType || 'Connections' }, series: options.series }); } 
+6
source share
2 answers

I was not going to post this question first, because I only found the answer (after searching the documents for a while), but I decided that this could help others.

Just make sure you add the formatter callback to your label object:

  yAxis: { labels:{ formatter: function(){ if(this.value >= 0){ return this.value; } } } } 

http://api.highcharts.com/highcharts#yAxis.labels.formatter

+2
source

While your solution works, there is a slightly more general solution that you might like if your intention is always to have yAxis have a shortcut at the bottom left:

 yAxis: { labels: { formatter: function() { if ( this.isFirst ) { return ''; } return this.value; } } }, 

Using the isFirst property that Highcharts has on this prevents your dependency on β€œmagic numbers” (similarly, there is a value of isLast if you want to try this - although I don't know, so use it).

+3
source

All Articles