Multi series bug in time axis line or bar chart
Only happen when data is placed inside dataset
by YeongCY
HTML
<html>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.3.1/echarts.min.js"></script>
<div id="main"></div>
</body>
</html>
CSS
#main {
width: 600px;
height: 400px;
border: 1px solid red;
}
JavaScript
var container = document.getElementById('main');
var chart = echarts.init(container);
var option = {
tooltip: {},
xAxis: {
type: 'time'
},
yAxis: {},
series: [{
name: 'value1',
/* data: [
['2020-10-13', 3],
['2020-10-14', 4],
['2020-10-15', 5]
], */
type: 'line'
},
{
name: 'value2',
/* data: [
['2020-10-13', 10],
['2020-10-14', 20],
['2020-10-15', 15]
], */
type: 'bar'
}
],
dataset: {
dimensions: ['datetime', 'value1', 'value2'],
source: [{
datetime: '2020-10-10',
value1: 100,
value2: 200
},
{
datetime: '2020-10-11',
value1: 300,
value2: 500
}
]
}
};
//plot chart
chart.setOption(option);
//context menu
chart.on('contextmenu', (params) => {
alert('contextmenu', params);
});