blob: 72c0c9e6dcd419f5556066957fe70725c5a133de [file] [log] [blame]
<html>
<head>
<meta charset="utf-8">
<script src="../common/esl.js"></script>
<script src="../common/config.js"></script>
<link rel="stylesheet" href="../common/reset.css">
<link rel="stylesheet" href="../common/simpleRadio.css">
</head>
<body>
<style>
#main {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
}
</style>
<div id="main"></div>
<script>
var chart;
var rawData;
require([
'data/option.json',
'echarts',
'common/dark'
], function (d, echarts) {
rawData = d;
initEcharts(echarts);
});
function initEcharts(echarts) {
chart = echarts.init(document.getElementById('main'), 'dark');
function convert(source, target, basePath) {
for (var key in source) {
var path = basePath ? (basePath + '.' + key) : key;
if (!key.match(/^\$/)) {
target.children = target.children || [];
var child = {
name: path
};
target.children.push(child);
convert(source[key], child, path);
}
}
if (!target.children) {
target.value = source.$count || 1;
}
else {
target.children.push({
name: basePath,
value: source.$count
});
}
}
var data = [];
convert(rawData, data, '');
chart.setOption({
title: {
text: 'ECharts 配置项查询分布',
subtext: '2016/04',
left: 'center'
},
tooltip: {},
series: [{
name: 'option',
type: 'treemap',
visibleMin: 300,
data: data.children,
leafDepth: 2,
levels: [
{
itemStyle: {
normal: {
borderColor: '#555',
borderWidth: 4,
gapWidth: 4
}
}
},
{
colorSaturation: [0.3, 0.6],
itemStyle: {
normal: {
borderColorSaturation: 0.7,
gapWidth: 2,
borderWidth: 2
}
}
},
{
colorSaturation: [0.3, 0.5],
itemStyle: {
normal: {
borderColorSaturation: 0.6,
gapWidth: 1
}
}
},
{
colorSaturation: [0.3, 0.5]
}
]
}]
});
}
</script>
</body>
</html>