diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 061d89d88f..cb75360565 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -615,7 +615,29 @@ export default { color_elegant: '淡雅', color_technology: '科技', color_simple: '简洁', - not_alpha: '不透明度' + not_alpha: '不透明度', + size: '大小', + bar_width: '柱宽', + bar_gap: '柱间隔', + adapt: '自适应', + line_width: '线宽', + line_type: '线型', + line_symbol: '折点', + line_symbol_size: '折点大小', + line_type_solid: '实线', + line_type_dashed: '虚线', + line_symbol_circle: '圆形', + line_symbol_emptyCircle: '空心圆', + line_symbol_rect: '矩形', + line_symbol_roundRect: '圆角矩形', + line_symbol_triangle: '三角形', + line_symbol_diamond: '菱形', + line_symbol_pin: '钉子', + line_symbol_arrow: '箭头', + line_symbol_none: '无', + pie_inner_radius: '内径', + pie_outer_radius: '外径', + funnel_width: '宽度' }, dataset: { datalist: '数据集', diff --git a/frontend/src/views/chart/chart/bar/bar.js b/frontend/src/views/chart/chart/bar/bar.js index 1200b1d3a3..0b6f8185af 100644 --- a/frontend/src/views/chart/chart/bar/bar.js +++ b/frontend/src/views/chart/chart/bar/bar.js @@ -15,9 +15,20 @@ export function baseBarOption(chart_option, chart) { chart_option.xAxis.data = chart.data.x for (let i = 0; i < chart.data.series.length; i++) { const y = chart.data.series[i] + // color y.itemStyle = { color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) } + // size + if (customAttr.size) { + if (customAttr.size.barDefault) { + y.barWidth = null + y.barGap = null + } else { + y.barWidth = customAttr.size.barWidth + y.barGap = customAttr.size.barGap + } + } y.type = 'bar' chart_option.legend.data.push(y.name) chart_option.series.push(y) @@ -55,9 +66,20 @@ export function horizontalBarOption(chart_option, chart) { chart_option.yAxis.data = chart.data.x for (let i = 0; i < chart.data.series.length; i++) { const y = chart.data.series[i] + // color y.itemStyle = { color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) } + // size + if (customAttr.size) { + if (customAttr.size.barDefault) { + y.barWidth = null + y.barGap = null + } else { + y.barWidth = customAttr.size.barWidth + y.barGap = customAttr.size.barGap + } + } y.type = 'bar' chart_option.legend.data.push(y.name) chart_option.series.push(y) diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index 3a0e91698e..b71fc5d14f 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -3,6 +3,18 @@ export const DEFAULT_COLOR_CASE = { colors: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'], alpha: 100 } +export const DEFAULT_SIZE = { + barDefault: true, + barWidth: 40, + barGap: 0.4, + lineWidth: 1, + lineType: 'solid', + lineSymbol: 'emptyCircle', + lineSymbolSize: 4, + pieInnerRadius: 0, + pieOuterRadius: 60, + funnelWidth: 80 +} export const BASE_BAR = { title: { text: '' diff --git a/frontend/src/views/chart/chart/funnel/funnel.js b/frontend/src/views/chart/chart/funnel/funnel.js index 96bbcf9a96..a1356619ce 100644 --- a/frontend/src/views/chart/chart/funnel/funnel.js +++ b/frontend/src/views/chart/chart/funnel/funnel.js @@ -14,13 +14,19 @@ export function baseFunnelOption(chart_option, chart) { 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].width = customAttr.size.funnelWidth + '%' + } const valueArr = chart.data.series[0].data + // max value chart_option.series[0].max = Math.max.apply(Math, valueArr) 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) } diff --git a/frontend/src/views/chart/chart/line/line.js b/frontend/src/views/chart/chart/line/line.js index 8fe395b7e7..91fa2210b5 100644 --- a/frontend/src/views/chart/chart/line/line.js +++ b/frontend/src/views/chart/chart/line/line.js @@ -15,9 +15,19 @@ export function baseLineOption(chart_option, chart) { chart_option.xAxis.data = chart.data.x for (let i = 0; i < chart.data.series.length; i++) { const y = chart.data.series[i] + // color y.itemStyle = { color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) } + // size + if (customAttr.size) { + y.symbol = customAttr.size.lineSymbol + y.symbolSize = customAttr.size.lineSymbolSize + y.lineStyle = { + width: customAttr.size.lineWidth, + type: customAttr.size.lineType + } + } y.type = 'line' chart_option.legend.data.push(y.name) chart_option.series.push(y) diff --git a/frontend/src/views/chart/chart/pie/pie.js b/frontend/src/views/chart/chart/pie/pie.js index 8739c4a0e1..f45ed8c726 100644 --- a/frontend/src/views/chart/chart/pie/pie.js +++ b/frontend/src/views/chart/chart/pie/pie.js @@ -14,12 +14,17 @@ export function basePieOption(chart_option, chart) { 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 + '%'] + } 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) } diff --git a/frontend/src/views/chart/components/ChartComponentView.vue b/frontend/src/views/chart/components/ChartComponentView.vue new file mode 100644 index 0000000000..051eba2d78 --- /dev/null +++ b/frontend/src/views/chart/components/ChartComponentView.vue @@ -0,0 +1,73 @@ + + + + + + + + + diff --git a/frontend/src/views/chart/components/ColorSelector.vue b/frontend/src/views/chart/components/shape_attr/ColorSelector.vue similarity index 93% rename from frontend/src/views/chart/components/ColorSelector.vue rename to frontend/src/views/chart/components/shape_attr/ColorSelector.vue index ba24c72721..5754baaf54 100644 --- a/frontend/src/views/chart/components/ColorSelector.vue +++ b/frontend/src/views/chart/components/shape_attr/ColorSelector.vue @@ -18,11 +18,12 @@ - - + + + {{ $t('chart.color') }} @@ -131,11 +132,20 @@ export default { padding: 6px; border: none; } +.form-item-slider>>>.el-form-item__label{ + font-size: 12px; + line-height: 38px; +} .form-item>>>.el-form-item__label{ font-size: 12px; } .el-select-dropdown__item{ padding: 0 20px; } - span{font-size: 12px} + span{ + font-size: 12px + } + .el-form-item{ + margin-bottom: 6px; + } diff --git a/frontend/src/views/chart/components/shape_attr/SizeSelector.vue b/frontend/src/views/chart/components/shape_attr/SizeSelector.vue new file mode 100644 index 0000000000..8bd0c24f4a --- /dev/null +++ b/frontend/src/views/chart/components/shape_attr/SizeSelector.vue @@ -0,0 +1,139 @@ + + + + + + + + {{ $t('chart.adapt') }} + + + + + + + + + + + + + + + + {{ $t('chart.line_type_solid') }} + {{ $t('chart.line_type_dashed') }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ $t('chart.size') }} + + + + + + + + + diff --git a/frontend/src/views/chart/group/Group.vue b/frontend/src/views/chart/group/Group.vue index a7ce7ad8cc..b07baae74e 100644 --- a/frontend/src/views/chart/group/Group.vue +++ b/frontend/src/views/chart/group/Group.vue @@ -211,7 +211,7 @@