echarts icon indicating copy to clipboard operation
echarts copied to clipboard

serie里的data用name或index定位的时候,tooltip里会多显示一项

Open apexglory opened this issue 9 years ago • 1 comments

One-line summary [问题简述]

serie里的data的数据项如果是数组,tooltip里会把数组里的值都显示出来

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]:3.6.1
  • Browser version [浏览器类型和版本]:chromium
  • OS Version [操作系统类型和版本]:win10

Expected behaviour [期望结果]

tooltip显示效果和普通data一样

ECharts option [ECharts配置项]

option = {

    title: {
        
        text: '未来一周气温变化',
        subtext: '纯属虚构'
    },
    tooltip: {
        trigger: 'axis',
       
    },
    legend: {
        left:'center',
        data:['最高气温','最低气温','平均气温']
    },
    toolbox: {
        show: true,
        feature: {
            dataZoom: {
                yAxisIndex: 'none'
            },
            dataView: {readOnly: false},
            magicType: {type: ['line', 'bar']},
            restore: {},
            saveAsImage: {}
        }
    },
    xAxis:  {
        type: 'category',
        boundaryGap: false,
        data: ['周一','周二','周三','周四','周五','周六','周日']
    },
    yAxis: {
        type: 'value',
        axisLabel: {
            formatter: '{value} °C'
        }
    },
    series: [
        {
            name:'最高气温',
            type:'line',
            data:[['周一',11],['周二',13],['周三',20],['周四',22],['周五',23]]
        },
        {
            name:'最低气温',
            type:'line',
           data:[[0,0],[1,1],[2,3],[3,2],[4,2]]
       
        },
         {
            name:'平均气温',
            type:'line',
           data:[6,8,11,12,13]
       
        }
        
        
    ]
}

Other comments [其他信息]

apexglory avatar Jun 08 '17 08:06 apexglory

是的,可以用 formatter

pissang avatar Jun 08 '17 15:06 pissang