Skip to content

Instantly share code, notes, and snippets.

@VioletVivirand
Created April 25, 2017 08:41
Show Gist options
  • Save VioletVivirand/996d3e7b715c03363de7ce9e506dfa6d to your computer and use it in GitHub Desktop.
Save VioletVivirand/996d3e7b715c03363de7ce9e506dfa6d to your computer and use it in GitHub Desktop.
Highchart Demo
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<!-- Additional files for the Highslide popup effect -->
<script src="https://www.highcharts.com/media/com_demo/js/highslide-full.min.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<script>
$.getJSON('https://gist.githubusercontent.com/VioletVivirand/74cb28602595c2a18d8c9de77ebabe78/raw/a8a4567d9f1399ca206add3dd25826e2e0759b23/timedata.json', function(data) {
Highcharts.chart('container', {
chart: {
zoomType: 'x'
},
title: {
text: 'USD to EUR exchange rate over time'
},
subtitle: {
text: document.ontouchstart === undefined ?
'Click and drag in the plot area to zoom in' : 'Pinch the chart to zoom in'
},
xAxis: {
type: 'datetime'
},
yAxis: {
title: {
text: 'Exchange rate'
}
},
legend: {
enabled: false
},
plotOptions: {
area: {
fillColor: {
linearGradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops: [
[0, Highcharts.getOptions().colors[0]],
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
]
},
marker: {
radius: 2
},
lineWidth: 1,
states: {
hover: {
lineWidth: 1
}
},
threshold: null
}
},
series: [{
type: 'area',
name: 'USD to EUR',
data: data
}]
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment