Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="https://code.jquery.com/jquery.min.js"></script>
  <script src="https://code.highcharts.com/stock/highstock.src.js"></script>
</head>
<body>  
  <button id="months">Days</button>
  <div id="container"></div>
  <script>
    var data = [
      [Date.UTC(2017, 0, 1), 9],
      [Date.UTC(2017, 0, 2), 3],
      [Date.UTC(2017, 3, 1), 1],
      [Date.UTC(2017, 4, 1), 7]
    ]
    
    var chart = Highcharts.stockChart('container', {
      chartType: 'stock', chart: { type: 'line' }, rangeSelector: { enabled: false }, navigator: { enabled: false },
      yAxis: { visible: false }, legend: { enabled: true }, scrollbar: { enabled: false  },
      
      plotOptions: {
        series: {
          dataGrouping: {
            forced: true,
            approximation: 'sum',
            units: [['day', [1]]]
          }
        }
      },
      series: [{
        data: data
      }]
    });
    $('#months').click(function() {
      chart.update({
        plotOptions: {
          series: {
            dataGrouping: {
              units: [[ 'month', [1]]]
            }
          }
        }
      });
    });
  </script>
</body>
</html>
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers