@antipopp/agno-react 0.4.0 → 0.5.0

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.
package/dist/index.js CHANGED
@@ -699,10 +699,37 @@ function createSmartChart(data, options) {
699
699
  ) || keys[0];
700
700
  const numericKeys = keys.filter((k) => k !== xKey && typeof firstItem[k] === "number");
701
701
  const yKeys = options?.yKeys || numericKeys;
702
- if ((options?.preferredType === "pie" || yKeys.length === 1) && typeof firstItem[xKey] === "string") {
702
+ if (options?.preferredType) {
703
+ switch (options.preferredType) {
704
+ case "bar":
705
+ return createBarChart(
706
+ data,
707
+ xKey,
708
+ yKeys.map((key) => ({ key })),
709
+ options
710
+ );
711
+ case "line":
712
+ return createLineChart(
713
+ data,
714
+ xKey,
715
+ yKeys.map((key) => ({ key })),
716
+ options
717
+ );
718
+ case "area":
719
+ return createAreaChart(
720
+ data,
721
+ xKey,
722
+ yKeys.map((key) => ({ key })),
723
+ options
724
+ );
725
+ case "pie":
726
+ return createPieChart(data, yKeys[0], xKey, options);
727
+ }
728
+ }
729
+ if (yKeys.length === 1 && typeof firstItem[xKey] === "string") {
703
730
  return createPieChart(data, yKeys[0], xKey, options);
704
731
  }
705
- if (options?.preferredType === "line" || xKey.toLowerCase().includes("date") || xKey.toLowerCase().includes("time") || xKey.toLowerCase().includes("month") || xKey.toLowerCase().includes("year")) {
732
+ if (xKey.toLowerCase().includes("date") || xKey.toLowerCase().includes("time") || xKey.toLowerCase().includes("month") || xKey.toLowerCase().includes("year")) {
706
733
  return createLineChart(
707
734
  data,
708
735
  xKey,
package/dist/index.mjs CHANGED
@@ -634,10 +634,37 @@ function createSmartChart(data, options) {
634
634
  ) || keys[0];
635
635
  const numericKeys = keys.filter((k) => k !== xKey && typeof firstItem[k] === "number");
636
636
  const yKeys = options?.yKeys || numericKeys;
637
- if ((options?.preferredType === "pie" || yKeys.length === 1) && typeof firstItem[xKey] === "string") {
637
+ if (options?.preferredType) {
638
+ switch (options.preferredType) {
639
+ case "bar":
640
+ return createBarChart(
641
+ data,
642
+ xKey,
643
+ yKeys.map((key) => ({ key })),
644
+ options
645
+ );
646
+ case "line":
647
+ return createLineChart(
648
+ data,
649
+ xKey,
650
+ yKeys.map((key) => ({ key })),
651
+ options
652
+ );
653
+ case "area":
654
+ return createAreaChart(
655
+ data,
656
+ xKey,
657
+ yKeys.map((key) => ({ key })),
658
+ options
659
+ );
660
+ case "pie":
661
+ return createPieChart(data, yKeys[0], xKey, options);
662
+ }
663
+ }
664
+ if (yKeys.length === 1 && typeof firstItem[xKey] === "string") {
638
665
  return createPieChart(data, yKeys[0], xKey, options);
639
666
  }
640
- if (options?.preferredType === "line" || xKey.toLowerCase().includes("date") || xKey.toLowerCase().includes("time") || xKey.toLowerCase().includes("month") || xKey.toLowerCase().includes("year")) {
667
+ if (xKey.toLowerCase().includes("date") || xKey.toLowerCase().includes("time") || xKey.toLowerCase().includes("month") || xKey.toLowerCase().includes("year")) {
641
668
  return createLineChart(
642
669
  data,
643
670
  xKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antipopp/agno-react",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "React hooks for Agno client with frontend tool execution (HITL) support",
5
5
  "author": "antipopp",
6
6
  "license": "MIT",
@@ -34,8 +34,8 @@
34
34
  "README.md"
35
35
  ],
36
36
  "dependencies": {
37
- "@antipopp/agno-client": "0.4.0",
38
- "@antipopp/agno-types": "0.4.0"
37
+ "@antipopp/agno-client": "0.5.0",
38
+ "@antipopp/agno-types": "0.5.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^18.0.0"