@vixoniccom/kpi-chart 0.0.1-dev.2 → 0.0.1-dev.4

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/build.zip CHANGED
Binary file
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "author": {
9
9
  "name": "Lorenzo Alfaro Bravo"
10
10
  },
11
- "version": "0.0.1-dev.2",
11
+ "version": "0.0.1-dev.4",
12
12
  "scripts": {
13
13
  "prepublishOnly": "vixonic-module-packager --mode=build",
14
14
  "watch": "vixonic-module-packager --mode=watch",
@@ -37,12 +37,24 @@ export const ChartContainer: React.FunctionComponent<Props> = ({
37
37
  const legendGap = parameters?.legendMargin || 0;
38
38
  const titleMargin = parameters?.titlePadding || "0px";
39
39
  const legendPosition = parameters?.legendPosition || "left";
40
+ const barOrientation = parameters?.barOrientation || "vertical";
40
41
  const chartElementType = (parameters?.chartType as elementType) || "bar";
41
42
  const titleFontColor = !parameters?.titleTextFormat?.fontColor
42
43
  ? parameters?.darkMode
43
44
  ? "white"
44
45
  : "black"
45
46
  : parameters?.titleTextFormat?.fontColor;
47
+ // Posición de los ejes según formato de barras
48
+ const yAxisPosition = !(chartElementType === "bar")
49
+ ? "left"
50
+ : barOrientation === "vertical"
51
+ ? "left"
52
+ : "bottom";
53
+ const xAxisPosition = !(chartElementType === "bar")
54
+ ? "bottom"
55
+ : barOrientation === "vertical"
56
+ ? "bottom"
57
+ : "left";
46
58
 
47
59
  // Definición eje x
48
60
  const primaryAxis = React.useMemo(
@@ -52,19 +64,9 @@ export const ChartContainer: React.FunctionComponent<Props> = ({
52
64
  scaleType: "band",
53
65
  showGrid: parameters?.showVerticalGrid,
54
66
  show: parameters?.xAxisEnabled,
55
- // Para barras horizontales
56
- position:
57
- chartElementType === "bar"
58
- ? parameters?.barOrientation === "horizontal"
59
- ? "left"
60
- : "bottom"
61
- : "bottom",
67
+ position: xAxisPosition,
62
68
  }),
63
- [
64
- parameters.showVerticalGrid,
65
- parameters.xAxisEnabled,
66
- parameters.barOrientation,
67
- ]
69
+ [parameters.showVerticalGrid, parameters.xAxisEnabled, xAxisPosition]
68
70
  );
69
71
 
70
72
  // Definición eje y
@@ -88,13 +90,7 @@ export const ChartContainer: React.FunctionComponent<Props> = ({
88
90
  ? true
89
91
  : false
90
92
  : false,
91
- // Para barras horizontales
92
- position:
93
- chartElementType === "bar"
94
- ? parameters?.barOrientation === "horizontal"
95
- ? "bottom"
96
- : "left"
97
- : "left",
93
+ position: yAxisPosition,
98
94
  },
99
95
  ],
100
96
  [
@@ -103,7 +99,7 @@ export const ChartContainer: React.FunctionComponent<Props> = ({
103
99
  parameters.barStacked,
104
100
  parameters.yAxisEnabled,
105
101
  parameters.showHorizontalGrid,
106
- parameters.barOrientation,
102
+ yAxisPosition,
107
103
  ]
108
104
  );
109
105