diff --git a/client/src/components/dashboard/dashboard-widget.tsx b/client/src/components/dashboard/dashboard-widget.tsx index b0643f9..7f7756d 100644 --- a/client/src/components/dashboard/dashboard-widget.tsx +++ b/client/src/components/dashboard/dashboard-widget.tsx @@ -26,6 +26,14 @@ export interface WidgetProps { showLegend?: boolean; stacked?: boolean; precision?: number; + // New chart options + showGrid?: boolean; + showTooltip?: boolean; + enableAnimation?: boolean; + valueFormatter?: "none" | "number" | "percent" | "currency"; + currencySymbol?: string; + minValue?: number | null; + maxValue?: number | null; }; onEdit: (id: string) => void; onDelete: (id: string) => void; diff --git a/client/src/components/dashboard/widget-editor.tsx b/client/src/components/dashboard/widget-editor.tsx index 27872b6..749a067 100644 --- a/client/src/components/dashboard/widget-editor.tsx +++ b/client/src/components/dashboard/widget-editor.tsx @@ -34,10 +34,11 @@ import { Button } from "@/components/ui/button"; import { Switch } from "@/components/ui/switch"; import { Slider } from "@/components/ui/slider"; import { Checkbox } from "@/components/ui/checkbox"; +import { ColorPicker } from "@/components/ui/color-picker"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import * as z from "zod"; -import { X, Plus } from "lucide-react"; +import { X, Plus, Palette } from "lucide-react"; const chartTypeOptions = [ { value: "bar", label: "Bar Chart" }, @@ -138,6 +139,15 @@ export function WidgetEditor({ showLegend: editWidget.config.showLegend ?? true, stacked: editWidget.config.stacked ?? false, precision: editWidget.config.precision ?? 2, + // Add new chart options with defaults if not provided + colors: editWidget.config.colors || [], + showGrid: editWidget.config.showGrid ?? true, + showTooltip: editWidget.config.showTooltip ?? true, + enableAnimation: editWidget.config.enableAnimation ?? true, + valueFormatter: editWidget.config.valueFormatter || "none", + currencySymbol: editWidget.config.currencySymbol || "$", + minValue: editWidget.config.minValue ?? null, + maxValue: editWidget.config.maxValue ?? null, }, }); @@ -161,6 +171,15 @@ export function WidgetEditor({ showLegend: true, stacked: false, precision: 2, + // New chart options with defaults + colors: [], + showGrid: true, + showTooltip: true, + enableAnimation: true, + valueFormatter: "none", + currencySymbol: "$", + minValue: null, + maxValue: null, }, }); setSelectedFields([]); @@ -679,6 +698,159 @@ export function WidgetEditor({ )} /> + + {/* Visualization Options */} +