JSFiddle - React, Tailwind, and code Playground
by epoch
HTML
<script src="http://code.highcharts.com/adapters/prototype-adapter.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<div class="graph-div" id="graph-container-fb40e4f2ec2e0acfe4b195eb84677efa"></div>
JavaScript
/**
* registers a graph for use by the system
*/
function registerGraph(uniqueKey, options) {
if (!window.charts) {
window.charts = $H();
}
if (typeof options !== 'undefined') {
// do some post-processing here for pie labels
if (options.plotOptions) {
Object.extend(options.plotOptions.pie, {
stickyTracking: false
});
if (options.plotOptions.pie.dataLabels) {
Object.extend(options.plotOptions.pie.dataLabels, {
formatter: function () {
var perc = Math.round(this.percentage);
return this.y > 0 ? '<b>' + this.y + '</b>' + (perc > 0 ? ': ' + perc + '%' : '') : null;
}
});
}
}
// add alternative grid color
Object.extend(options.yAxis, {
alternateGridColor: '#eee'
});
// add load events for chart
if (options.chart) {
Object.extend(options.chart, {
events: {
load: function (event) {
var that = this;
// signal to the document that a chart has been loaded,
// only fire after 0.1 millis to prevent a bug in highcharts
// where reloading to early would stuff up the chart display
setTimeout(function () {
document.fire('chart:loaded', {
container: options.chart.renderTo,
chart: that
});
}, 0.1);
}
}
});
}
window.charts.set(uniqueKey, new Highcharts.Chart(
options));
}
}
registerGraph('206_0_0_9', {
exporting: {
url: 'http\x3A\x2F\x2Flocalhost\x3A8084\x2FCore\x2FFileServlet',
buttons: {
...