我有一个显示多个时间序列的图表。不同的时间序列不会同时采样。有什么方法可以在工具提示中显示所有系列吗?在示例中,您可以看到所有序列都同时采样在两个前两个点的工具提示中。对于其余的点,仅包括1个系列。
var myChart = echarts.init(document.getElementById('main'));
var series = [{
"name": "sensor 1",
"data": [{
"value": [
"2019-02-20T11:47:44.000Z",
22.2
]
},
{
"value": [
"2019-02-20T12:03:02.000Z",
22.1
]
},
{
"value": [
"2019-02-20T12:18:19.000Z",
22.15
]
},
{
"value": [
"2019-02-20T12:33:36.000Z",
22.2
]
},
{
"value": [
"2019-02-20T12:48:53.000Z",
22.15
]
}
],
"type": "line"
},
{
"name": "sensor 2",
"data": [{
"value": [
"2019-02-20T11:47:44.000Z",
23.2
]
},
{
"value": [
"2019-02-20T12:03:02.000Z",
23.1
]
},
{
"value": [
"2019-02-20T12:22:19.000Z",
24.15
]
},
{
"value": [
"2019-02-20T12:39:36.000Z",
21.2
]
},
{
"value": [
"2019-02-20T12:52:53.000Z",
20.15
]
}
],
"type": "line"
}
]
var option = {
legend: {},
tooltip: {
trigger: 'axis',
},
xAxis: {
type: 'time'
},
yAxis: {
scale: true
},
series: series,
};
myChart.setOption(option);
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/4.0.4/echarts.min.js"></script>
<div id="main" style="width: 500px;height:400px;"></div>