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>
</setting-item>
</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>
<template v-for="(yAxis, i) in yAxisArr" :key="i">
@ -251,6 +256,11 @@
></n-select>
</setting-item>
</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>
</template>
@ -375,6 +385,7 @@ const xAxis = computed(() => {
})
const yAxisArr = computed(() => {
console.log(props.optionData.yAxis)
return props.optionData.yAxis
})

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -143,8 +143,8 @@ const alignOption = [
// const headerConfigMap: Ref<{ [k: string]: any }> = ref(props.optionData.headerConfigMap)
// const headerConfig: Ref<any[]> = ref(props.optionData.headerConfig)
const headerConfigMap = computed(() => props.optionData.headerConfigMap)
const headerConfig = computed(() => props.optionData.headerConfig)
const headerConfigMap:Ref<any> = computed(() => props.optionData.headerConfigMap)
const headerConfig:Ref<any> = computed(() => props.optionData.headerConfig)
// 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 = {
currentSource: CurrentSourceEnum.POINTHISTORY,
dataLength: null,
pointHistory: {
enable: false,
methods: [],

View File

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

View File

@ -20,6 +20,9 @@
<SinglePoint v-if="matchComponent(CurrentSourceEnum.SINGLEPOINT)"/>
<ManualInputSingle v-if="matchComponent(CurrentSourceEnum.MANUALINPUTSINGLE)"/>
</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">
<n-input-group>
<n-input-number