layerchart 0.60.1 → 0.60.3

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.
@@ -107,7 +107,8 @@
107
107
  }
108
108
 
109
109
  // Default xScale based on first data's `x` value
110
- $: xScale = accessor(x)(chartData[0]) instanceof Date ? scaleTime() : scaleLinear();
110
+ $: xScale =
111
+ $$props.xScale ?? (accessor(x)(chartData[0]) instanceof Date ? scaleTime() : scaleLinear());
111
112
 
112
113
  function getAreaProps(s: (typeof series)[number], i: number) {
113
114
  const lineProps = {
@@ -74,10 +74,10 @@
74
74
  /** Padding between group/series items when using 'seriesLayout="group"', applied to scaleBand().padding() */
75
75
  export let groupPadding = 0;
76
76
 
77
- $: xScale = isVertical ? scaleBand().padding(bandPadding) : scaleLinear();
77
+ $: xScale = $$props.xScale ?? (isVertical ? scaleBand().padding(bandPadding) : scaleLinear());
78
78
  $: xBaseline = isVertical ? undefined : 0;
79
79
 
80
- $: yScale = isVertical ? scaleLinear() : scaleBand().padding(bandPadding);
80
+ $: yScale = $$props.yScale ?? (isVertical ? scaleLinear() : scaleBand().padding(bandPadding));
81
81
  $: yBaseline = isVertical ? 0 : undefined;
82
82
 
83
83
  let x1Scale: ChartProps['x1Scale'];
@@ -74,7 +74,8 @@
74
74
  >;
75
75
 
76
76
  // Default xScale based on first data's `x` value
77
- $: xScale = accessor(x)(chartData[0]) instanceof Date ? scaleTime() : scaleLinear();
77
+ $: xScale =
78
+ $$props.xScale ?? (accessor(x)(chartData[0]) instanceof Date ? scaleTime() : scaleLinear());
78
79
 
79
80
  function getSplineProps(s: (typeof series)[number], i: number) {
80
81
  const splineProps: ComponentProps<Spline> = {
@@ -56,7 +56,14 @@
56
56
  } = {};
57
57
 
58
58
  // Default xScale based on first data's `x` value
59
- $: xScale = accessor(x)(chartDataArray(data)[0]) instanceof Date ? scaleTime() : scaleLinear();
59
+ $: xScale =
60
+ $$props.xScale ??
61
+ (accessor(x)(chartDataArray(data)[0]) instanceof Date ? scaleTime() : scaleLinear());
62
+
63
+ // Default yScale based on first data's `y` value
64
+ $: yScale =
65
+ $$props.yScale ??
66
+ (accessor(y)(chartDataArray(data)[0]) instanceof Date ? scaleTime() : scaleLinear());
60
67
 
61
68
  $: chartData = series
62
69
  .flatMap((s) => s.data?.map((d) => ({ seriesKey: s.key, ...d })))
@@ -81,6 +88,7 @@
81
88
  {x}
82
89
  {xScale}
83
90
  {y}
91
+ {yScale}
84
92
  yNice
85
93
  padding={axis === false
86
94
  ? undefined
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Sean Lynch <techniq35@gmail.com>",
5
5
  "license": "MIT",
6
6
  "repository": "techniq/layerchart",
7
- "version": "0.60.1",
7
+ "version": "0.60.3",
8
8
  "devDependencies": {
9
9
  "@changesets/cli": "^2.27.10",
10
10
  "@mdi/js": "^7.4.47",
@@ -41,7 +41,7 @@
41
41
  "autoprefixer": "^10.4.20",
42
42
  "marked": "^15.0.3",
43
43
  "mdsvex": "^0.12.3",
44
- "posthog-js": "^1.95.1",
44
+ "posthog-js": "^1.203.1",
45
45
  "prettier": "^3.4.2",
46
46
  "prettier-plugin-svelte": "^3.3.2",
47
47
  "prism-svelte": "^0.5.0",
@@ -94,7 +94,6 @@
94
94
  "date-fns": "^4.1.0",
95
95
  "layercake": "^8.4.2",
96
96
  "lodash-es": "^4.17.21",
97
- "posthog-js": "^1.200.1",
98
97
  "shapefile": "^0.6.6",
99
98
  "topojson-client": "^3.1.0"
100
99
  },