@@ -31,12 +31,10 @@ import {
3131 SelectTrigger ,
3232 SelectValue ,
3333} from "@/components/ui/select" ;
34- import { Card , CardContent , CardHeader , CardTitle } from "@/components/ui/card" ;
34+ import { Card , CardContent } from "@/components/ui/card" ;
3535import { MultiSelect } from "@/components/ui/multi-select" ;
3636import {
3737 Download ,
38- Settings2 ,
39- X ,
4038 BarChart3 ,
4139} from "lucide-react" ;
4240import { toast } from "sonner" ;
@@ -67,6 +65,19 @@ const DEFAULT_COLORS = [
6765 "#F97316" ,
6866] ;
6967
68+ // Chart type display labels
69+ const CHART_TYPE_LABELS : Record < string , string > = {
70+ bar : "Bar Chart" ,
71+ grouped_bar : "Grouped Bar" ,
72+ stacked_bar : "Stacked Bar" ,
73+ line : "Line Chart" ,
74+ area : "Area Chart" ,
75+ stacked_area : "Stacked Area" ,
76+ pie : "Pie Chart" ,
77+ donut : "Donut Chart" ,
78+ scatter : "Scatter Plot" ,
79+ } ;
80+
7081export const ChartVisualizationPro : React . FC < ChartVisualizationProProps > = ( {
7182 result,
7283 chartConfig,
@@ -87,7 +98,6 @@ export const ChartVisualizationPro: React.FC<ChartVisualizationProProps> = ({
8798 }
8899 ) ;
89100
90- const [ showCustomization , setShowCustomization ] = useState ( false ) ;
91101 const [ selectedYColumns , setSelectedYColumns ] = useState < string [ ] > ( [ ] ) ;
92102
93103 // Auto-select first columns if not set
@@ -226,7 +236,7 @@ export const ChartVisualizationPro: React.FC<ChartVisualizationProProps> = ({
226236 size = "sm"
227237 onClick = { ( ) => handleConfigChange ( { type : type as ChartType } ) }
228238 >
229- { type . replace ( "_" , " " ) }
239+ { CHART_TYPE_LABELS [ type ] || type }
230240 </ Button >
231241 ) ) }
232242 </ div >
@@ -656,102 +666,14 @@ export const ChartVisualizationPro: React.FC<ChartVisualizationProProps> = ({
656666 </ div >
657667 </ div >
658668
659- { /* Advanced Options */ }
669+ { /* Export Button */ }
660670 < div className = "space-y-2" >
661- < label className = "text-xs font-medium invisible" > Options</ label >
662- < div className = "flex gap-2" >
663- < Button variant = "outline" size = "icon" onClick = { handleExportPNG } >
664- < Download className = "h-4 w-4" />
665- </ Button >
666-
667- < Button
668- variant = "outline"
669- size = "icon"
670- onClick = { ( ) => setShowCustomization ( ! showCustomization ) }
671- >
672- < Settings2 className = "h-4 w-4" />
673- </ Button >
674- </ div >
671+ < label className = "text-xs font-medium invisible" > Export</ label >
672+ < Button variant = "outline" size = "icon" onClick = { handleExportPNG } >
673+ < Download className = "h-4 w-4" />
674+ </ Button >
675675 </ div >
676676 </ div >
677-
678- { /* Customization Panel */ }
679- { showCustomization && (
680- < Card className = "border-2 border-primary/20" >
681- < CardHeader className = "pb-3" >
682- < CardTitle className = "text-sm flex items-center justify-between" >
683- < div className = "flex items-center gap-2" >
684- < Settings2 className = "h-4 w-4" />
685- Chart Customization
686- </ div >
687- < Button
688- variant = "ghost"
689- size = "sm"
690- onClick = { ( ) => setShowCustomization ( false ) }
691- >
692- < X className = "h-4 w-4" />
693- </ Button >
694- </ CardTitle >
695- </ CardHeader >
696- < CardContent >
697- < div className = "grid grid-cols-3 gap-4" >
698- < div className = "space-y-2" >
699- < label className = "text-xs font-medium" > Show Grid</ label >
700- < Select
701- value = { localConfig . showGrid ? "yes" : "no" }
702- onValueChange = { ( value ) =>
703- handleConfigChange ( { showGrid : value === "yes" } )
704- }
705- >
706- < SelectTrigger >
707- < SelectValue />
708- </ SelectTrigger >
709- < SelectContent >
710- < SelectItem value = "yes" > Yes</ SelectItem >
711- < SelectItem value = "no" > No</ SelectItem >
712- </ SelectContent >
713- </ Select >
714- </ div >
715-
716- < div className = "space-y-2" >
717- < label className = "text-xs font-medium" > Show Values</ label >
718- < Select
719- value = { localConfig . showValues ? "yes" : "no" }
720- onValueChange = { ( value ) =>
721- handleConfigChange ( { showValues : value === "yes" } )
722- }
723- >
724- < SelectTrigger >
725- < SelectValue />
726- </ SelectTrigger >
727- < SelectContent >
728- < SelectItem value = "yes" > Yes</ SelectItem >
729- < SelectItem value = "no" > No</ SelectItem >
730- </ SelectContent >
731- </ Select >
732- </ div >
733-
734- < div className = "space-y-2" >
735- < label className = "text-xs font-medium" > Animations</ label >
736- < Select
737- value = { localConfig . enableAnimations ? "yes" : "no" }
738- onValueChange = { ( value ) =>
739- handleConfigChange ( { enableAnimations : value === "yes" } )
740- }
741- >
742- < SelectTrigger >
743- < SelectValue />
744- </ SelectTrigger >
745- < SelectContent >
746- < SelectItem value = "yes" > Yes</ SelectItem >
747- < SelectItem value = "no" > No</ SelectItem >
748- </ SelectContent >
749- </ Select >
750- </ div >
751- </ div >
752- </ CardContent >
753- </ Card >
754- ) }
755677 </ div >
756678 </ CardContent >
757679 </ Card >
0 commit comments