Highcharts Stock Demo

author(s): Torstein Hønsi Guillaume Seguin

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<div id="container" style="height: 400px; min-width: 600px"></div>

<button id="button" class="autocompare">hoverSeries error!?</button>

<script src="https://github.highcharts.com/hc5-fixes/stock/highstock.js"></script>
<script src="https://github.highcharts.com/hc5-fixes/stock/modules/exporting.js"></script>
<script type="text/javascript" src="https://www.highcharts.com/samples/data/three-series-1000-points.js"></script>
<script type="text/javascript" src="https://www.highcharts.com/samples/data/usdeur.js"></script>

JavaScript

var chartConfig1 = {
  navigator: {
    adaptToUpdatedData: false
  },
  
  

    series: [{
        name: 'MSFT',
        data: MSFT
    },{
        name: 'ADBE',
        data: ADBE
    },{
        name: 'usdeur',
        data: usdeur
    },{
        name: 'GOOGL',
        data: GOOGL
    }],
};

var newSeries = [
  {
    marker: {
      radius: 3,
      enabled: true
    },
    shadow: true,
    showInNavigator: true,
    tooltip: {
      valueDecimals: 2,
      pointFormat: "<span style=\"color:{point.color}\">●</span> {series.name}: <b>{point.y}UNITUN</b><br/>"
    },
    data: usdeur,
    name: "usdeur"
  }
];

var chart = Highcharts.stockChart('container', chartConfig1);

$('#button').click(function () {
    while(chart.series.length > 0)
    	chart.series[0].remove(false);
  	newSeries.forEach(
    	function(serie){
      	chart.addSeries(serie, false);
      }
    );
    chart.redraw();
    $(this).attr('disabled', true);
});