@ohdsi/atlascharts
Version:
Visualizations is a collection of JavaScript modules to support D3 visualizations in web-based applications
53 lines (46 loc) • 1.41 kB
HTML
<html>
<head>
<title>Visualizations: split-boxplot</title>
<link href="example.css" rel="stylesheet">
<link href="chart.css" rel="stylesheet">
</head>
<body>
<h1>Split-Boxplot Example</h1>
<div>This plot shows a split boxplot</div>
<div style="width:30%" id="plot"></div>
<hr/>
<div>Data:</div>
<textarea id="chartData" style="width:600px; height:400px">
[
{
"target": {"min": 8, "LIF":12, "q1":19, "median":22, "q3": 29, "UIF":37, "max": 60},
"compare":{"min": 1, "LIF":5, "q1":12, "median":15, "q3": 22, "UIF":30, "max": 80}
}
]
</textarea>
<button id="reload">Reload</button>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script>
<script src="../build/config.js"></script>
<script>
requirejs(['atlascharts/split-boxplot'], function(splitBoxplot) {
var cartData;
var plot = new splitBoxplot();
var target = document.querySelector('#plot');
function refreshPlot() {
chartData = JSON.parse(document.querySelector("#chartData").value);
plot.render(chartData, target, 300,65, {
boxHeight:20,
ticks: 4,
xLabel: "Type",
yLabel: "Count",
showLegend: true
});
}
document.querySelector("#reload").addEventListener("click", function() {
refreshPlot();
});
refreshPlot();
});
</script>
</body>
</html>