Fill data to stock chart - Javascript highcharts

Javascript examples for highcharts:Stock Chart

Description

Fill data to stock 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"> 
      <style id="compiled-css" type="text/css">

#container {/*from   w w w.  j a  v a  2s. c om*/
   width: 850px;
   margin: 20px auto;
}


      </style> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/stock/highstock.js"></script> 
      <div id="container"></div> 
      <script type="text/javascript">
Highcharts.stockChart('container', {
  xAxis: {
    tickPositions: [
      1505433600000,
      1505692800000,
      1505779200000,
      1505865600000,
      1505952000000,
      1506038400000,
      1506297600000
    ],
    labels: {
      formatter: function() {
        return Highcharts.dateFormat('%d/%m %H:%M', this.value);
      }
    }
  },
  series: _getAdaptedSeries()
});
function _getAdaptedSeries() {
  return [{
    name: 'portfolio',
    color: '#2acb9b',
    data: [
      [1505433600000, 15000.0],
      [1505692800000, 15000.0],
      [1505779200000, 15002.4785072264849164674],
      [1505865600000, 15004.95789197307424571901],
      [1505952000000, 15007.4381546342814965765],
      [1506038400000, 15009.9192956046704969869],
      [1506297600000, 15012.40131495591828960078]
    ]
  }];
}

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

Related Tutorials