1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > echarts 折线图 html模板 设置ECharts折线图的提示框

echarts 折线图 html模板 设置ECharts折线图的提示框

时间:2020-01-21 17:47:00

相关推荐

echarts 折线图 html模板 设置ECharts折线图的提示框

回调函数

回调函数格式:(params: Object|Array, ticket: string, callback: (ticket: string, html: string)) => string

第一个参数params是 formatter 需要的数据集。格式如下:{

componentType: 'series',

// 系列类型

seriesType: string,

// 系列在传入的 option.series 中的 index

seriesIndex: number,

// 系列名称

seriesName: string,

// 数据名,类目名

name: string,

// 数据在传入的 data 数组中的 index

dataIndex: number,

// 传入的原始数据项

data: Object,

// 传入的数据值

value: number|Array,

// 数据图形的颜色

color: string,

// 饼图的百分比

percent: number,

//

galleryViewPath: ,

//

galleryEditorPath: ,

//

imagePath: ,

//

gl: ,

}

在trigger为'axis'的时候,或者 tooltip 被axisPointer触发的时候,params是多个系列的数据数组。其中每项内容格式同上,并且,

{

componentType: 'series',

// 系列类型

seriesType: string,

// 系列在传入的 option.series 中的 index

seriesIndex: number,

// 系列名称

seriesName: string,

// 数据名,类目名

name: string,

// 数据在传入的 data 数组中的 index

dataIndex: number,

// 传入的原始数据项

data: Object,

// 传入的数据值

value: number|Array,

// 数据图形的颜色

color: string,

}

注:ECharts 2.x 使用数组表示各参数的方式不再支持。

第二个参数ticket是异步回调标识,配合第三个参数callback使用。 第三个参数callback是异步回调,在提示框浮层内容是异步获取的时候,可以通过 callback 传入上述的ticket和html更新提示框浮层内容。

示例:formatter: function (params, ticket, callback) {

$.get('detail?name=' + params.name, function (content) {

callback(ticket, toHTML(content));

});

return 'Loading';

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。