您当前的位置: 首页 >  ar

漏刻有时

暂无认证

  • 0浏览

    0关注

    717博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Echarts参数属性学习:formatter字符串&返回函数的实战案例

漏刻有时 发布时间:2020-02-08 12:02:03 ,浏览量:0

formatter内容格式器,支持字符串模板和回调函数两种形式。 回调函数格式:(params: Object|Array, ticket: string, callback: (ticket: string, html: string)) => string

{
    componentType: 'series',
    // 系列类型
    seriesType: string,
    // 系列在传入的 option.series 中的 index
    seriesIndex: number,
    // 系列名称
    seriesName: string,
    // 数据名,类目名
    name: string,
    // 数据在传入的 data 数组中的 index
    dataIndex: number,
    // 传入的原始数据项
    data: Object,
    // 传入的数据值。在多数系列下它和 data 相同。在一些系列下是 data 中的分量(如 map、radar 中)
    value: number|Array|Object,
    // 坐标轴 encode 映射信息,
    // key 为坐标轴(如 'x' 'y' 'radius' 'angle' 等)
    // value 必然为数组,不会为 null/undefied,表示 dimension index 。
    // 其内容如:
    // {
    //     x: [2] // dimension index 为 2 的数据映射到 x 轴
    //     y: [0] // dimension index 为 0 的数据映射到 y 轴
    // }
    encode: Object,
    // 维度名列表
    dimensionNames: Array,
    // 数据的维度 index,如 0 或 1 或 2 ...
    // 仅在雷达图中使用。
    dimensionIndex: number,
    // 数据图形的颜色
    color: string,

    // 饼图的百分比
    percent: number,

}

示例A:

        formatter: function (obj) {
            var value = obj.value;
            return '
' + obj.seriesName + ' ' + value[0] + '日:' + value[7] + '
' + schema[1].text + ':' + value[1] + '' + schema[2].text + ':' + value[2] + '' + schema[3].text + ':' + value[3] + '' + schema[4].text + ':' + value[4] + '' + schema[5].text + ':' + value[5] + '' + schema[6].text + ':' + value[6] + ''; }
关注
打赏
1661217259
查看更多评论
立即登录/注册

微信扫码登录

0.0402s