您当前的位置: 首页 >  ar

漏刻有时

暂无认证

  • 0浏览

    0关注

    717博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Echarts组件tooltip提示框formatter函数返回的HTML样式解决方案

漏刻有时 发布时间:2020-06-09 09:56:49 ,浏览量:0

在这里插入图片描述

    tooltip: {
        padding: 0,
        enterable: true,
        transitionDuration: 1,
        textStyle: {
            color: '#000',
            decoration: 'none',
        },
        // position: function (point, params, dom, rect, size) {
        //   return [point[0], point[1]];
        // },
        formatter: function(params) {
            // console.log(params)
            var tipHtml = '';
            tipHtml = '
' +'
'+''+'' +''+params.name+''+'
' +'
' +'

'+''+'' +'单位总数:'+''+toolTipData.length+''+'个'+'

' +'

'+''+'' +'总人数:'+''+toolTipData.length+''+'个'+'

' +'

'+''+'' +'总人数:'+''+toolTipData.length+''+'个'+'

' +'

'+''+'' +'总人数:'+''+toolTipData.length+''+'个'+'

' +'
'+'
'; return tipHtml; } },

    tooltip: {
        padding: 0,
        enterable: true,
        transitionDuration: 1,
        textStyle: {
            color: '#000',
            decoration: 'none',
        },
        // position: function (point, params, dom, rect, size) {
        //   return [point[0], point[1]];
        // },
        formatter: function(params) {
            // console.log(params)
            var tipHtml = '';
            tipHtml = '
' + '
' + ' ' + params.name + '' + ' 点击查看详情' + '
' + '
' + '
' + ' ' + ' 上传表格数量' + ' ' + params.data.tipData[0] + '万' + '
' + '
' + ' ' + ' 上传数据条数' + ' ' + params.data.tipData[1] + '条' + '
' + '
' + '
' + '
'; setTimeout(function() { tooltipCharts(params.name); }, 10); return tipHtml; } },
function tooltipCharts() {
    console.log(arguments[0]);
    var myChart1 = echarts.init(document.getElementById('tooltipBarId'));
    var option = {
        tooltip: {},
        dataset: {
            source: [
                ['xAxis', '201701', '201702', '201703', '201704', '201705', '201706', '201707', '201708', '201709', '20170', '201710', '20170', '201801'],
                ['amount', 41.1, 30.4, 65.1, 53.3, 83.8, 98.7, 65.1, 53.3, 41.1, 30.4, 53.3, 41.1, 53.3, 83.8]
            ]
        },
        xAxis: {
            type: 'category',
            interval: true,
            axisLabel: {
                rotate: 45
            },
            axisTick: {
                show: false
            }
        },
        yAxis: {},
        color: ['#4FA8F9', '#F5A623'],
        grid: {
            show: true,
            backgroundColor: '#FAFAFA',
            left: 30,
            right: 20,
            top: 20
        },
        series: [{
            type: 'bar',
            smooth: true,
            seriesLayoutBy: 'row',
            barWidth: 10
        }]
    };
    myChart1.setOption(option);
}

Done!

关注
打赏
1661217259
查看更多评论
立即登录/注册

微信扫码登录

0.0494s