Unverified 提交 e6e8d1db authored 作者: XiaJunjie2020's avatar XiaJunjie2020 提交者: GitHub

Merge pull request #660 from dataease/pr@dev@feat_chart_refactor

feat: 饼图、气泡图优化
...@@ -715,6 +715,12 @@ export const BASE_TREEMAP = { ...@@ -715,6 +715,12 @@ export const BASE_TREEMAP = {
{ {
// name: '', // name: '',
type: 'treemap', type: 'treemap',
itemStyle: {
gapWidth: 2
},
breadcrumb: {
show: false
},
// radius: ['0%', '60%'], // radius: ['0%', '60%'],
// avoidLabelOverlap: false, // avoidLabelOverlap: false,
// emphasis: { // emphasis: {
......
import { hexColorToRGBA } from '@/views/chart/chart/util' import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle } from '../common/common' import { componentStyle } from '../common/common'
let bubbleArray = []
export function baseScatterOption(chart_option, chart) { export function baseScatterOption(chart_option, chart) {
// 处理shape attr // 处理shape attr
let customAttr = {} let customAttr = {}
...@@ -21,6 +23,7 @@ export function baseScatterOption(chart_option, chart) { ...@@ -21,6 +23,7 @@ export function baseScatterOption(chart_option, chart) {
if (chart.data) { if (chart.data) {
chart_option.title.text = chart.title chart_option.title.text = chart.title
chart_option.xAxis.data = chart.data.x chart_option.xAxis.data = chart.data.x
bubbleArray = []
for (let i = 0; i < chart.data.series.length; i++) { for (let i = 0; i < chart.data.series.length; i++) {
const y = chart.data.series[i] const y = chart.data.series[i]
// color // color
...@@ -33,6 +36,9 @@ export function baseScatterOption(chart_option, chart) { ...@@ -33,6 +36,9 @@ export function baseScatterOption(chart_option, chart) {
const extBubble = JSON.parse(chart.extBubble) const extBubble = JSON.parse(chart.extBubble)
if (extBubble && extBubble.length > 0) { if (extBubble && extBubble.length > 0) {
y.data.forEach(ele => {
bubbleArray.push(ele.value[2])
})
y.symbolSize = funcSize y.symbolSize = funcSize
} else { } else {
y.symbolSize = customAttr.size.scatterSymbolSize ? customAttr.size.scatterSymbolSize : 20 y.symbolSize = customAttr.size.scatterSymbolSize ? customAttr.size.scatterSymbolSize : 20
...@@ -53,5 +59,7 @@ export function baseScatterOption(chart_option, chart) { ...@@ -53,5 +59,7 @@ export function baseScatterOption(chart_option, chart) {
} }
const funcSize = function(data) { const funcSize = function(data) {
return data[2] const k = 100
const max = Math.max(...bubbleArray)
return (data[2] / max) * k
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论