0

is there a way to compress the x axis or skip large sections of no data in highcharts?

http://jsfiddle.net/eh7edruq/

if you look at the fiddle there is a large area with no data. Is there a way to compress the two ends of that data and have some sort of visual that the graph is disjointed?

Highcharts.chart('container', {

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',]
    },

    plotOptions: {
        series: {
            // connectNulls: false // by default
        }
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, null, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4,
        null, null, null, null, null, null, null, null, null, null, null, null,
        null, null, null, null, null, null, null, null, null, null, null, null,
         null, null, null, null, null, null, null, null, null, null, null, null,
        29.9, 71.5, 106.4, 129.2, null, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4,]
    }]

});
Bryan Dellinger
  • 4,724
  • 7
  • 33
  • 79
  • Look this answer to [remove null values](https://stackoverflow.com/a/281335/3200799) and then use the returned array for your data – Core972 Dec 09 '17 at 09:37

1 Answers1

1

Broken axis module seems to be exactly what you're looking for. In this demo custom visualization is added to yAxis.breaks functionality:

http://jsfiddle.net/gh/get/jquery/2/highcharts/highcharts/tree/master/samples/highcharts/axisbreak/break-visualized/

API reference: https://api.highcharts.com/highcharts/yAxis.breaks

Kamil Kulig
  • 5,756
  • 1
  • 8
  • 12