position the dataLabel for highcharts on the same side of the x-axis? - Javascript highcharts

Javascript examples for highcharts:Chart Label

Description

position the dataLabel for highcharts on the same side of the x-axis?

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Column with negative values</title> 
      <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">
$(function () {/*  www.  ja  va2 s .  c om*/
    $('#container').highcharts({
        chart: {
            type: 'column',
            height: 200,
            spacingBottom: 15,
            spacingTop: 20,
            spacingLeft: 5,
            spacingRight: 15,
            borderWidth: 1,
            borderColor: '#ddd'
        },
        title: {
            text: ''
        },
        legend: {
            padding: 0,
            margin: 5
        },
        credits: {
            enabled: true
        },
        tooltip: {
            enabled: false
        },
        plotOptions: {
            column: {
                  stacking: 'normal',
                dataLabels: {
                    enabled: true,
                    verticalAlign : 'top',
                    y: -20,
                    style: {
                        color: '#252525',
                        fontWeight: 'bold'
                    },
                }
            }
        },
        colors: ['#4572A7', '#AA4643', '#89A54E', '#80699B', '#3D96AE', '#DB843D', '#92A8CD', '#A47D7C', '#B5CA92'],
        loading: {
            labelStyle: {
                fontSize: "2em"
            }
        },
        xAxis: {
            categories: ["7/12", "7/13", "7/14", "7/15", "7/16"]
        },
        series: [{
            "name": "Odometer",
            "data": [94.98, 182.96, -160.97, 18.00, 117.97]
        }]
    });
});

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

Related Tutorials