increase the tickLength of specific x ticks in line charts - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

increase the tickLength of specific x ticks in line charts

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){//w w  w .  j a v a  2s .co m
$(function () {
    var currentYear = '';
    var isMonthCombined = false;
    $('#container').highcharts({
        credits: {
            enabled: false
        },
        chart: {
            type: 'spline',
            style: {
                fontFamily: '"Open Sans", "Helvetica Neue", Helvetica, Arial',
                fontSize: 14
            },
            marginLeft: 78
        },
        title: {
            text: null
        },
        legend: {
            x: 40
        },
        xAxis: [{
            linkedTo: 1,
            categories: [],
            tickLength: 25,
            labels: {
                format: ' '
            },
            tickPositions: [3, 7]
        }, {
            gridLineColor: '#e0e0e0',
            gridLineWidth: 1,
            lineColor: '#e0e0e0',
            tickColor: '#e0e0e0',
            categories: ["Jan 2013 - Mar 2013",
                "Apr 2013 - Jun 2013",
                "Jul 2013 - Sep 2013",
                "Oct 2013 - Dec 2013",
                "Jan 2014 - Mar 2014",
                "Apr 2014 - Jun 2014",
                "Jul 2014 - Sep 2014",
                "Oct 2014 - Dec 2014",
                "Jan 2015"],
            labels: {
                formatter: function () {
                    var year = this.value.slice(-4);
                    if (currentYear != year) {
                        currentYear = year;
                        return currentYear;
                    }
                    return '';
                }
            }
        }],
        yAxis: {
            gridLineColor: '#e0e0e0',
            gridLineWidth: 1,
            lineColor: '#e0e0e0',
            title: {
                text: 'Views'
            },
            min: 0
        },
        plotOptions: {
            series: {
                allowPointSelect: true
            }
        },
        series: [{
            xAxis: 1,
            name: 'Views and Downloads',
            lineWidth: 6,
            color: '#f29400',
            marker: {
                symbol: 'circle',
                fillColor: '#FFFFFF',
                radius: 7,
                lineWidth: 5,
                lineColor: null
            },
            data: [21410,
            9413,
            3982,
            1000,
            0,
            5,
            176,
            104,
            3]
        }]
    });
});
    });

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px"></div>  
   </body>
</html>

Related Tutorials