You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.7 KiB

6 years ago
<html>
<header><title>Wownero difficulty chart</title>
<!-- Styles -->
<style>
#chartdiv {
width : 100%;
height : 500px;
}
</style>
<!-- Resources -->
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
<script src="wownero-data-0.js"></script>
<!-- Chart code -->
<script>
var chartData = chartData_0;
chartData.shift();
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "light",
"marginRight": 80,
"autoMarginOffset": 20,
"marginTop": 7,
"dataProvider": chartData,
"valueAxes": [{
"axisAlpha": 0.2,
"dashLength": 1,
"position": "left",
"logarithmic": true
}],
"mouseWheelZoomEnabled": true,
"graphs": [{
"id": "g1",
"balloonText": "Diff: <b>[[value]]</b>\nHeight: <b>[[height]]</b>",
"bullet": "round",
"bulletBorderAlpha": 1,
"bulletColor": "#FFFFFF",
"hideBulletsCount": 50,
"title": "red line",
"valueField": "difficulty",
"useLineColorForBulletBorder": true,
"balloon":{
"cornerRadius": 10,
}
}],
"chartScrollbar": {
"autoGridCount": true,
"graph": "g1",
"scrollbarHeight": 40
},
"chartCursor": {
"limitToGraph":"g1",
"pan": false
},
"categoryField": "date",
"categoryAxis": {
"parseDates": true,
"minPeriod": "ss",
"axisColor": "#DADADA",
"dashLength": 1,
"minorGridEnabled": true
},
"export": {
"enabled": true
}
});
chart.addListener("rendered", zoomChart);
zoomChart();
// this method is called when chart is first inited as we listen for "rendered" event
function zoomChart() {
// different zoom methods can be used - zoomToIndexes, zoomToDates, zoomToCategoryValues
chart.zoomToIndexes(0, chartData.length - 1);
}
function toggleLogScale() {
chart.valueAxes[0].logarithmic = document.getElementById("log_scale").checked;
chart.validateNow();
}
function togglePan() {
chart.chartCursor.pan = document.getElementById("pan").checked;
}
</script>
</header>
<body>
<h1>Wownero difficulty chart</h1>
<div id="chartdiv"></div>
<p><input type="checkbox" id="log_scale" onclick="toggleLogScale()" checked>Log scale</p>
<p><input type="checkbox" id="pan" onclick="togglePan()">Enable panning</p>
</body>
</html>