Basic line

author(s): Torstein Hønsi

by Sascha

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/series-label.js"></script>

<figure class="highcharts-figure">
    <div id="container"></div>
    <div id="container2"></div>
    
</figure>

CSS

.highcharts-figure,
.highcharts-data-table table {
  min-width: 360px;
  max-width: 800px;
  margin: 1em auto;
}

.highcharts-data-table table {
  font-family: Verdana, sans-serif;
  border-collapse: collapse;
  border: 1px solid #EBEBEB;
  margin: 10px auto;
  text-align: center;
  width: 100%;
  max-width: 500px;
}

.highcharts-data-table caption {
  padding: 1em 0;
  font-size: 1.2em;
  color: #555;
}

.highcharts-data-table th {
  font-weight: 600;
  padding: 0.5em;
}

.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
  padding: 0.5em;
}

.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
  background: #f8f8f8;
}

.highcharts-data-table tr:hover {
  background: #f1f7ff;
}

JavaScript

Highcharts.chart('container', {
  chart: {
    height: 70,
    marginLeft: 40, // Keep all charts left aligned
    spacingTop: 5,
    spacingBottom: 5
  },
  credits: {
    enabled: false
  },
  title: {
    text: ''
  },
  yAxis: {
    title: {
      text: ''
    },
    steps: 1,
    max: 1
  },

  xAxis: {
    type: 'datetime',
    ordinal: false,
    visible: false
  },
  plotOptions: {
    series: {
      label: {
        connectorAllowed: true
      }
    }
  },
  legend: {
    enabled: false
  },
  series: [{
    name: 'Mandrel Wheel jammed',
    type: 'line',
    data: [
      [Date.UTC(2016, 4, 04, 17, 13, 01), 0],
      [Date.UTC(2016, 4, 04, 18, 20, 01), 1],
      [Date.UTC(2016, 4, 05, 18, 40, 01), 0],
      [Date.UTC(2016, 4, 05, 20, 05, 01), 1],
      [Date.UTC(2016, 4, 06, 21, 13, 01), 0]
    ],
    step: 'left'
  }],

  responsive: {
    rules: [{
      condition: {
        maxWidth: 500
      },
      chartOptions: {
        legend: {
          layout: 'horizontal',
          align: 'center',
          verticalAlign: 'bottom'
        }
      }
    }]
  }

});

Highcharts.chart('container2', {
  chart: {
    height: 70,
    marginLeft: 40, // Keep all charts left aligned
    spacingTop: 5,
    spacingBottom: 5
  },
  credits: {
    enabled: false
  },
  title: {
    text: ''
  },
  yAxis: {
    title: {
      text: ''
    },
    steps: 1,
    max: 1
  },

  xAxis: {
    type: 'datetime',
    ordinal: false,
    visible: false
  },
  plotOptions: {
    series: {
      label: {
        connectorAllowed: true
      }
    }
  },
  legend: {
    enabled: false
  },
  series: [{
    name: 'Mandrel Wheel jammed',
    data: [
      [Date.UTC(2016, 4, 04, 17, 13, 01), 0],
      [Date.UTC(2016, 4, 04, 18, 20, 01), 1],
      [Date.UTC(2016, 4, 05, 18, 40, 01), 0],
      [Date.UTC(2016, 4, 05, 20, 05, 01), 1],
      [Date.UTC(2016, 4, 06, 21, 13, 01), 0]
    ],
    step: 'left'
  }],

  responsive: {
    rules: [{
      condition: {
        maxWidth: 500
     ...