Highcharts Demo
author(s): Torstein Hønsi
by Heena Mahour
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<div id="container" style="height: 400px"></div>
JavaScript
$(document).ready(function() {
var data = [{
"name": "P&L YTD Book",
"data": [
[1454220000000, -3562488.71],
[1456380000000, -70955610.62]
],
"yAxis": 0
}, {
"name": "Current Fair Value",
"data": [
[1454220000000, 4954645907.269999],
[1456380000000, 4980084252.619995]
],
"yAxis": 1
}];
var chartParams = {
"navigator": {
"enabled": false
},
"legend": {
"enabled": true
},
"scrollbar": {
"enabled": false
},
"yAxis": [{
"gridLineWidth": 0,
"title": {
"enabled": true,
"text": "CFV",
"align": "high",
"offset": 0,
"x": 15,
"y": 20,
"rotation": 0
},
"labels": {
"align": "left"
},
"lineWidth": 0
}, {
"gridLineWidth": 0,
"title": {
"enabled": true,
"text": "P&L Book",
"align": "high",
"offset": 0,
"x": -15,
"y": 15,
"rotation": 0
},
"labels": {
"align": "right"
},
"lineWidth": 0,
"opposite": false
}],
"series": [{
"name": "P&L Book",
"type": "spline"
}, {
"name": "CFV",
"type": "spline",
"color": "#686870"
}],
"plotOptions": {
"series": {
"dataGrouping": {
"enabled": false
}
}
}
};
if (chartParams.series) {
for (var i = 0; i < data.length; i++) {
if (chartParams.series[i]) {
data[i] = $.extend(data[i], chartParams.series[i]);
}
}
}
// create the chart
$('#container').highcharts('StockChart', {
});
})