update charts

This commit is contained in:
Qiuxia Fan 2022-07-07 11:46:34 +08:00
parent bdc671ada8
commit 84315db9c5
3 changed files with 41 additions and 5 deletions

View File

@ -29,7 +29,15 @@ defineProps({
},
intervalTime: { type: Array as PropType<string[]>, default: () => [] },
config: {
type: Object as PropType<AreaConfig>,
type: Object as PropType<
AreaConfig & {
filters: {
value: number | string;
dataIndex: number;
sourceId: string;
};
} & { id: string }
>,
default: () => ({}),
},
});

View File

@ -13,15 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. -->
<template>
<Graph :option="option" />
<Graph :option="option" @select="clickEvent" :filters="config.filters" />
</template>
<script lang="ts" setup>
import { computed } from "vue";
import type { PropType } from "vue";
import { Event } from "@/types/events";
import { BarConfig } from "@/types/dashboard";
import { BarConfig, EventParams } from "@/types/dashboard";
/*global defineProps */
/*global defineProps, defineEmits */
const emits = defineEmits(["click"]);
const props = defineProps({
data: {
type: Object as PropType<{ [key: string]: number[] }>,
@ -31,7 +32,15 @@ const props = defineProps({
theme: { type: String, default: "light" },
itemEvents: { type: Array as PropType<Event[]>, default: () => [] },
config: {
type: Object as PropType<BarConfig>,
type: Object as PropType<
BarConfig & {
filters: {
value: number | string;
dataIndex: number;
sourceId: string;
};
} & { id: string }
>,
default: () => ({}),
},
});
@ -147,6 +156,14 @@ function getOption() {
},
enterable: true,
extraCssText: "max-height: 300px; overflow: auto; border: none",
axisPointer: {
lineStyle: {
width: 2,
},
label: {
show: false,
},
},
},
legend: {
type: "scroll",
@ -186,4 +203,7 @@ function getOption() {
series: temp,
};
}
function clickEvent(params: EventParams) {
emits("click", params);
}
</script>

View File

@ -162,6 +162,14 @@ function getOption() {
enterable: true,
confine: true,
extraCssText: "max-height: 300px; overflow: auto; border: none;",
axisPointer: {
lineStyle: {
width: 2,
},
label: {
show: false,
},
},
};
const tips = {
formatter(params: any) {