feat(图表): 柱线组合图调整固定左轴为柱,右轴为线

This commit is contained in:
ulleo 2024-06-11 11:50:22 +08:00
parent b420ad1cbc
commit e1ad3a54b2
3 changed files with 12 additions and 9 deletions

View File

@ -538,6 +538,8 @@ export default {
data_preview: '数据预览',
dimension: '维度',
quota: '指标',
column_quota: '柱指标',
line_quota: '线指标',
time_dimension_or_quota: '时间维度或指标',
aggregate_time: '聚合时间纬度',
title: '标题',

View File

@ -345,7 +345,7 @@ onMounted(() => {
class="drop-style"
:class="themes === 'dark' ? 'dark-dimension-quota' : ''"
>
<el-dropdown-item @click.prevent v-if="chart.type === 'chart-mix'">
<!-- <el-dropdown-item @click.prevent v-if="chart.type === 'chart-mix'">
<el-dropdown
:effect="themes"
placement="right-start"
@ -376,7 +376,7 @@ onMounted(() => {
:class="'bar' === item.chartType ? 'content-active' : ''"
>
{{ t('chart.chart_bar') }}
<el-icon class="sub-menu-content--icon">
<el-icon class="sub-menu-content&#45;&#45;icon">
<Icon name="icon_done_outlined" v-if="'bar' === item.chartType" />
</el-icon>
</span>
@ -387,7 +387,7 @@ onMounted(() => {
:class="'line' === item.chartType ? 'content-active' : ''"
>
{{ t('chart.chart_line') }}
<el-icon class="sub-menu-content--icon">
<el-icon class="sub-menu-content&#45;&#45;icon">
<Icon name="icon_done_outlined" v-if="'line' === item.chartType" />
</el-icon>
</span>
@ -395,11 +395,10 @@ onMounted(() => {
</el-dropdown-menu>
</template>
</el-dropdown>
</el-dropdown-item>
</el-dropdown-item>-->
<el-dropdown-item
@click.prevent
v-if="!item.chartId && chart.type !== 'table-info' && item.summary !== ''"
:divided="chart.type === 'chart-mix'"
>
<el-dropdown
:effect="themes"

View File

@ -43,12 +43,12 @@ export class ColumnLineMix extends G2PlotChartView<DualAxesOptions, DualAxes> {
axisConfig = {
...this['axisConfig'],
yAxis: {
name: `${t('chart.drag_block_value_axis_left')} / ${t('chart.quota')}`,
name: `${t('chart.drag_block_value_axis_left')} / ${t('chart.column_quota')}`,
limit: 1,
type: 'q'
},
yAxisExt: {
name: `${t('chart.drag_block_value_axis_right')} / ${t('chart.quota')}`,
name: `${t('chart.drag_block_value_axis_right')} / ${t('chart.line_quota')}`,
limit: 1,
type: 'q'
}
@ -61,8 +61,10 @@ export class ColumnLineMix extends G2PlotChartView<DualAxesOptions, DualAxes> {
const left = cloneDeep(chart.data?.left?.data)
const right = cloneDeep(chart.data?.right?.data)
const data1Type = (left[0]?.type === 'bar' ? 'column' : left[0]?.type) ?? 'column'
const data2Type = (right[0]?.type === 'bar' ? 'column' : right[0]?.type) ?? 'column'
// const data1Type = (left[0]?.type === 'bar' ? 'column' : left[0]?.type) ?? 'column'
// const data2Type = (right[0]?.type === 'bar' ? 'column' : right[0]?.type) ?? 'column'
const data1Type = 'column'
const data2Type = 'line'
const data1 = defaultTo(left[0]?.data, [])
const data2 = map(defaultTo(right[0]?.data, []), d => {