示例
漏斗图
PCPhonePad
<page style='padding: 10px'>
<module height='400px' style='margin: 0'>
<customchart :options='options' :beforeRender='beforeRender23'>
</customchart>
</module>
</page>
export default XPage({
data: {
options: {
series: [
{
name: '漏斗图',
type: 'funnel',
top: '30%',
bottom: '10%',
//x2: 80,
// height: {totalHeight} - y - y2,
min: 0,
max: 100,
minSize: '20%',
maxSize: '80%',
sort: 'descending',
gap: 5,
label: {
show: true,
position: 'inside',/*位置*/
color: '#fff'/*字体颜色*/
},
data: [
{
value: 20, name: '访问', itemStyle: {
color: '#57a5ff'
}
},
{value: 40, name: '咨询', itemStyle: {color: '#008aff'}},
{value: 60, name: '订单', itemStyle: {color: '#0f62fe'}},
{value: 80, name: '点击', itemStyle: {color: '#0043e7'}},
{value: 100, name: '展现', itemStyle: {color: '#0043e7'}}
]
}
]
}
},
beforeRender23 (opt/*系统默认配置*/, options/*用户传入的options*/, colors/*默认颜色配置*/, callback/*异步回调*/) {
return {
legend: {
data: ['展现', '点击', '访问', '咨询', '订单']
},
tooltip: {
trigger: 'item'
},
series: options.series
};
}
});
Attribute
参数 | 说明 | 类型 | 可选值 | 默认值 | 端 | 版本 |
---|---|---|---|---|---|---|
options | 图表配置,符合echart配置项 | string | PC/Mobile | -- |
event
参数 | 说明 | 类型 | 端 | 版本 |
---|---|---|---|---|
beforeRender | 每次渲染前处理options,参数(opt,options,color,callback,lighting高亮色 ),需要返回真实options | function | PC/Mobile | -- |
chart | chart实例,用于自定义chart事件处理 | chartInstance | PC/Mobile | -- |
beforeRender
参数 | 说明 | 类型 | 端 | 版本 |
---|---|---|---|---|
opt | 系统默认配置包含tooltip\ xAxis\ yAxis\grid\legend | String | PC/Mobile | -- |
options | 用户配置项 | function | PC/Mobile | -- |
colors | 当前渲染颜色 (使用默认即可) | Array | PC/Mobile | -- |
lighting | 高亮颜色 (使用默认即可) | Array | PC/Mobile | -- |