Marijuana opinion
This one is a combo chart,
by Adam Nekola
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<button id="prev">Prev</button>
<button id="next">Next</button>
<div id="container" style="max-width: 639px; height: 300px; margin: 0 auto"></div>
<div id="timelineContent">
<div id="div0">
<p class="date">Aug. 15-18, 1969</p>
<p class="text">The outdoor music festival Woodstock draws hundreds of thousands of music fans to New York. Marijuana permeates the festival.</p>
<p class="source">Source: <a href=""></a></p>
</div>
<div id="div1">
<p class="date">Oct. 27, 1970</p>
<p class="text">Controlled Substances Act lists marijuana as a Schedule I drug, a class of drugs that have a high potential for abuse and no accepted medical use.</p>
<p class="source">Source</p>
</div>
</div>
CSS
#timelineContent {
max-width: 639px;
margin: 0 auto;
}
#timelineContent div {
display: none;
font-family:sans-serif;
padding:0 20px;
}
#timelineContent #div0 {
display:block;
}
#timelineContent .date {
text-transform:uppercase;
color:#aaa;
font-size:0.8em;
}
#timelineContent .text {
line-height:1.5em;
}
#timelineContent .source {
color:#aaa;
font-size:0.8em;
font-style:italic;
}
JavaScript
$(function () {
$('#container').highcharts({
chart: {
},
title: {
text: ''
},
exporting: {
enabled: false
},
credits: {
enabled: false
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
floating: true,
backgroundColor: '#FFFFFF',
y: 45
},
xAxis: {
type: 'datetime'
},
yAxis: {
title: {
text: ''
},
labels: {
formatter: function() {
return this.value +'%'
}
},
min: 0,
max: 120,
endOnTick: false,
gridLineDashStyle: 'shortDot',
plotBands: [{
from: 120,
to: 100,
color: 'rgba(242, 242, 242, 1)'
}]
},
tooltip: {
crosshairs: true,
shared: true,
formatter: function() {
if (this.points[0].series.name != "Events" && this.points[0].series.name != "Bars") {
var s = '<b>'+ Highcharts.dateFormat('%Y', this.x) +'</b>';
$.each(this.points, function(i, point) {
s += '<br/>'+ point.series.name +': '+
point.y +'%';
});
return s;
}
else return false;
},
positioner: function (boxWidth, boxHeight, point) {
if (point.plotX < 50 ) {
xpoint = point.plotX+60;
...