@@ -9,6 +9,7 @@ import * as echarts from 'echarts/core';
99import {
1010 Button ,
1111 Dialog ,
12+ Form ,
1213 Label ,
1314 Popover ,
1415 Select ,
@@ -304,7 +305,7 @@ const ChartGenVizPreview = ({ params }: { params: any }) => {
304305 refetch : any ;
305306 error : any ;
306307 isError : boolean ;
307- } = useQuery ( [ `chartDetailsForViz` ] , ( ) =>
308+ } = useQuery ( [ `chartDetailsForViz- ${ JSON . stringify ( chartData ) } ` ] , ( ) =>
308309 GraphQL (
309310 getResourceChartForViz ,
310311 {
@@ -320,8 +321,6 @@ const ChartGenVizPreview = ({ params }: { params: any }) => {
320321 if ( chartDetailsRes ?. data ?. resourceChart ) {
321322 const chartRes = chartDetailsRes ?. data ?. resourceChart ;
322323
323- console . log ( 'chartData updated :::::::::' , chartRes ) ;
324-
325324 setChartData ( {
326325 chartId : params . chartID ,
327326 name : chartRes ?. name ,
@@ -447,7 +446,11 @@ const ChartGenVizPreview = ({ params }: { params: any }) => {
447446 chartId : params . chartID ,
448447 resource : value ,
449448 name : chartData . name ,
450- options : chartData . options ,
449+ options : {
450+ ...chartData . options ,
451+ xAxisColumn : '' ,
452+ yAxisColumn : [ ] ,
453+ } ,
451454 type : chartData . type ,
452455 filters : chartData . filters ,
453456 } ,
@@ -679,22 +682,25 @@ const ChartGenVizPreview = ({ params }: { params: any }) => {
679682
680683 < div className = "border-t-2 border-solid border-greyExtralight pt-8" >
681684 < div className = "flex flex-row justify-center gap-6" >
682- < div className = "flex flex-[7] justify-center" >
683- < div className = "w-full rounded-4 border-1 border-solid border-greyExtralight object-contain" >
684- { chartData . chart ?. options &&
685- Object . keys ( chartData . chart ?. options ) . length > 0 ? (
685+ { /* Chart Preview */ }
686+ < div className = "flex-[7]" >
687+ { chartData . chart ?. options &&
688+ Object . keys ( chartData . chart ?. options ) . length > 0 ? (
689+ < div className = "sticky top-36 w-full items-center rounded-4 border-1 border-solid border-greyExtralight" >
686690 < ReactECharts
687691 option = { chartData . chart ?. options }
688692 ref = { chartRef }
689693 />
690- ) : (
691- < div className = "h-full w-full" >
692- < Text variant = "bodyLg" > No Chart Data </ Text >
693- </ div >
694- ) }
695- </ div >
694+ </ div >
695+ ) : (
696+ < div className = "sticky top-36 flex w-full items-center justify-center" >
697+ < Text variant = "bodyLg" > No Valid Chart Data </ Text >
698+ </ div >
699+ ) }
696700 </ div >
697- < div className = "flex flex-[3] flex-col rounded-4 border-2 border-solid border-greyExtralight p-3" >
701+
702+ { /* Chart Customization */ }
703+ < div className = "flex h-full flex-[3] flex-col rounded-4 border-2 border-solid border-greyExtralight p-3" >
698704 < Tabs value = { selectedTab } >
699705 < TabList fitted border >
700706 < Tab
@@ -902,11 +908,6 @@ const ChartGenVizPreview = ({ params }: { params: any }) => {
902908 columnLabel = { '' }
903909 columnColor = { '' }
904910 onSubmit = { ( e ) => {
905- console . log (
906- 'addYAxisColumn :::::::::' ,
907- e ,
908- chartData . options . yAxisColumn
909- ) ;
910911 if (
911912 chartData . options . yAxisColumn === undefined ||
912913 chartData . options . yAxisColumn ?. findIndex (
@@ -1053,62 +1054,65 @@ const YaxisColumnForm = ({
10531054
10541055 return (
10551056 < div className = "flex w-full min-w-full flex-col gap-1 p-8" >
1056- { /* Y axis Column */ }
1057- < Select
1058- name = "selectYAxisColumn"
1059- label = "Column"
1060- options = { yAxisOptions }
1061- value = { yAxisColumn }
1062- onChange = { ( e ) => {
1063- setYAxisColumn ( e ) ;
1064- } }
1065- />
1066-
1067- { /* Label for specific element */ }
1068- < TextField
1069- name = "selectYAxisColumnLabel"
1070- label = "Label"
1071- value = { yAxisColumnLabel }
1072- onChange = { ( e ) => {
1073- setYAxisColumnLabel ( e ) ;
1074- } }
1075- />
1076-
1077- { /* Color for specific element */ }
1078- < TextField
1079- name = "selectYAxisColumnColor"
1080- label = "Color"
1081- value = { yAxisColumnColor }
1082- onChange = { ( e ) => {
1083- setYAxisColumnColor ( e ) ;
1084- } }
1085- />
1086-
1087- < div className = "mt-1 flex flex-row justify-between gap-8" >
1088- < Button
1089- kind = "secondary"
1090- size = "slim"
1091- className = "rounded-2 border-1 border-solid border-greyExtralight"
1092- onClick = { onCancel }
1093- >
1094- Cancel
1095- </ Button >
1096-
1097- < Button
1098- kind = "primary"
1099- size = "slim"
1100- className = "rounded-2 border-1 border-solid border-greyExtralight"
1101- onClick = { ( ) => {
1102- onSubmit ( {
1103- fieldName : yAxisColumn ,
1104- label : yAxisColumnLabel ,
1105- color : yAxisColumnColor ,
1106- } ) ;
1057+ < Form >
1058+ { /* Y axis Column */ }
1059+ < Select
1060+ name = "selectYAxisColumn"
1061+ label = "Column"
1062+ options = { yAxisOptions }
1063+ value = { yAxisColumn }
1064+ onChange = { ( e ) => {
1065+ setYAxisColumn ( e ) ;
1066+ } }
1067+ required
1068+ />
1069+
1070+ { /* Label for specific element */ }
1071+ < TextField
1072+ name = "selectYAxisColumnLabel"
1073+ label = "Label"
1074+ value = { yAxisColumnLabel }
1075+ onChange = { ( e ) => {
1076+ setYAxisColumnLabel ( e ) ;
11071077 } }
1108- >
1109- Save
1110- </ Button >
1111- </ div >
1078+ />
1079+
1080+ { /* Color for specific element */ }
1081+ < TextField
1082+ name = "selectYAxisColumnColor"
1083+ label = "Color"
1084+ value = { yAxisColumnColor }
1085+ onChange = { ( e ) => {
1086+ setYAxisColumnColor ( e ) ;
1087+ } }
1088+ />
1089+
1090+ < div className = "mt-1 flex flex-row justify-between gap-8" >
1091+ < Button
1092+ kind = "secondary"
1093+ size = "slim"
1094+ className = "rounded-2 border-1 border-solid border-greyExtralight"
1095+ onClick = { onCancel }
1096+ >
1097+ Cancel
1098+ </ Button >
1099+
1100+ < Button
1101+ kind = "primary"
1102+ size = "slim"
1103+ className = "rounded-2 border-1 border-solid border-greyExtralight"
1104+ onClick = { ( ) => {
1105+ onSubmit ( {
1106+ fieldName : yAxisColumn ,
1107+ label : yAxisColumnLabel ,
1108+ color : yAxisColumnColor ,
1109+ } ) ;
1110+ } }
1111+ >
1112+ Save
1113+ </ Button >
1114+ </ div >
1115+ </ Form >
11121116 </ div >
11131117 ) ;
11141118} ;
0 commit comments