|
|
|
@ -22,56 +22,57 @@
|
|
|
|
|
const color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc']; |
|
|
|
|
|
|
|
|
|
const cfe = { |
|
|
|
|
//demotype为自定义图表类型
|
|
|
|
|
"type": ["pie", "ring", "rose", "funnel", "line", "column", "area", "radar", "gauge","candle","demotype"], |
|
|
|
|
//增加自定义图表类型,如果需要categories,请在这里加入您的图表类型例如最后的"demotype"
|
|
|
|
|
"categories": ["line", "column", "area", "radar", "gauge", "candle","demotype"], |
|
|
|
|
//instance为实例变量承载属性,option为eopts承载属性,不要删除
|
|
|
|
|
//demotype为自定义图表类型
|
|
|
|
|
"type": ["pie", "ring", "rose", "funnel", "line", "column", "area", "radar", "gauge", "candle", "demotype"], |
|
|
|
|
//增加自定义图表类型,如果需要categories,请在这里加入您的图表类型例如最后的"demotype"
|
|
|
|
|
"categories": ["line", "column", "area", "radar", "gauge", "candle", "demotype"], |
|
|
|
|
//instance为实例变量承载属性,option为eopts承载属性,不要删除
|
|
|
|
|
"instance": {}, |
|
|
|
|
"option": {}, |
|
|
|
|
//下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
|
|
|
|
|
"formatter":{ |
|
|
|
|
"tooltipDemo1":function(res){ |
|
|
|
|
let result = '' |
|
|
|
|
for (let i in res) { |
|
|
|
|
if (i == 0) { |
|
|
|
|
result += res[i].axisValueLabel + '年销售额' |
|
|
|
|
} |
|
|
|
|
let value = '--' |
|
|
|
|
if (res[i].data !== null) { |
|
|
|
|
value = res[i].data |
|
|
|
|
} |
|
|
|
|
// #ifdef H5
|
|
|
|
|
result += '\n' + res[i].seriesName + ':' + value + ' 万元' |
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
result += '<br/>' + res[i].marker + res[i].seriesName + ':' + value + ' 万元' |
|
|
|
|
// #endif
|
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
}, |
|
|
|
|
legendFormat:function(name){ |
|
|
|
|
return "自定义图例+"+name; |
|
|
|
|
}, |
|
|
|
|
yAxisFormatDemo:function (value, index) { |
|
|
|
|
return value + '元'; |
|
|
|
|
}, |
|
|
|
|
seriesFormatDemo:function(res){ |
|
|
|
|
return res.name + '年' + res.value + '元'; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在eopts参数,会将demotype与eopts中option合并后渲染图表。
|
|
|
|
|
"demotype":{ |
|
|
|
|
"color": color, |
|
|
|
|
//在这里填写echarts的option即可
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//下面是自定义配置,请添加项目所需的通用配置
|
|
|
|
|
//下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
|
|
|
|
|
"formatter": { |
|
|
|
|
"tooltipDemo1": function(res) { |
|
|
|
|
let result = '' |
|
|
|
|
for (let i in res) { |
|
|
|
|
if (i == 0) { |
|
|
|
|
result += res[i].axisValueLabel + '年销售额' |
|
|
|
|
} |
|
|
|
|
let value = '--' |
|
|
|
|
if (res[i].data !== null) { |
|
|
|
|
value = res[i].data |
|
|
|
|
} |
|
|
|
|
// #ifdef H5
|
|
|
|
|
result += '\n' + res[i].seriesName + ':' + value + ' 万元' |
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
result += '<br/>' + res[i].marker + res[i].seriesName + ':' + value + ' 万元' |
|
|
|
|
// #endif
|
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
}, |
|
|
|
|
legendFormat: function(name) { |
|
|
|
|
return "自定义图例+" + name; |
|
|
|
|
}, |
|
|
|
|
yAxisFormatDemo: function(value, index) { |
|
|
|
|
return value + '元'; |
|
|
|
|
}, |
|
|
|
|
seriesFormatDemo: function(res) { |
|
|
|
|
return res.name + '年' + res.value + '元'; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在eopts参数,会将demotype与eopts中option合并后渲染图表。
|
|
|
|
|
"demotype": { |
|
|
|
|
"color": color, |
|
|
|
|
//在这里填写echarts的option即可
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//下面是自定义配置,请添加项目所需的通用配置
|
|
|
|
|
"column": { |
|
|
|
|
"color": color, |
|
|
|
|
"title": { |
|
|
|
|
"text": '' |
|
|
|
|
"text": '', |
|
|
|
|
"fontFamoly": 'Tahoma' |
|
|
|
|
}, |
|
|
|
|
"tooltip": { |
|
|
|
|
"trigger": 'axis' |
|
|
|
@ -122,7 +123,7 @@ const cfe = {
|
|
|
|
|
"barwidth": 20, |
|
|
|
|
"label": { |
|
|
|
|
"show": true, |
|
|
|
|
"color": "#666666", |
|
|
|
|
"color": "#666666", |
|
|
|
|
"position": 'top', |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -181,7 +182,7 @@ const cfe = {
|
|
|
|
|
"barwidth": 20, |
|
|
|
|
"label": { |
|
|
|
|
"show": true, |
|
|
|
|
"color": "#666666", |
|
|
|
|
"color": "#666666", |
|
|
|
|
"position": 'top', |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -240,7 +241,7 @@ const cfe = {
|
|
|
|
|
"areaStyle": {}, |
|
|
|
|
"label": { |
|
|
|
|
"show": true, |
|
|
|
|
"color": "#666666", |
|
|
|
|
"color": "#666666", |
|
|
|
|
"position": 'top', |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -266,10 +267,10 @@ const cfe = {
|
|
|
|
|
"name": '', |
|
|
|
|
"type": 'pie', |
|
|
|
|
"data": [], |
|
|
|
|
"radius": '50%', |
|
|
|
|
"radius": '100%', |
|
|
|
|
"label": { |
|
|
|
|
"show": true, |
|
|
|
|
"color": "#666666", |
|
|
|
|
"color": "#666666", |
|
|
|
|
"position": 'top', |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
@ -277,7 +278,8 @@ const cfe = {
|
|
|
|
|
"ring": { |
|
|
|
|
"color": color, |
|
|
|
|
"title": { |
|
|
|
|
"text": '' |
|
|
|
|
"text": '', |
|
|
|
|
"fontFamoly": 'Tahoma' |
|
|
|
|
}, |
|
|
|
|
"tooltip": { |
|
|
|
|
"trigger": 'item' |
|
|
|
@ -295,11 +297,11 @@ const cfe = {
|
|
|
|
|
"name": '', |
|
|
|
|
"type": 'pie', |
|
|
|
|
"data": [], |
|
|
|
|
"radius": ['40%', '70%'], |
|
|
|
|
"radius": ['40%', '100%'], |
|
|
|
|
"avoidLabelOverlap": false, |
|
|
|
|
"label": { |
|
|
|
|
"show": true, |
|
|
|
|
"color": "#666666", |
|
|
|
|
"color": "#666666", |
|
|
|
|
"position": 'top', |
|
|
|
|
}, |
|
|
|
|
"labelLine": { |
|
|
|
@ -378,13 +380,18 @@ const cfe = {
|
|
|
|
|
"gauge": { |
|
|
|
|
"color": color, |
|
|
|
|
"tooltip": { |
|
|
|
|
"formatter": '{a} <br/>{b} : {c}%' |
|
|
|
|
}, |
|
|
|
|
"formatter": '{a} <br/>{b} : {c}%' |
|
|
|
|
}, |
|
|
|
|
"seriesTemplate": { |
|
|
|
|
"name": '业务指标', |
|
|
|
|
"type": 'gauge', |
|
|
|
|
"detail": {"formatter": '{value}%'}, |
|
|
|
|
"data": [{"value": 50, "name": '完成率'}] |
|
|
|
|
"type": 'gauge', |
|
|
|
|
"detail": { |
|
|
|
|
"formatter": '{value}%' |
|
|
|
|
}, |
|
|
|
|
"data": [{ |
|
|
|
|
"value": 50, |
|
|
|
|
"name": '完成率' |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
"candle": { |
|
|
|
|