108 lines
3.5 KiB
HTML
Generated
108 lines
3.5 KiB
HTML
Generated
<!DOCTYPE html>
|
|
<!--
|
|
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="data/basicChartsOptions.js"></script>
|
|
<script src="lib/dat.gui.min.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;
|
|
}
|
|
</style>
|
|
|
|
|
|
|
|
<div id="main">
|
|
<h1>Tests ESM bundle importing in browser</h1>
|
|
</div>
|
|
|
|
<script type="module">
|
|
import * as echarts from '../dist/echarts.esm.min.js';
|
|
const charts = [];
|
|
allChartsOptions.forEach(function (chartOption) {
|
|
chartOption.series.forEach(function (series) {
|
|
series.selectedMode = 'single';
|
|
series.select = {
|
|
itemStyle: {
|
|
borderWidth: 3
|
|
}
|
|
}
|
|
|
|
if (series.renderItem) {
|
|
const oldRenderItem = series.renderItem;
|
|
series.renderItem = function () {
|
|
const ret = oldRenderItem.apply(this, arguments);
|
|
ret.focus = 'self';
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
if (series.type === 'treemap') {
|
|
series.itemStyle = {
|
|
borderColor: 'rgba(100, 100, 200, 0.1)',
|
|
};
|
|
series.nodeClick = null;
|
|
series.select = {
|
|
itemStyle: {
|
|
strokeColor: '#000',
|
|
strokeWidth: 1
|
|
}
|
|
}
|
|
}
|
|
else if (series.type === 'pie') {
|
|
series.data[0].selected = true;
|
|
}
|
|
});
|
|
const dom = document.createElement('div');
|
|
dom.className = 'chart';
|
|
document.querySelector('#main').appendChild(dom);
|
|
|
|
const chart = echarts.init(dom);
|
|
|
|
chart.setOption(chartOption);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|