Skip to content Skip to sidebar Skip to footer

How To Plot Area Type Highchart?

Here is the jsfiddle Code reproduction, I am using Highcharts to plot an area graph, how do I do the below ? I need to move the y-axis labels to the right Plot Area chart of 3 col

Solution 1:

  1. Set yAxis.opposite to true.

  2. Add two more series and use tickPositioner to show thier last values as labels.

    yAxis: {
         opposite: true,
         showFirstLabel: false,
         showLastLabel: false,
         tickPositioner: function() {
             var prevTickPos = this.tickPositions,
                 tickPositions = [prevTickPos[0], prevTickPos[prevTickPos.length - 1]],
                 series = this.chart.series;
    
             series.forEach(function(s) {
                 tickPositions.push(s.processedYData[s.processedYData.length - 1]);
             });
    
             tickPositions.sort(function(a, b) {
                 return a - b;
             });
    
             return tickPositions;
         },
         ...
     }
    

Live demo:https://jsfiddle.net/BlackLabel/gk1t6cp2/

API Refernce:https://api.highcharts.com/highcharts/yAxis.opposite

Post a Comment for "How To Plot Area Type Highchart?"