prevent gaps adding new line series for stock chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

prevent gaps adding new line series for stock chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Stock Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script> 
      <style id="compiled-css" type="text/css">

@import 'https://code.highcharts.com/css/highcharts.css';
.highcharts-candlestick-series .highcharts-point {
   stroke: #2f7ed8;/*from  w  ww.  ja va 2s. c  o  m*/
}
.highcharts-candlestick-series .highcharts-point-up {
   stroke: silver;
   fill: silver;
}


      </style> 
   </head> 
   <body> 
      <div id="container" style="height: 400px; min-width: 600px"></div> 
      <script src="https://code.highcharts.com/stock/js/highstock.js"></script> 
      <script src="https://code.highcharts.com/stock/js/modules/exporting.js"></script> 
      <script type="text/javascript" src="https://www.highcharts.com/samples/data/ohlc.js"></script> 
      <script type="text/javascript">
Highcharts.stockChart('container', {
    chart: {
        events: {
            load: function() {
                var xAxes = this.xAxis,
                    extremes = xAxes[0].getExtremes();
                xAxes[1].setExtremes(extremes.min, extremes.max, true, false);
            }
        }
    },
    rangeSelector: {
        selected: 1
    },
    xAxis: [{}, {
        visible: false
    }],
    series: [{
            type: 'ohlc',
            name: 'USD to EUR',
            data: ohlcdata
        },
        {
            xAxis: 1,
            data: [
                [1293869306000, 0.75],
                [1294301306000, 0.75]
            ]
        }
    ]
});

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

Related Tutorials