forked from github/dataease
feat(frontend):代码修改
This commit is contained in:
parent
89c3e6fe04
commit
7cc2e1a160
@ -38,33 +38,67 @@ export function basePieOption(chart_option, chart) {
|
||||
}
|
||||
// color
|
||||
y.itemStyle = {
|
||||
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
|
||||
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha),
|
||||
borderRadius: 0
|
||||
}
|
||||
y.type = 'pie'
|
||||
chart_option.series[0].data.push(y)
|
||||
}
|
||||
}
|
||||
}
|
||||
chart_option.series[0].itemStyle = {
|
||||
borderRadius: 0
|
||||
}
|
||||
// console.log(chart_option);
|
||||
componentStyle(chart_option, chart)
|
||||
return chart_option
|
||||
}
|
||||
|
||||
export function rosePieOption(chart_option, chart) {
|
||||
basePieOption(chart_option, chart)
|
||||
// 处理shape attr
|
||||
let customAttr = {}
|
||||
if (chart.customAttr) {
|
||||
customAttr = JSON.parse(chart.customAttr)
|
||||
if (customAttr.size) {
|
||||
chart_option.series[0].roseType = customAttr.size.pieRoseType
|
||||
chart_option.series[0].itemStyle = {
|
||||
borderRadius: customAttr.size.pieRoseRadius
|
||||
if (customAttr.color) {
|
||||
chart_option.color = customAttr.color.colors
|
||||
}
|
||||
// tooltip
|
||||
if (customAttr.tooltip) {
|
||||
const tooltip = JSON.parse(JSON.stringify(customAttr.tooltip))
|
||||
const reg = new RegExp('\n', 'g')
|
||||
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
|
||||
chart_option.tooltip = tooltip
|
||||
}
|
||||
}
|
||||
// 处理data
|
||||
if (chart.data) {
|
||||
chart_option.title.text = chart.title
|
||||
if (chart.data.series.length > 0) {
|
||||
chart_option.series[0].name = chart.data.series[0].name
|
||||
// size
|
||||
if (customAttr.size) {
|
||||
chart_option.series[0].radius = [customAttr.size.pieInnerRadius + '%', customAttr.size.pieOuterRadius + '%']
|
||||
chart_option.series[0].roseType = customAttr.size.pieRoseType
|
||||
}
|
||||
// label
|
||||
if (customAttr.label) {
|
||||
chart_option.series[0].label = customAttr.label
|
||||
}
|
||||
const valueArr = chart.data.series[0].data
|
||||
for (let i = 0; i < valueArr.length; i++) {
|
||||
const y = {
|
||||
name: chart.data.x[i],
|
||||
value: valueArr[i]
|
||||
}
|
||||
// color
|
||||
y.itemStyle = {
|
||||
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha),
|
||||
borderRadius: customAttr.size.pieRoseRadius
|
||||
}
|
||||
y.type = 'pie'
|
||||
chart_option.series[0].data.push(y)
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log(chart_option);
|
||||
componentStyle(chart_option, chart)
|
||||
return chart_option
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user