Ecarts move the mouse up to display the data

Time:2021-9-3

Line chart as an example, core code

//Initialize the ecarts instance based on the prepared dom
    var myChart = echarts.init(document.getElementById('latest_pv'));

    //Specify configuration items and data for the chart
    var option = {
        xAxis: {
            type: 'category',
            data: ['{$d1}', '{$d2}', '{$d3}', '{$d4}', '{$d5}', '{$d6}', '{$d7}']
        },
        yAxis: {
            type: 'value'
        },
        series: [{
            data: [{$uv1}, {$uv2}, {$uv3}, {$uv4}, {$uv5}, {$uv6}, {$uv7}],
            type: 'line'
        }],
        tooltip : {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                label: {
                    backgroundColor: '#6a7985'
                }
            }
        }
        };

    //Display the chart using the configuration item and data you just specified.
    myChart.setOption(option);

 

effect