我想通过 highcharts 精确地构建这种类型的图表。
请点击链接 -像这张图
我已经建立了一些东西 - mygraph
但我需要用不同的颜色填充整个列,x 轴标签将在悬停时显示。
$(function() {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column',
height: 400,
},
plotOptions: {
column: {
stacking: 'normal'
}
},
tooltip: {
//xDateFormat: '%Y-%m-%d',
formatter: function() {
return "Click to see all coverage from - " + Highcharts.dateFormat("%b %d", this.x)
},
positioner: function(boxWidth, boxHeight, point) {
return {
x: point.plotX,
y: point.plotY
};
},
},
xAxis: {
gridLineWidth: 0,
type: 'datetime',
dateTimeLabelFormats: {
day: ' %b %e, %Y'
}
},
yAxis: {
gridLineWidth: 1,
title: {
text: ''
},
labels: {
enabled: true
}
},
legend: {
enabled: false
},
series: [{
data: [50, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
pointStart: Date.UTC(2010, 0, 1),
pointInterval: 24 * 3600 * 1000 // one day
}],
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px; width: 500px"></div>