Set data plot formatter - Javascript highcharts

Javascript examples for highcharts:Plot

Description

Set data plot formatter

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://code.jquery.com/jquery-1.9.1.js"></script> 
      <script type="text/javascript">
$(function () {//from w ww .j  av  a 2  s.c o m
    var my_chart = {
        chart: {
            renderTo: 'divTotalOpenPositionsGraph',
            type: 'column',
            marginLeft: 13,
            marginBottom: 30,
            marginTop: 5,
            //fontFamily: 'Arial,Helvetica,sans-serif',
        },
        credits: {
            enabled: false
        },
        title: {
            text: 'Open Position'
        },
    legend: {
        enabled: false
    },
    plotOptions: {
        series: {
            colorByPoint: true,
            borderWidth: 0,
            animation: {
                duration: 5000
            },
            dataLabels: {
                enabled: true,
                formatter: function () {
                    if (this.y > 0) return this.y;
                }
            }
        }
    },
    series: [{
        name: 'Positions',
        data: [6, 9]
    }],
    colors: [
        '#f89422',
        '#8cc641'],
    xAxis: {
        categories: ['Internship', 'Employment'],
        labels: {
            enabled: true
        }
    },
    yAxis: {
        title: {
            text: null
        },
        labels: {
            enabled: false
        }
    }
};
new Highcharts.Chart(my_chart);
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="divTotalOpenPositionsGraph" style="min-width: 400px; height: 400px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials