show text as a series on a chart - Javascript highcharts

Javascript examples for highcharts:Chart Series

Description

show text as a series on a chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="min-width: 310px; height: 400px; max-width: 800px; margin: 0 auto"></div> 
      <script type="text/javascript">
Highcharts.chart('container', {
  chart: {/* ww  w . ja  v a2 s  .  c  o  m*/
    type: 'scatter'
  },
  title: {
    text: null
  },
  xAxis: {
    title: {
      enabled: true,
      text: null
    },
  },
  yAxis: {
    title: {
      text: null
    }
  },
  tooltip: {
    formatter: function() {
      return false;
    }
  },
  plotOptions: {
    scatter: {
      marker: {
        radius: 0,
        states: {
          hover: {
            enabled: false,
          }
        }
      },
      dataLabels: {
        enabled: true,
        borderRadius: 5,
        backgroundColor: 'rgba(252, 255, 197, 0.7)',
        borderWidth: 1,
        borderColor: '#AAA',
        y: -6,
        formatter: function() {
          var s = this.point.name;
          return s;
        }
      },
      states: {
        hover: {
          marker: {
            enabled: false
          }
        }
      },
    }
  },
  series: [{
    name: 'Chord',
    color: 'rgba(0, 0, 0, 0)',
    showInLegend: false,
    data: [{
      x: 0,
      y: 50,
      name: 'D'
    }, {
      x: 2,
      y: 50,
      name: 'A'
    }, {
      x: 3,
      y: 50,
      name: 'G'
    }, {
      x: 4,
      y: 50,
      name: 'D'
    }, {
      x: 5,
      y: 50,
      name: 'G'
    }, {
      x: 6,
      y: 50,
      name: 'F'
    }]
  }]
});

      </script>  
   </body>
</html>

Related Tutorials