feat: 堆叠图支持开启百分比模式

This commit is contained in:
奔跑的面条 2025-06-16 16:51:30 +08:00
parent 99366efc8c
commit a9bb5e5397
2 changed files with 12 additions and 0 deletions

View File

@ -23,6 +23,8 @@ export const option: IBarOption & { dataset?: any } = {
yField: ['value'],
seriesField: 'year',
stack: true,
// 开启百分比
percent: false,
// 业务配置后续会被转换为图表spec)
category: VChartBarStackConfig.category as ChatCategoryEnum.BAR,
xAxis: {

View File

@ -7,12 +7,22 @@
<Label :optionData="optionData"></Label>
<!-- 柱体 -->
<Bar :optionData="optionData"></Bar>
<!-- 开启百分比 -->
<CollapseItem name="百分比堆叠">
<SettingItemBox name="配置" alone>
<n-space>
<span>开启百分比堆叠</span>
<n-switch v-model:value="optionData.percent" size="small"></n-switch>
</n-space>
</SettingItemBox>
</CollapseItem>
</template>
<script setup lang="ts">
import { PropType } from 'vue'
import { VChartGlobalSetting, Axis, Label, Bar } from '@/components/Pages/VChartItemSetting'
import { vChartGlobalThemeJsonType } from '@/settings/vchartThemes/index'
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
defineProps({
optionData: {