@optifye/dashboard-core 4.3.5 → 4.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +409 -174
  2. package/dist/index.mjs +409 -174
  3. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -24427,6 +24427,7 @@ var AIAgentView = () => {
24427
24427
  const entityConfig = useEntityConfig();
24428
24428
  const dateTimeConfig = useDateTimeConfig();
24429
24429
  const shiftConfig = useShiftConfig();
24430
+ const { formatNumber } = useFormatNumber();
24430
24431
  const [inputValue, setInputValue] = useState("");
24431
24432
  const [loadingThreads, setLoadingThreads] = useState(/* @__PURE__ */ new Set());
24432
24433
  const [lastError, setLastError] = useState(null);
@@ -25253,71 +25254,142 @@ var AIAgentView = () => {
25253
25254
  };
25254
25255
  const renderChart = (chartType, args, key) => {
25255
25256
  console.log(`[DEBUG] Attempting to render chart type: ${chartType}`, args);
25257
+ const CHART_COLORS = {
25258
+ primary: "#3b82f6",
25259
+ // blue-500
25260
+ secondary: "#10b981",
25261
+ // green-500
25262
+ accent: "#f59e0b",
25263
+ // amber-500
25264
+ danger: "#ef4444",
25265
+ // red-500
25266
+ violet: "#8b5cf6",
25267
+ // violet-500
25268
+ cyan: "#06b6d4",
25269
+ // cyan-500
25270
+ orange: "#f97316",
25271
+ // orange-500
25272
+ indigo: "#6366f1"
25273
+ // indigo-500
25274
+ };
25275
+ const CHART_COLOR_PALETTE = Object.values(CHART_COLORS);
25276
+ const CHART_STYLES = {
25277
+ grid: {
25278
+ strokeDasharray: "3 3",
25279
+ stroke: "#e5e7eb"
25280
+ // gray-300
25281
+ },
25282
+ axis: {
25283
+ tick: { fontSize: 12, fill: "#4b5563" },
25284
+ // gray-600
25285
+ stroke: "#9ca3af"
25286
+ // gray-400
25287
+ },
25288
+ margin: { top: 10, right: 30, left: 20, bottom: 40 },
25289
+ barRadius: [4, 4, 0, 0]
25290
+ // Top corners rounded
25291
+ };
25292
+ const CustomTooltip = ({ active, payload, label }) => {
25293
+ if (active && payload && payload.length) {
25294
+ return /* @__PURE__ */ jsxs("div", { className: "bg-white px-4 py-3 shadow-lg rounded-lg border border-gray-200", children: [
25295
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-900 mb-1", children: label }),
25296
+ payload.map((entry, index) => /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600", style: { color: entry.color }, children: [
25297
+ entry.name,
25298
+ ": ",
25299
+ typeof entry.value === "number" ? formatNumber(entry.value) : entry.value,
25300
+ args.unit || ""
25301
+ ] }, index))
25302
+ ] });
25303
+ }
25304
+ return null;
25305
+ };
25306
+ const ChartWrapper = ({ children, title }) => /* @__PURE__ */ jsxs("div", { className: "my-6 bg-white rounded-xl shadow-sm border border-gray-200 p-6", children: [
25307
+ title && /* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-gray-900 mb-4", children: title }),
25308
+ children
25309
+ ] });
25256
25310
  switch (chartType) {
25257
25311
  case "create_gauge_chart":
25258
25312
  console.log("[DEBUG] Rendering gauge chart");
25259
- return /* @__PURE__ */ jsx("div", { className: "my-6 h-64 w-full flex justify-center", children: /* @__PURE__ */ jsx(
25313
+ return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "h-64 w-full flex justify-center", children: /* @__PURE__ */ jsx(
25260
25314
  GaugeChart,
25261
25315
  {
25262
25316
  value: args.value || 0,
25263
25317
  min: args.min_value || 0,
25264
25318
  max: args.max_value || 100,
25265
25319
  target: args.target,
25266
- label: args.title || "",
25320
+ label: args.label || "",
25267
25321
  unit: args.unit || "",
25268
25322
  thresholds: args.thresholds,
25269
25323
  className: "w-full max-w-sm"
25270
25324
  }
25271
- ) }, `gauge-${key}`);
25325
+ ) }) }, `gauge-${key}`);
25272
25326
  case "create_bar_chart":
25273
25327
  console.log("[DEBUG] Rendering bar chart");
25274
25328
  if (!args.data || !args.x_field || !args.y_field) {
25275
25329
  console.error("Bar chart missing required parameters:", { data: !!args.data, x_field: !!args.x_field, y_field: !!args.y_field });
25276
25330
  return null;
25277
25331
  }
25278
- return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", style: { maxWidth: args.max_width || "100%" }, children: [
25332
+ return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-64", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(BarChart$1, { data: args.data, margin: CHART_STYLES.margin, children: [
25333
+ /* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
25279
25334
  /* @__PURE__ */ jsx(
25280
- BarChart,
25335
+ XAxis,
25281
25336
  {
25282
- data: args.data,
25283
- bars: [{
25284
- dataKey: args.y_field,
25285
- fill: args.color || "#3b82f6",
25286
- labelList: args.show_values
25287
- }],
25288
- xAxisDataKey: args.x_field,
25289
- className: "h-64",
25290
- showLegend: false
25337
+ dataKey: args.x_field,
25338
+ ...CHART_STYLES.axis
25291
25339
  }
25292
25340
  ),
25293
- args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25294
- ] }, `bar-${key}`);
25341
+ /* @__PURE__ */ jsx(
25342
+ YAxis,
25343
+ {
25344
+ ...CHART_STYLES.axis,
25345
+ tickFormatter: (value) => formatNumber(value)
25346
+ }
25347
+ ),
25348
+ /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
25349
+ /* @__PURE__ */ jsx(
25350
+ Bar,
25351
+ {
25352
+ dataKey: args.y_field,
25353
+ fill: args.color || CHART_COLORS.primary,
25354
+ radius: CHART_STYLES.barRadius
25355
+ }
25356
+ )
25357
+ ] }) }) }) }, `bar-${key}`);
25295
25358
  case "create_line_chart":
25296
25359
  console.log("[DEBUG] Rendering line chart");
25297
25360
  if (!args.data || !args.x_field || !args.y_field) {
25298
25361
  console.error("Line chart missing required parameters:", { data: !!args.data, x_field: !!args.x_field, y_field: !!args.y_field });
25299
25362
  return null;
25300
25363
  }
25301
- return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", style: {
25302
- height: args.height || 256,
25303
- width: args.width || "100%"
25304
- }, children: [
25364
+ return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-64", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(LineChart$1, { data: args.data, margin: CHART_STYLES.margin, children: [
25365
+ /* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
25305
25366
  /* @__PURE__ */ jsx(
25306
- LineChart,
25367
+ XAxis,
25368
+ {
25369
+ dataKey: args.x_field,
25370
+ ...CHART_STYLES.axis
25371
+ }
25372
+ ),
25373
+ /* @__PURE__ */ jsx(
25374
+ YAxis,
25307
25375
  {
25308
- data: args.data,
25309
- lines: [{
25310
- dataKey: args.y_field,
25311
- stroke: "#3b82f6",
25312
- strokeWidth: 2
25313
- }],
25314
- xAxisDataKey: args.x_field,
25315
- className: "h-full",
25316
- showLegend: false
25376
+ ...CHART_STYLES.axis,
25377
+ tickFormatter: (value) => formatNumber(value)
25317
25378
  }
25318
25379
  ),
25319
- args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25320
- ] }, `line-${key}`);
25380
+ /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { strokeDasharray: "3 3" } }),
25381
+ /* @__PURE__ */ jsx(
25382
+ Line,
25383
+ {
25384
+ type: "monotone",
25385
+ dataKey: args.y_field,
25386
+ stroke: CHART_COLORS.primary,
25387
+ strokeWidth: 2,
25388
+ dot: { r: 4, fill: CHART_COLORS.primary },
25389
+ activeDot: { r: 6 }
25390
+ }
25391
+ )
25392
+ ] }) }) }) }, `line-${key}`);
25321
25393
  case "create_pie_chart":
25322
25394
  console.log("[DEBUG] Rendering pie chart");
25323
25395
  if (!args.data || !args.label_field || !args.value_field) {
@@ -25330,16 +25402,14 @@ var AIAgentView = () => {
25330
25402
  value: item[args.value_field]
25331
25403
  }));
25332
25404
  console.log("[DEBUG] Pie chart data transformed:", pieData);
25333
- return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full flex flex-col items-center", children: [
25334
- args.title && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700 mb-2", children: args.title }),
25335
- /* @__PURE__ */ jsx("div", { className: "h-64 w-full max-w-md", children: /* @__PURE__ */ jsx(
25336
- PieChart4,
25337
- {
25338
- data: pieData,
25339
- showPercentages: args.show_percentages || false
25340
- }
25341
- ) })
25342
- ] }, `pie-${key}`);
25405
+ return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "h-64 w-full max-w-md mx-auto", children: /* @__PURE__ */ jsx(
25406
+ PieChart4,
25407
+ {
25408
+ data: pieData,
25409
+ showPercentages: args.show_percentages || false,
25410
+ colors: CHART_COLOR_PALETTE
25411
+ }
25412
+ ) }) }, `pie-${key}`);
25343
25413
  case "create_comparison_table":
25344
25414
  console.log("[DEBUG] Rendering comparison table");
25345
25415
  if (!args.data) {
@@ -25356,27 +25426,24 @@ var AIAgentView = () => {
25356
25426
  return args.sort_descending === false ? comparison : -comparison;
25357
25427
  });
25358
25428
  }
25359
- return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full overflow-x-auto", children: [
25360
- args.title && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700 mb-2", children: args.title }),
25361
- /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-gray-200", children: [
25362
- /* @__PURE__ */ jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsx(
25363
- "th",
25364
- {
25365
- className: `px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider ${col === args.highlight_column ? "bg-blue-50" : ""}`,
25366
- children: col
25367
- },
25368
- col
25369
- )) }) }),
25370
- /* @__PURE__ */ jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: sortedData.map((row, rowIdx) => /* @__PURE__ */ jsx("tr", { className: rowIdx % 2 === 0 ? "bg-white" : "bg-gray-50", children: columns.map((col) => /* @__PURE__ */ jsx(
25371
- "td",
25372
- {
25373
- className: `px-4 py-2 whitespace-nowrap text-sm ${col === args.highlight_column ? "font-medium text-blue-600 bg-blue-50" : "text-gray-900"}`,
25374
- children: row[col]
25375
- },
25376
- col
25377
- )) }, rowIdx)) })
25378
- ] })
25379
- ] }, `table-${key}`);
25429
+ return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "overflow-x-auto rounded-lg border border-gray-200", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-gray-200", children: [
25430
+ /* @__PURE__ */ jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsx(
25431
+ "th",
25432
+ {
25433
+ className: `px-6 py-3 text-left text-xs font-medium text-gray-600 uppercase tracking-wider ${col === args.highlight_column ? "bg-blue-50" : ""}`,
25434
+ children: col
25435
+ },
25436
+ col
25437
+ )) }) }),
25438
+ /* @__PURE__ */ jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: sortedData.map((row, rowIdx) => /* @__PURE__ */ jsx("tr", { className: rowIdx % 2 === 0 ? "bg-white" : "bg-gray-50", children: columns.map((col) => /* @__PURE__ */ jsx(
25439
+ "td",
25440
+ {
25441
+ className: `px-6 py-4 whitespace-nowrap text-sm ${col === args.highlight_column ? "font-medium text-blue-600 bg-blue-50" : "text-gray-900"}`,
25442
+ children: typeof row[col] === "number" ? formatNumber(row[col]) : row[col]
25443
+ },
25444
+ col
25445
+ )) }, rowIdx)) })
25446
+ ] }) }) }, `table-${key}`);
25380
25447
  case "create_multi_line_chart":
25381
25448
  console.log("[DEBUG] Rendering multi-line chart");
25382
25449
  if (!args.data || !args.x_field || !args.y_fields || !args.legend) {
@@ -25388,30 +25455,44 @@ var AIAgentView = () => {
25388
25455
  });
25389
25456
  return null;
25390
25457
  }
25391
- const colors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
25392
- return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
25393
- /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(LineChart$1, { data: args.data, children: [
25394
- /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
25395
- /* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field }),
25396
- /* @__PURE__ */ jsx(YAxis, {}),
25397
- /* @__PURE__ */ jsx(Tooltip, {}),
25398
- /* @__PURE__ */ jsx(Legend, {}),
25399
- args.y_fields.map((field, index) => /* @__PURE__ */ jsx(
25400
- Line,
25401
- {
25402
- type: "monotone",
25403
- dataKey: field,
25404
- stroke: colors[index % colors.length],
25405
- strokeWidth: 2,
25406
- name: args.legend[index] || field,
25407
- dot: { r: 4 },
25408
- activeDot: { r: 6 }
25409
- },
25410
- field
25411
- ))
25412
- ] }) }),
25413
- args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25414
- ] }, `multi-line-${key}`);
25458
+ return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(LineChart$1, { data: args.data, margin: CHART_STYLES.margin, children: [
25459
+ /* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
25460
+ /* @__PURE__ */ jsx(
25461
+ XAxis,
25462
+ {
25463
+ dataKey: args.x_field,
25464
+ ...CHART_STYLES.axis
25465
+ }
25466
+ ),
25467
+ /* @__PURE__ */ jsx(
25468
+ YAxis,
25469
+ {
25470
+ ...CHART_STYLES.axis,
25471
+ tickFormatter: (value) => formatNumber(value)
25472
+ }
25473
+ ),
25474
+ /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { strokeDasharray: "3 3" } }),
25475
+ /* @__PURE__ */ jsx(
25476
+ Legend,
25477
+ {
25478
+ wrapperStyle: { paddingTop: "20px" },
25479
+ formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
25480
+ }
25481
+ ),
25482
+ args.y_fields.map((field, index) => /* @__PURE__ */ jsx(
25483
+ Line,
25484
+ {
25485
+ type: "monotone",
25486
+ dataKey: field,
25487
+ stroke: CHART_COLOR_PALETTE[index % CHART_COLOR_PALETTE.length],
25488
+ strokeWidth: 2,
25489
+ name: args.legend[index] || field,
25490
+ dot: { r: 4 },
25491
+ activeDot: { r: 6 }
25492
+ },
25493
+ field
25494
+ ))
25495
+ ] }) }) }) }, `multi-line-${key}`);
25415
25496
  case "create_stacked_bar_chart":
25416
25497
  console.log("[DEBUG] Rendering stacked bar chart");
25417
25498
  if (!args.data || !args.x_field || !args.stack_fields) {
@@ -25422,27 +25503,42 @@ var AIAgentView = () => {
25422
25503
  });
25423
25504
  return null;
25424
25505
  }
25425
- const stackColors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
25426
- return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
25427
- /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(BarChart$1, { data: args.data, children: [
25428
- /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
25429
- /* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field }),
25430
- /* @__PURE__ */ jsx(YAxis, {}),
25431
- /* @__PURE__ */ jsx(Tooltip, {}),
25432
- /* @__PURE__ */ jsx(Legend, {}),
25433
- args.stack_fields.map((field, index) => /* @__PURE__ */ jsx(
25434
- Bar,
25435
- {
25436
- dataKey: field,
25437
- stackId: "stack",
25438
- fill: stackColors[index % stackColors.length],
25439
- name: field
25440
- },
25441
- field
25442
- ))
25443
- ] }) }),
25444
- args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25445
- ] }, `stacked-bar-${key}`);
25506
+ return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(BarChart$1, { data: args.data, margin: CHART_STYLES.margin, children: [
25507
+ /* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
25508
+ /* @__PURE__ */ jsx(
25509
+ XAxis,
25510
+ {
25511
+ dataKey: args.x_field,
25512
+ ...CHART_STYLES.axis
25513
+ }
25514
+ ),
25515
+ /* @__PURE__ */ jsx(
25516
+ YAxis,
25517
+ {
25518
+ ...CHART_STYLES.axis,
25519
+ tickFormatter: (value) => formatNumber(value)
25520
+ }
25521
+ ),
25522
+ /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
25523
+ /* @__PURE__ */ jsx(
25524
+ Legend,
25525
+ {
25526
+ wrapperStyle: { paddingTop: "20px" },
25527
+ formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
25528
+ }
25529
+ ),
25530
+ args.stack_fields.map((field, index) => /* @__PURE__ */ jsx(
25531
+ Bar,
25532
+ {
25533
+ dataKey: field,
25534
+ stackId: "stack",
25535
+ fill: CHART_COLOR_PALETTE[index % CHART_COLOR_PALETTE.length],
25536
+ name: field,
25537
+ radius: index === args.stack_fields.length - 1 ? CHART_STYLES.barRadius : void 0
25538
+ },
25539
+ field
25540
+ ))
25541
+ ] }) }) }) }, `stacked-bar-${key}`);
25446
25542
  case "create_dual_axis_chart":
25447
25543
  console.log("[DEBUG] Rendering dual-axis chart");
25448
25544
  if (!args.data || !args.x_field || !args.left_y_field || !args.right_y_field) {
@@ -25454,19 +25550,67 @@ var AIAgentView = () => {
25454
25550
  });
25455
25551
  return null;
25456
25552
  }
25457
- return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
25458
- /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, children: [
25459
- /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
25460
- /* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field }),
25461
- /* @__PURE__ */ jsx(YAxis, { yAxisId: "left", orientation: "left", label: { value: args.left_label || "", angle: -90, position: "insideLeft" } }),
25462
- /* @__PURE__ */ jsx(YAxis, { yAxisId: "right", orientation: "right", label: { value: args.right_label || "", angle: 90, position: "insideRight" } }),
25463
- /* @__PURE__ */ jsx(Tooltip, {}),
25464
- /* @__PURE__ */ jsx(Legend, {}),
25465
- /* @__PURE__ */ jsx(Bar, { yAxisId: "left", dataKey: args.left_y_field, fill: "#3b82f6", name: args.left_label || args.left_y_field }),
25466
- /* @__PURE__ */ jsx(Line, { yAxisId: "right", type: "monotone", dataKey: args.right_y_field, stroke: "#ef4444", strokeWidth: 2, name: args.right_label || args.right_y_field })
25467
- ] }) }),
25468
- args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25469
- ] }, `dual-axis-${key}`);
25553
+ return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, margin: CHART_STYLES.margin, children: [
25554
+ /* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
25555
+ /* @__PURE__ */ jsx(
25556
+ XAxis,
25557
+ {
25558
+ dataKey: args.x_field,
25559
+ ...CHART_STYLES.axis
25560
+ }
25561
+ ),
25562
+ /* @__PURE__ */ jsx(
25563
+ YAxis,
25564
+ {
25565
+ yAxisId: "left",
25566
+ orientation: "left",
25567
+ label: { value: args.left_label || "", angle: -90, position: "insideLeft" },
25568
+ ...CHART_STYLES.axis,
25569
+ tickFormatter: (value) => formatNumber(value)
25570
+ }
25571
+ ),
25572
+ /* @__PURE__ */ jsx(
25573
+ YAxis,
25574
+ {
25575
+ yAxisId: "right",
25576
+ orientation: "right",
25577
+ label: { value: args.right_label || "", angle: 90, position: "insideRight" },
25578
+ ...CHART_STYLES.axis,
25579
+ tickFormatter: (value) => formatNumber(value)
25580
+ }
25581
+ ),
25582
+ /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
25583
+ /* @__PURE__ */ jsx(
25584
+ Legend,
25585
+ {
25586
+ wrapperStyle: { paddingTop: "20px" },
25587
+ formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
25588
+ }
25589
+ ),
25590
+ /* @__PURE__ */ jsx(
25591
+ Bar,
25592
+ {
25593
+ yAxisId: "left",
25594
+ dataKey: args.left_y_field,
25595
+ fill: CHART_COLORS.primary,
25596
+ name: args.left_label || args.left_y_field,
25597
+ radius: CHART_STYLES.barRadius
25598
+ }
25599
+ ),
25600
+ /* @__PURE__ */ jsx(
25601
+ Line,
25602
+ {
25603
+ yAxisId: "right",
25604
+ type: "monotone",
25605
+ dataKey: args.right_y_field,
25606
+ stroke: CHART_COLORS.danger,
25607
+ strokeWidth: 2,
25608
+ name: args.right_label || args.right_y_field,
25609
+ dot: { r: 4 },
25610
+ activeDot: { r: 6 }
25611
+ }
25612
+ )
25613
+ ] }) }) }) }, `dual-axis-${key}`);
25470
25614
  case "create_scatter_plot":
25471
25615
  console.log("[DEBUG] Rendering scatter plot");
25472
25616
  if (!args.data || !args.x_field || !args.y_field || !args.group_field) {
@@ -25486,26 +25630,50 @@ var AIAgentView = () => {
25486
25630
  acc[group].push(item);
25487
25631
  return acc;
25488
25632
  }, {});
25489
- const scatterColors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
25490
- return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
25491
- /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(ScatterChart, { children: [
25492
- /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
25493
- /* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field, type: "number", name: args.x_field }),
25494
- /* @__PURE__ */ jsx(YAxis, { dataKey: args.y_field, type: "number", name: args.y_field }),
25495
- /* @__PURE__ */ jsx(Tooltip, { cursor: { strokeDasharray: "3 3" } }),
25496
- /* @__PURE__ */ jsx(Legend, {}),
25497
- Object.entries(groupedData).map(([group, data], index) => /* @__PURE__ */ jsx(
25498
- Scatter,
25499
- {
25500
- name: group,
25501
- data,
25502
- fill: scatterColors[index % scatterColors.length]
25503
- },
25504
- group
25505
- ))
25506
- ] }) }),
25507
- args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25508
- ] }, `scatter-${key}`);
25633
+ return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ScatterChart, { margin: CHART_STYLES.margin, children: [
25634
+ /* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
25635
+ /* @__PURE__ */ jsx(
25636
+ XAxis,
25637
+ {
25638
+ dataKey: args.x_field,
25639
+ type: "number",
25640
+ name: args.x_field,
25641
+ ...CHART_STYLES.axis
25642
+ }
25643
+ ),
25644
+ /* @__PURE__ */ jsx(
25645
+ YAxis,
25646
+ {
25647
+ dataKey: args.y_field,
25648
+ type: "number",
25649
+ name: args.y_field,
25650
+ ...CHART_STYLES.axis
25651
+ }
25652
+ ),
25653
+ /* @__PURE__ */ jsx(
25654
+ Tooltip,
25655
+ {
25656
+ cursor: { strokeDasharray: "3 3" },
25657
+ content: /* @__PURE__ */ jsx(CustomTooltip, {})
25658
+ }
25659
+ ),
25660
+ /* @__PURE__ */ jsx(
25661
+ Legend,
25662
+ {
25663
+ wrapperStyle: { paddingTop: "20px" },
25664
+ formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
25665
+ }
25666
+ ),
25667
+ Object.entries(groupedData).map(([group, data], index) => /* @__PURE__ */ jsx(
25668
+ Scatter,
25669
+ {
25670
+ name: group,
25671
+ data,
25672
+ fill: CHART_COLOR_PALETTE[index % CHART_COLOR_PALETTE.length]
25673
+ },
25674
+ group
25675
+ ))
25676
+ ] }) }) }) }, `scatter-${key}`);
25509
25677
  case "create_combo_chart":
25510
25678
  console.log("[DEBUG] Rendering combo chart");
25511
25679
  if (!args.data || !args.x_field || !args.bar_field || !args.line_field) {
@@ -25517,19 +25685,65 @@ var AIAgentView = () => {
25517
25685
  });
25518
25686
  return null;
25519
25687
  }
25520
- return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
25521
- /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, children: [
25522
- /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
25523
- /* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field }),
25524
- /* @__PURE__ */ jsx(YAxis, { yAxisId: "left", orientation: "left" }),
25525
- /* @__PURE__ */ jsx(YAxis, { yAxisId: "right", orientation: "right" }),
25526
- /* @__PURE__ */ jsx(Tooltip, {}),
25527
- /* @__PURE__ */ jsx(Legend, {}),
25528
- /* @__PURE__ */ jsx(Bar, { yAxisId: "left", dataKey: args.bar_field, fill: "#3b82f6", name: args.bar_field }),
25529
- /* @__PURE__ */ jsx(Line, { yAxisId: "right", type: "monotone", dataKey: args.line_field, stroke: "#ef4444", strokeWidth: 2, name: args.line_field })
25530
- ] }) }),
25531
- args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25532
- ] }, `combo-${key}`);
25688
+ return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, margin: CHART_STYLES.margin, children: [
25689
+ /* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
25690
+ /* @__PURE__ */ jsx(
25691
+ XAxis,
25692
+ {
25693
+ dataKey: args.x_field,
25694
+ ...CHART_STYLES.axis
25695
+ }
25696
+ ),
25697
+ /* @__PURE__ */ jsx(
25698
+ YAxis,
25699
+ {
25700
+ yAxisId: "left",
25701
+ orientation: "left",
25702
+ ...CHART_STYLES.axis,
25703
+ tickFormatter: (value) => formatNumber(value)
25704
+ }
25705
+ ),
25706
+ /* @__PURE__ */ jsx(
25707
+ YAxis,
25708
+ {
25709
+ yAxisId: "right",
25710
+ orientation: "right",
25711
+ ...CHART_STYLES.axis,
25712
+ tickFormatter: (value) => formatNumber(value)
25713
+ }
25714
+ ),
25715
+ /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
25716
+ /* @__PURE__ */ jsx(
25717
+ Legend,
25718
+ {
25719
+ wrapperStyle: { paddingTop: "20px" },
25720
+ formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
25721
+ }
25722
+ ),
25723
+ /* @__PURE__ */ jsx(
25724
+ Bar,
25725
+ {
25726
+ yAxisId: "left",
25727
+ dataKey: args.bar_field,
25728
+ fill: CHART_COLORS.primary,
25729
+ name: args.bar_field,
25730
+ radius: CHART_STYLES.barRadius
25731
+ }
25732
+ ),
25733
+ /* @__PURE__ */ jsx(
25734
+ Line,
25735
+ {
25736
+ yAxisId: "right",
25737
+ type: "monotone",
25738
+ dataKey: args.line_field,
25739
+ stroke: CHART_COLORS.danger,
25740
+ strokeWidth: 2,
25741
+ name: args.line_field,
25742
+ dot: { r: 4 },
25743
+ activeDot: { r: 6 }
25744
+ }
25745
+ )
25746
+ ] }) }) }) }, `combo-${key}`);
25533
25747
  case "create_area_chart":
25534
25748
  console.log("[DEBUG] Rendering area chart");
25535
25749
  if (!args.data || !args.x_field || !args.y_field) {
@@ -25540,27 +25754,48 @@ var AIAgentView = () => {
25540
25754
  });
25541
25755
  return null;
25542
25756
  }
25543
- return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
25544
- /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, children: [
25545
- /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
25546
- /* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field }),
25547
- /* @__PURE__ */ jsx(YAxis, {}),
25548
- /* @__PURE__ */ jsx(Tooltip, {}),
25549
- /* @__PURE__ */ jsx(Legend, {}),
25550
- /* @__PURE__ */ jsx(
25551
- Area,
25552
- {
25553
- type: "monotone",
25554
- dataKey: args.y_field,
25555
- stroke: "#3b82f6",
25556
- fill: args.fill ? "#3b82f6" : "none",
25557
- fillOpacity: args.fill ? 0.6 : 0,
25558
- name: args.y_field
25559
- }
25560
- )
25757
+ return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, margin: CHART_STYLES.margin, children: [
25758
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "colorGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
25759
+ /* @__PURE__ */ jsx("stop", { offset: "5%", stopColor: CHART_COLORS.primary, stopOpacity: 0.8 }),
25760
+ /* @__PURE__ */ jsx("stop", { offset: "95%", stopColor: CHART_COLORS.primary, stopOpacity: 0.1 })
25561
25761
  ] }) }),
25562
- args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25563
- ] }, `area-${key}`);
25762
+ /* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
25763
+ /* @__PURE__ */ jsx(
25764
+ XAxis,
25765
+ {
25766
+ dataKey: args.x_field,
25767
+ ...CHART_STYLES.axis
25768
+ }
25769
+ ),
25770
+ /* @__PURE__ */ jsx(
25771
+ YAxis,
25772
+ {
25773
+ ...CHART_STYLES.axis,
25774
+ tickFormatter: (value) => formatNumber(value)
25775
+ }
25776
+ ),
25777
+ /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { strokeDasharray: "3 3" } }),
25778
+ /* @__PURE__ */ jsx(
25779
+ Legend,
25780
+ {
25781
+ wrapperStyle: { paddingTop: "20px" },
25782
+ formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
25783
+ }
25784
+ ),
25785
+ /* @__PURE__ */ jsx(
25786
+ Area,
25787
+ {
25788
+ type: "monotone",
25789
+ dataKey: args.y_field,
25790
+ stroke: CHART_COLORS.primary,
25791
+ strokeWidth: 2,
25792
+ fill: args.fill !== false ? "url(#colorGradient)" : "none",
25793
+ name: args.y_field,
25794
+ dot: { r: 4, fill: CHART_COLORS.primary },
25795
+ activeDot: { r: 6 }
25796
+ }
25797
+ )
25798
+ ] }) }) }) }, `area-${key}`);
25564
25799
  default:
25565
25800
  console.warn(`Unknown chart type: ${chartType}`);
25566
25801
  return null;