gapUnit navigator in stock chart - Javascript highcharts

Javascript examples for highcharts:Stock Chart

Description

gapUnit navigator in stock chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <style id="compiled-css" type="text/css">

.info {//  w w w.j  ava2s . co m
   font: 0.7em sans-serif;
   padding: 0.5em;
   margin: 0.5em;
   background: #FCFFC5;
   border-radius: 0.5em;
   border: 1px solid gray;
}
.info:before {
   content: 'i';
   margin: 0.5em;
   font: 1.5em serif bold;
   font-style: italic;
   color: green;
}


      </style> 
      <script type="text/javascript">
    window.onload=function(){
Highcharts.StockChart('container', {
    chart: {
        type: 'area'
    },
    rangeSelector: {
        selected: 1
    },
    plotOptions: {
        series: {
              //gapSize: 1,
            gapUnit: 'value',
            gapSize: 24*60*60*1000    // in ms
        }
    },
    series: [{
        name: 'USD to EUR',
        data: usdeur
    }],
    navigator: {
        series: {
            gapUnit: `relative`,
            gapSize: 0,
        },
    }
});
    }

      </script> 
   </head> 
   <body> 
      <div id="container" style="height: 400px; min-width: 600px"></div> 
      <div class="info">
         Weekends should appear as gaps in the graph.
      </div> 
      <script src="https://code.highcharts.com/stock/highstock.js"></script> 
      <script src="https://code.highcharts.com/stock/modules/exporting.js"></script> 
      <script type="text/javascript" src="https://www.highcharts.com/samples/data/usdeur.js"></script>  
   </body>
</html>

Related Tutorials