@internetstiftelsen/charts 0.0.4 → 0.0.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.
package/legend.js CHANGED
@@ -54,8 +54,10 @@ export class Legend {
54
54
  return this.visibilityState.get(dataKey) ?? true;
55
55
  }
56
56
  getCheckmarkPath(size) {
57
- const scale = size / 24;
58
- return `M ${4 * scale} ${12 * scale} L ${9 * scale} ${17 * scale} L ${20 * scale} ${6 * scale}`;
57
+ const scale = (size / 24) * 0.7;
58
+ const offsetX = size * 0.15;
59
+ const offsetY = size * 0.15;
60
+ return `M ${4 * scale + offsetX} ${12 * scale + offsetY} L ${9 * scale + offsetX} ${17 * scale + offsetY} L ${20 * scale + offsetX} ${6 * scale + offsetY}`;
59
61
  }
60
62
  parseColor(color) {
61
63
  // Handle hex colors
@@ -153,7 +155,7 @@ export class Legend {
153
155
  const isVisible = this.visibilityState.get(d.dataKey) ?? true;
154
156
  return isVisible ? d.color : theme.legend.uncheckedColor;
155
157
  })
156
- .attr('rx', 2);
158
+ .attr('rx', 3);
157
159
  // Add checkmark when visible
158
160
  legendGroups
159
161
  .append('path')
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.4",
2
+ "version": "0.0.6",
3
3
  "name": "@internetstiftelsen/charts",
4
4
  "type": "module",
5
5
  "sideEffects": false,
package/theme.js CHANGED
@@ -28,7 +28,7 @@ export const defaultTheme = {
28
28
  fontWeight: 'normal',
29
29
  },
30
30
  legend: {
31
- boxSize: 20,
31
+ boxSize: 24,
32
32
  uncheckedColor: '#d0d0d0',
33
33
  fontSize: 14,
34
34
  },
package/types.d.ts CHANGED
@@ -56,7 +56,7 @@ export type XAxisConfig = {
56
56
  rotatedLabels?: boolean;
57
57
  };
58
58
  export type YAxisConfig = {
59
- tickFormat?: string | null;
59
+ tickFormat?: string | ((value: any) => string) | null;
60
60
  };
61
61
  export type GridConfig = {
62
62
  horizontal?: boolean;
package/y-axis.js CHANGED
@@ -42,7 +42,12 @@ export class YAxis {
42
42
  const axis = axisLeft(y).tickSize(0).tickPadding(this.tickPadding);
43
43
  // Apply tick formatting if specified
44
44
  if (this.tickFormat) {
45
- axis.ticks(5, this.tickFormat);
45
+ if (typeof this.tickFormat === 'function') {
46
+ axis.ticks(5).tickFormat(this.tickFormat);
47
+ }
48
+ else {
49
+ axis.ticks(5, this.tickFormat);
50
+ }
46
51
  }
47
52
  else {
48
53
  axis.ticks(5);