Marijuana opinion
This one has tabs below the plot
by Adam Nekola
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="max-width: 639px; height: 250px; margin: 0 auto"></div>
<div id="selected"></div>
<div id="tabs">
<div style="right:0%;"></div>
<div style="right:4%;"></div>
<div style="right:8%;"></div>
<div style="right:12%;"></div>
<div style="right:16%;"></div>
<div style="right:20%;"></div>
<div style="right:24%;"></div>
<div style="right:28%;" class="selected"></div>
<div style="right:32%;"></div>
<div style="right:36%;"></div>
<div style="right:40%;"></div>
<div style="right:44%;"></div>
<div style="right:48%;"></div>
<div style="right:52%;"></div>
<div style="right:56%;"></div>
<div style="right:60%;"></div>
<div style="right:64%;"></div>
<div style="right:68%;"></div>
<div style="right:72%;"></div>
<div style="right:76%;"></div>
</div>
CSS
#tabs {
max-width:639px;
margin:20px auto;
position:relative;
}
#tabs div {
width:24%;
border:1px solid #ccc;
background:#eee;
height:150px;
position:absolute;
border-radius:15px;
-webkit-box-shadow: 10px 0px 6px -10px rgba(0, 0, 0, 0.3);
box-shadow: 10px 0px 6px -10px rgba(0, 0, 0, 0.3);
}
#tabs div.selected {
z-index:20;
background:#f4f4f4;
-webkit-box-shadow: 0px 3px 6px 1px rgba(0, 0, 0, 0.3);
box-shadow: 0px 3px 6px 1px rgba(0, 0, 0, 0.3);
top:-15px;
}
JavaScript
$(function () {
$('#container').highcharts({
chart: {
type: 'spline'
},
title: {
text: ''
},
exporting: {
enabled: false
},
credits: {
enabled: false
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
floating: true,
backgroundColor: '#FFFFFF',
y: 45
},
xAxis: {
type: 'datetime',
plotBands: [{
from: Date.UTC(1979, 6, 18),
to: Date.UTC(1979, 12, 1),
color: 'rgba(0, 0, 0, .1)'
},{
from: Date.UTC(1984, 6, 18),
to: Date.UTC(1984, 12, 1),
color: 'rgba(0, 0, 0, .1)'
}],
labels: {
formatter: function() {
if (this.value > 1975) {
return Highcharts.dateFormat('%Y', this.value);
} else {
return null;
}
}
}
},
yAxis: {
title: {
text: ''
},
labels: {
formatter: function() {
if (this.value == 110) {
return "Events";
} else {
return this.value +'%'
}
}
},
tickPositions: [0, 50, 100, 110],
min: 0,
max: 120,
endOnTick: false,
plotBands: [{
from: 120,
to: 100,
color:...