@internetstiftelsen/charts 0.0.4 → 0.0.5

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/package.json +1 -1
  2. package/types.d.ts +1 -1
  3. package/y-axis.js +6 -1
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.4",
2
+ "version": "0.0.5",
3
3
  "name": "@internetstiftelsen/charts",
4
4
  "type": "module",
5
5
  "sideEffects": false,
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);