History Results Time WIdget
by David
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
</figure>
CSS
.highcharts-figure, .highcharts-data-table table {
min-width: 310px;
max-width: 800px;
margin: 1em auto;
}
#container {
height: 400px;
}
.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: {
type: 'column',
height: 250,
title: {
text: 'Verification Results (Combined dE w/ Pass Fail)',
align: 'left',
x: 0
}
},
xAxis: {
categories: [
'Jul-22',
'Jul-23',
'Jul 24',
'Jul-25',
'Jul-26',
'Jul-27',
'Jul 28',
'Jul-29',
'Jul-30',
'Jul-31',
'Aug-01',
'Aug-02',
'Aug-03',
'Aug-04'
],
crosshair: true,
},
yAxis: {
min: 0,
title: {
text: 'Total'
},
},
tooltip: {
headerFormat: '<span style="font/size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y}</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0,
stacking: 'normal'
}
},
series: [{
name: 'Fail',
data: [2, 2, 0, 1, 0, 1, 5, 3, 1, 2, 3, 1, 1, 0],
color: 'rgb(220, 53, 69)',
events: { click: function(ev) { alert(ev); } }
},
{
name: 'Pass',
data: [6, 2, 3, 4, 1, 2, 3, 4, 5, 2, 0, 1, 3, 2],
color: 'rgb(40, 167, 69)',
events: { click: function(ev) { alert(ev); } }
}]
});