feat: 设置柱状图 折线图最小值 类目数量

This commit is contained in:
huanghao1412 2024-07-17 13:50:51 +08:00
parent cc49140932
commit 06c087820f
12 changed files with 86 additions and 23 deletions

View File

@ -158,6 +158,11 @@
></n-select> ></n-select>
</setting-item> </setting-item>
</setting-item-box> </setting-item-box>
<setting-item-box name="最小值" alone v-if="xAxis.type === 'value'">
<setting-item name="">
<n-input-number v-model:value="xAxis.min" size="small"/>
</setting-item>
</setting-item-box>
</collapse-item> </collapse-item>
<template v-for="(yAxis, i) in yAxisArr" :key="i"> <template v-for="(yAxis, i) in yAxisArr" :key="i">
@ -251,6 +256,11 @@
></n-select> ></n-select>
</setting-item> </setting-item>
</setting-item-box> </setting-item-box>
<setting-item-box name="最小值" alone v-if="yAxis.type === 'value'">
<setting-item name="">
<n-input-number v-model:value="yAxis.min" size="small"/>
</setting-item>
</setting-item-box>
</collapse-item> </collapse-item>
</template> </template>
@ -375,6 +385,7 @@ const xAxis = computed(() => {
}) })
const yAxisArr = computed(() => { const yAxisArr = computed(() => {
console.log(props.optionData.yAxis)
return props.optionData.yAxis return props.optionData.yAxis
}) })

View File

@ -151,6 +151,9 @@ export const useChartCommonData = (
if(isMultiple) { if(isMultiple) {
if(Object.prototype.toString.call(data) === '[object Array]') { if(Object.prototype.toString.call(data) === '[object Array]') {
if(data.length && data[0].dimensions && data[0].source) { if(data.length && data[0].dimensions && data[0].source) {
if(typeof targetComponent.commonData.dataLength === 'number') {
data[0].source = data[0].source.slice(0, targetComponent.commonData.dataLength)
}
echartsUpdateHandle(data[0]) echartsUpdateHandle(data[0])
// 更新回调函数 // 更新回调函数
if (updateCallback) updateCallback(data) if (updateCallback) updateCallback(data)
@ -159,6 +162,9 @@ export const useChartCommonData = (
} }
else if(Object.prototype.toString.call(data) === '[object Object]'){ else if(Object.prototype.toString.call(data) === '[object Object]'){
if(data.dimensions && data.source) { if(data.dimensions && data.source) {
if(typeof targetComponent.commonData.dataLength === 'number') {
data.source = data.source.slice(0, targetComponent.commonData.dataLength)
}
echartsUpdateHandle(data) echartsUpdateHandle(data)
// 更新回调函数 // 更新回调函数
if (updateCallback) updateCallback(data) if (updateCallback) updateCallback(data)

View File

@ -33,10 +33,18 @@ export const option = {
show: true, show: true,
type: 'category' type: 'category'
}, },
yAxis: { yAxis: [
show: true, {
type: 'value' show: true,
}, type: 'value',
min: null
},
{
show: false,
type: 'value',
min: null
}
],
dataset: { ...dataJson }, dataset: { ...dataJson },
series: [seriesItem, seriesItem], series: [seriesItem, seriesItem],
allSeriesConfig: seriesItem allSeriesConfig: seriesItem

View File

@ -31,7 +31,8 @@ export const option = {
}, },
xAxis: { xAxis: {
show: true, show: true,
type: 'value' type: 'value',
min: null
}, },
yAxis: [ yAxis: [
{ {

View File

@ -59,10 +59,18 @@ export const option = {
show: true, show: true,
type: 'category' type: 'category'
}, },
yAxis: { yAxis: [
show: true, {
type: 'value' show: true,
}, type: 'value',
min: null
},
{
show: false,
type: 'value',
min: null
}
],
dataset: { ...dataJson }, dataset: { ...dataJson },
series: [barSeriesItem, lineSeriesItem] series: [barSeriesItem, lineSeriesItem]
} }

View File

@ -39,10 +39,18 @@ export const option = {
show: true, show: true,
type: 'category' type: 'category'
}, },
yAxis: { yAxis: [
show: true, {
type: 'value' show: true,
}, type: 'value',
min: null
},
{
show: false,
type: 'value',
min: null
}
],
dataset: { ...dataJson }, dataset: { ...dataJson },
series: [seriesItem, seriesItem], series: [seriesItem, seriesItem],
allSeriesConfig: seriesItem allSeriesConfig: seriesItem

View File

@ -50,10 +50,18 @@ const options = {
show: true, show: true,
type: 'category' type: 'category'
}, },
yAxis: { yAxis: [
show: true, {
type: 'value' show: true,
}, type: 'value',
min: null
},
{
show: false,
type: 'value',
min: null
}
],
dataset: { ...dataJson }, dataset: { ...dataJson },
series: [seriesItem], series: [seriesItem],
allSeriesConfig: seriesItem allSeriesConfig: seriesItem

View File

@ -51,10 +51,18 @@ export const option = {
show: true, show: true,
type: 'category' type: 'category'
}, },
yAxis: { yAxis: [
show: true, {
type: 'value' show: true,
}, type: 'value',
min: null
},
{
show: false,
type: 'value',
min: null
}
],
dataset: { ...dataJson }, dataset: { ...dataJson },
series: [seriesItem], series: [seriesItem],
allSeriesConfig: seriesItem allSeriesConfig: seriesItem

View File

@ -143,8 +143,8 @@ const alignOption = [
// const headerConfigMap: Ref<{ [k: string]: any }> = ref(props.optionData.headerConfigMap) // const headerConfigMap: Ref<{ [k: string]: any }> = ref(props.optionData.headerConfigMap)
// const headerConfig: Ref<any[]> = ref(props.optionData.headerConfig) // const headerConfig: Ref<any[]> = ref(props.optionData.headerConfig)
const headerConfigMap = computed(() => props.optionData.headerConfigMap) const headerConfigMap:Ref<any> = computed(() => props.optionData.headerConfigMap)
const headerConfig = computed(() => props.optionData.headerConfig) const headerConfig:Ref<any> = computed(() => props.optionData.headerConfig)
// const { headerConfigMap, headerConfig } = toRefs(props.optionData) as ToRefs<{ headerConfigMap: { [k: string] : MapType }, headerConfig: MapType[] }> // const { headerConfigMap, headerConfig } = toRefs(props.optionData) as ToRefs<{ headerConfigMap: { [k: string] : MapType }, headerConfig: MapType[] }>
// //

View File

@ -52,6 +52,7 @@ export const requestConfig: RequestConfigType = {
const commonData: commonDataType = { const commonData: commonDataType = {
currentSource: CurrentSourceEnum.POINTHISTORY, currentSource: CurrentSourceEnum.POINTHISTORY,
dataLength: null,
pointHistory: { pointHistory: {
enable: false, enable: false,
methods: [], methods: [],

View File

@ -374,6 +374,7 @@ export interface ManualInputSingleType {
export interface commonDataType { export interface commonDataType {
// 多数据 // 多数据
currentSource: CurrentSourceEnum currentSource: CurrentSourceEnum
dataLength: number | null
pointHistory: PointHistoryType pointHistory: PointHistoryType
energyUseHistory: EnergyUseHistoryType energyUseHistory: EnergyUseHistoryType
recordValueHistory: RecordValueHistoryType recordValueHistory: RecordValueHistoryType

View File

@ -20,6 +20,9 @@
<SinglePoint v-if="matchComponent(CurrentSourceEnum.SINGLEPOINT)"/> <SinglePoint v-if="matchComponent(CurrentSourceEnum.SINGLEPOINT)"/>
<ManualInputSingle v-if="matchComponent(CurrentSourceEnum.MANUALINPUTSINGLE)"/> <ManualInputSingle v-if="matchComponent(CurrentSourceEnum.MANUALINPUTSINGLE)"/>
</template> </template>
<setting-item-box name="数据量" :alone="true">
<n-input-number v-model:value="targetData.commonData.dataLength" size="small"/>
</setting-item-box>
<setting-item-box v-if="!matchComponent(CurrentSourceEnum.MANUALINPUT)" name="更新间隔" :alone="true"> <setting-item-box v-if="!matchComponent(CurrentSourceEnum.MANUALINPUT)" name="更新间隔" :alone="true">
<n-input-group> <n-input-group>
<n-input-number <n-input-number