@@ -5,6 +5,7 @@ import {computed, nextTick, ref} from "vue";
55import type {TabsPaneContext } from ' element-plus-secondary'
66import {Loading } from " @element-plus/icons-vue" ;
77import Component from " ./component/Component.vue"
8+ import type {ChartTypes } from " @/views/chat/component/BaseChart.ts" ;
89
910const props = defineProps <{
1011 message? : ChatMessage
@@ -43,9 +44,13 @@ const dataObject = computed<{
4344})
4445
4546const chartObject = computed <{
46- type: " table " | " bar " | " line " | " pie "
47+ type: ChartTypes
4748 title: string
48- axis: { x: { name: string , value: string }, y: { name: string , value: string } }
49+ axis: {
50+ x: { name: string , value: string },
51+ y: { name: string , value: string },
52+ series: { name: string , value: string }
53+ }
4954 columns: Array <{ name: string , value: string }>
5055}>(() => {
5156 if (props .message ?.record ?.chart ) {
@@ -66,10 +71,16 @@ const yAxis = computed(() => {
6671 }
6772 return []
6873})
74+ const series = computed (() => {
75+ if (chartObject .value ?.axis ?.series ) {
76+ return [chartObject .value .axis .series ]
77+ }
78+ return []
79+ })
6980
70- const currentChartType = ref <" table " | " bar " | ' column ' | " line " | " pie " | undefined >(undefined )
81+ const currentChartType = ref <ChartTypes | undefined >(undefined )
7182
72- const chartType = computed <" table " | " bar " | ' column ' | " line " | " pie " >({
83+ const chartType = computed <ChartTypes >({
7384 get() {
7485 if (currentChartType .value ) {
7586 return currentChartType .value
@@ -158,6 +169,7 @@ function onTypeChange(type: string) {
158169 :columns =" chartObject?.columns"
159170 :x =" xAxis"
160171 :y =" yAxis"
172+ :series =" series"
161173 :data =" dataObject.data" />
162174 </div >
163175 </div >
@@ -189,6 +201,6 @@ function onTypeChange(type: string) {
189201
190202.chart-base-container {
191203 padding : 20px ;
192- background : rgba (224 ,224 ,226 ,0.29 );
204+ background : rgba (224 , 224 , 226 , 0.29 );
193205}
194206 </style >
0 commit comments