Spaces:
Running
Running
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one | |
or more contributor license agreements. See the NOTICE file | |
distributed with this work for additional information | |
regarding copyright ownership. The ASF licenses this file | |
to you under the Apache License, Version 2.0 (the | |
"License"); you may not use this file except in compliance | |
with the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, | |
software distributed under the License is distributed on an | |
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
KIND, either express or implied. See the License for the | |
specific language governing permissions and limitations | |
under the License. | |
--> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<script src="lib/simpleRequire.js"></script> | |
<script src="lib/config.js"></script> | |
<script src="lib/jquery.min.js"></script> | |
<script src="lib/facePrint.js"></script> | |
<script src="lib/testHelper.js"></script> | |
<script src="data/basicChartsOptions.js"></script> | |
<script src="lib/dat.gui.min.js"></script> | |
<!-- <script src="ut/lib/canteen.js"></script> --> | |
<link rel="stylesheet" href="lib/reset.css" /> | |
</head> | |
<body> | |
<style> | |
body { | |
background: #eee; | |
margin: 0; | |
text-align: center; | |
} | |
#main { | |
box-sizing: border-box; | |
margin: 0 auto; | |
width: 800px; | |
max-width: 100%; | |
text-align: center; | |
} | |
.chart { | |
height: 400px; | |
border-radius: 5px; | |
margin: 20px 0; | |
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); | |
background: #fff; | |
} | |
.dg.ac { | |
text-align: left; | |
} | |
</style> | |
<div id="main"> | |
<h1>Tests for focus and blurScope</h1> | |
</div> | |
<script> | |
require(['echarts'/*, 'map/js/china' */], function (echarts) { | |
const charts = []; | |
const seriesFocusType = { | |
pie: 'self', | |
funnel: 'self', | |
themeRiver: 'self', | |
graph: 'adjacency', | |
sankey: 'adjacency', | |
sunburst: 'descendant', | |
treemap: 'descendant', | |
tree: 'ancestor' | |
} | |
allChartsOptions.forEach(function (chartOption) { | |
if (chartOption.series[0].type === 'bar' || chartOption.series[0].type === 'line') { | |
chartOption.tooltip = { | |
trigger: 'axis' | |
} | |
} | |
chartOption.series.forEach(function (series) { | |
series.emphasis = series.emphasis || {}; | |
series.emphasis.focus = series.emphasis.focus || seriesFocusType[series.type] || 'series'; | |
series.emphasis.disabled = true; | |
if (series.renderItem) { | |
const oldRenderItem = series.renderItem; | |
series.renderItem = function () { | |
const ret = oldRenderItem.apply(this, arguments); | |
ret.focus = 'self'; | |
ret.blur = { | |
style: { | |
stroke: null | |
} | |
} | |
ret.emphasisDisabled = true; | |
return ret; | |
} | |
} | |
if (series.type === 'treemap') { | |
series.itemStyle = { | |
borderColor: 'rgba(100, 100, 200, 0.1)', | |
borderWidth: 5 | |
}; | |
series.upperLabel = { | |
show: true, | |
height: 15, | |
fontSize: 10 | |
}; | |
} | |
else if (series.type === 'line') { | |
series.endLabel = { | |
show: true | |
}; | |
series.labelLayout = { | |
hideOverlap: true | |
} | |
} | |
}); | |
const dom = document.createElement('div'); | |
dom.className = 'chart'; | |
document.querySelector('#main').appendChild(dom); | |
const chart = echarts.init(dom); | |
chart.setOption(chartOption); | |
charts.push(chart); | |
}); | |
}); | |
</script> | |
</body> | |
</html> | |