<!--
|
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">
|
<script src="lib/esl.js"></script>
|
<script src="lib/config.js"></script>
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
</head>
|
|
<body>
|
<style>
|
html,
|
body,
|
#main1,
|
#main2,
|
#main3 {
|
width: 100%;
|
height: 250px;
|
margin: 0;
|
}
|
|
.test-title {
|
background: #146402;
|
padding: 10px;
|
color: #fff;
|
}
|
|
button {
|
padding: 10px 20px;
|
margin: 10px;
|
}
|
</style>
|
|
<div class="test-title">Animation: Transition from previous state to new state, in 10 seconds after clicking Go</div>
|
<button id="btn1">Go</button>
|
<div id="main1"></div>
|
|
<div class="test-title">Animation: Transition all over again, in 10 seconds after clicking Go</div>
|
<button id="btn2">Go</button>
|
<div id="main2"></div>
|
|
<div class="test-title">Should display labels on emphasis if no animation</div>
|
<div id="main3"></div>
|
|
<script>
|
|
require([
|
'echarts'
|
], function (echarts) {
|
|
|
var chart = echarts.init(
|
document.getElementById('main1'),
|
null,
|
{
|
renderer: 'svg'
|
}
|
);
|
var data = [
|
{"name": "a1", "value": 92386},
|
{"name": "b1", "value": 90611},
|
{"name": "c1", "value": 12596},
|
{"name": "d1", "value": 9438},
|
{"name": "e1", "value": 10049}
|
];
|
var data2 = [
|
{"name": "a1", "value": 120},
|
{"name": "b1", "value": 200},
|
{"name": "c1", "value": 300},
|
{"name": "x1", "value": 20},
|
{"name": "y1", "value": 30}
|
];
|
|
var option = {
|
series: [{
|
type: 'pie',
|
animationDuration: 1000,
|
animationDurationUpdate: 10000,
|
startAngle: 0,
|
endAngle: 360,
|
radius: ['50%', '80%'],
|
center: ['40%', '50%'],
|
data: data
|
}]
|
};
|
chart.setOption(option);
|
|
document.getElementById('btn1').addEventListener('click', function () {
|
option.series[0].data = data2;
|
chart.setOption(option, true);
|
});
|
});
|
|
</script>
|
|
|
|
|
|
<script>
|
|
require([
|
'echarts'
|
], function (echarts) {
|
|
|
var chart = echarts.init(
|
document.getElementById('main2'),
|
null,
|
{
|
renderer: 'svg'
|
}
|
);
|
var data = [
|
{"name": "a1", "value": 92386},
|
{"name": "b1", "value": 90611},
|
{"name": "c1", "value": 12596},
|
{"name": "d1", "value": 9438},
|
{"name": "e1", "value": 10049}
|
];
|
var data2 = [
|
{"name": "a1", "value": 120},
|
{"name": "b1", "value": 200},
|
{"name": "c1", "value": 300},
|
{"name": "x1", "value": 20},
|
{"name": "y1", "value": 30}
|
];
|
|
var option = {
|
series: [{
|
type: 'pie',
|
animationType: 'expansion',
|
animationDuration: 1000,
|
animationDurationUpdate: 10000,
|
animationTypeUpdate: 'expansion',
|
startAngle: 0,
|
endAngle: 360,
|
radius: ['50%', '80%'],
|
center: ['40%', '50%'],
|
data: data
|
}]
|
};
|
chart.setOption(option);
|
|
document.getElementById('btn2').addEventListener('click', function () {
|
option.series[0].data = data2;
|
chart.setOption(option, true);
|
});
|
});
|
|
</script>
|
|
|
|
<script>
|
|
require([
|
'echarts'
|
], function (echarts) {
|
var chart = echarts.init(
|
document.getElementById('main3'),
|
null,
|
{
|
renderer: 'svg'
|
}
|
);
|
|
var option = {
|
"series": [
|
{
|
"type": "pie",
|
"radius": ["40%", "70%"],
|
"animation": false,
|
"label": {
|
"show": false,
|
"emphasis": {
|
"show": true,
|
"textStyle": {
|
"fontSize": "50"
|
}
|
}
|
},
|
"data": [
|
{"value": 335, "name": "A"}
|
]
|
}
|
]
|
};
|
chart.setOption(option);
|
});
|
|
</script>
|
</body>
|
|
</html>
|