svelteplot 0.2.6-next.0 → 0.2.6-next.2

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 (38) hide show
  1. package/dist/Plot.svelte +3 -3
  2. package/dist/Plot.svelte.d.ts +1 -1
  3. package/dist/core/Facet.svelte +1 -2
  4. package/dist/core/FacetGrid.svelte +1 -1
  5. package/dist/core/Plot.svelte +5 -4
  6. package/dist/helpers/autoScales.js +17 -3
  7. package/dist/helpers/callWithProps.d.ts +1 -1
  8. package/dist/helpers/callWithProps.js +1 -1
  9. package/dist/helpers/projection.js +1 -1
  10. package/dist/helpers/reduce.js +1 -1
  11. package/dist/helpers/resolve.js +0 -1
  12. package/dist/helpers/scales.d.ts +2 -2
  13. package/dist/helpers/scales.js +4 -4
  14. package/dist/marks/Arrow.svelte +0 -1
  15. package/dist/marks/AxisY.svelte +0 -2
  16. package/dist/marks/CellX.svelte +1 -1
  17. package/dist/marks/ColorLegend.svelte +1 -1
  18. package/dist/marks/DifferenceY.svelte +0 -1
  19. package/dist/marks/Dot.svelte +1 -1
  20. package/dist/marks/Geo.svelte +1 -3
  21. package/dist/marks/GridX.svelte +2 -2
  22. package/dist/marks/GridX.svelte.d.ts +2 -2
  23. package/dist/marks/GridY.svelte +1 -1
  24. package/dist/marks/Line.svelte +2 -2
  25. package/dist/marks/Line.svelte.d.ts +1 -1
  26. package/dist/marks/Rect.svelte +0 -3
  27. package/dist/marks/helpers/BaseAxisX.svelte +1 -1
  28. package/dist/marks/helpers/BaseAxisY.svelte +2 -2
  29. package/dist/marks/helpers/DotCanvas.svelte +0 -1
  30. package/dist/marks/helpers/GeoCanvas.svelte +1 -1
  31. package/dist/marks/helpers/MarkerPath.svelte +1 -1
  32. package/dist/marks/helpers/MarkerPath.svelte.d.ts +1 -1
  33. package/dist/marks/helpers/events.js +1 -1
  34. package/dist/transforms/bin.d.ts +1 -1
  35. package/dist/transforms/bin.js +3 -3
  36. package/dist/transforms/window.js +1 -1
  37. package/dist/types.d.ts +4 -0
  38. package/package.json +1 -1
package/dist/Plot.svelte CHANGED
@@ -4,7 +4,7 @@
4
4
  their data and channels and computes the shared scales.
5
5
 
6
6
  The Plot component is split into two parts. This is the outer Plot which
7
- provides convenient defaults and automatically adds axes etc to the grapihcs.
7
+ provides convenient defaults and automatically adds axes etc to the graphics.
8
8
  The downside is that it adds a bunch of imports that you may not be using.
9
9
  To help with this you can use the core/Plot component directly for a more
10
10
  low-level Plot wrapper.
@@ -74,7 +74,7 @@
74
74
  {#if restOptions.title}<h2>{restOptions.title}</h2>{/if}
75
75
  {#if restOptions.subtitle}<h3>{restOptions.subtitle}</h3>{/if}
76
76
  <!-- also pass on user header -->
77
- {#if userHeader}{@render userHeader()}{/if}
77
+ {#if userHeader}{@render userHeader?.()}{/if}
78
78
  {#if restOptions.color?.legend}
79
79
  <ColorLegend />
80
80
  {/if}
@@ -85,7 +85,7 @@
85
85
 
86
86
  {#snippet footer()}
87
87
  {#if restOptions.caption}<div>{restOptions.caption}</div>{/if}
88
- {#if userFooter}{@render userFooter()}{/if}
88
+ {#if userFooter}{@render userFooter?.()}{/if}
89
89
  {/snippet}
90
90
 
91
91
  <!-- There's a bug triggering RangeError: Maximum call stack size exceeded
@@ -5,7 +5,7 @@ import type { PlotOptions } from './types.js';
5
5
  * their data and channels and computes the shared scales.
6
6
  *
7
7
  * The Plot component is split into two parts. This is the outer Plot which
8
- * provides convenient defaults and automatically adds axes etc to the grapihcs.
8
+ * provides convenient defaults and automatically adds axes etc to the graphics.
9
9
  * The downside is that it adds a bunch of imports that you may not be using.
10
10
  * To help with this you can use the core/Plot component directly for a more
11
11
  * low-level Plot wrapper.
@@ -1,8 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { setContext, type Snippet } from 'svelte';
3
3
  import { resolveChannel } from '../helpers/resolve.js';
4
- import type { BaseMarkProps, DataRecord, PlotScale, RawValue } from '../types.js';
5
- import { identity } from '../helpers';
4
+ import type { BaseMarkProps, DataRecord, RawValue } from '../types.js';
6
5
 
7
6
  let {
8
7
  fx,
@@ -4,7 +4,7 @@
4
4
  marks for each facet domain value
5
5
  -->
6
6
  <script lang="ts">
7
- import { getContext, setContext, type Snippet } from 'svelte';
7
+ import { getContext, type Snippet } from 'svelte';
8
8
  import type { PlotContext, GenericMarkOptions, Mark } from '../types.js';
9
9
  import { scaleBand } from 'd3-scale';
10
10
  import Facet from './Facet.svelte';
@@ -62,6 +62,7 @@
62
62
  initialWidth: 500,
63
63
  inset: 0,
64
64
  colorScheme: 'turbo',
65
+ unknown: '#cccccc',
65
66
  dotRadius: 3,
66
67
  frame: false,
67
68
  axes: true,
@@ -160,7 +161,7 @@
160
161
  );
161
162
 
162
163
  // if the plot is showing filled dot marks we're using different defaults
163
- // for the symbol axis range, so we're passing on this info to the createScales
164
+ // for the symbol axis range, so we're passing on this info to the computeScales
164
165
  // function below
165
166
  const hasFilledDotMarks = $derived(
166
167
  !!explicitMarks.find((d) => d.type === 'dot' && d.options.fill)
@@ -471,7 +472,7 @@
471
472
  data-testid={testid}>
472
473
  {#if header}
473
474
  <div class="plot-header">
474
- {#if header}{@render header()}{/if}
475
+ {@render header?.()}
475
476
  </div>
476
477
  {/if}
477
478
  <div class="plot-body" bind:this={plotBody}>
@@ -500,11 +501,11 @@
500
501
  {/if}
501
502
  </FacetGrid>
502
503
  </svg>
503
- {#if overlay}<div class="plot-overlay">{@render overlay()}</div>{/if}
504
+ {#if overlay}<div class="plot-overlay">{@render overlay?.()}</div>{/if}
504
505
  </div>
505
506
  {#if footer}
506
507
  <figcaption class="plot-footer">
507
- {#if footer}{@render footer()}{/if}
508
+ {@render footer?.()}
508
509
  </figcaption>
509
510
  {/if}
510
511
  </figure>
@@ -5,6 +5,7 @@ import callWithProps from './callWithProps.js';
5
5
  import { interpolateLab, interpolateRound } from 'd3-interpolate';
6
6
  import { coalesce, maybeNumber } from './index.js';
7
7
  import { getLogTicks } from './getLogTicks.js';
8
+ import { isPlainObject } from 'es-toolkit';
8
9
  const Scales = {
9
10
  point: scalePoint,
10
11
  band: scaleBand,
@@ -102,10 +103,23 @@ export function autoScaleColor({ type, domain, scaleOptions, plotOptions, plotWi
102
103
  let fn;
103
104
  let range;
104
105
  // special treatment for color scales
105
- const { scheme, interpolate, pivot, n = type === 'threshold' ? domain.length + 1 : 9 } = scaleOptions;
106
+ const { scheme, interpolate, pivot, n = type === 'threshold' ? domain.length + 1 : 9, unknown = plotDefaults.unknown } = scaleOptions;
106
107
  if (type === 'categorical' || type === 'ordinal') {
107
108
  // categorical
108
- const scheme_ = scheme || plotDefaults.categoricalColorScheme;
109
+ let scheme_ = scheme || plotDefaults.categoricalColorScheme;
110
+ if (isPlainObject(scheme_)) {
111
+ const newScheme = Object.values(scheme_);
112
+ const newDomain = Object.keys(scheme_);
113
+ // for every value in domain that's not part of the scheme, map to unknown
114
+ for (const v of domain) {
115
+ if (scheme_[v] == null) {
116
+ newDomain.push(v);
117
+ newScheme.push(unknown);
118
+ }
119
+ }
120
+ domain = newDomain;
121
+ scheme_ = newScheme;
122
+ }
109
123
  // categorical scale
110
124
  range = Array.isArray(scheme_)
111
125
  ? scheme_
@@ -193,7 +207,7 @@ function getScaleRange(name, scaleOptions, plotOptions, plotWidth, plotHeight, p
193
207
  : name === 'r'
194
208
  ? [0, 10]
195
209
  : name === 'symbol'
196
- ? // Plot is smart enough to pick different default shapes depending on wether
210
+ ? // Plot is smart enough to pick different default shapes depending on whether
197
211
  // or not there are filled dot marks in the plot, so we have to pass this
198
212
  // information all the way here
199
213
  plotHasFilledDotMarks
@@ -2,7 +2,7 @@ import type { RawValue } from '../types.js';
2
2
  type Setter = (v: any) => void;
3
3
  /**
4
4
  * Helper function to call a D3 "function class" while also calling
5
- * porperty setter functions on the result.
5
+ * property setter functions on the result.
6
6
  */
7
7
  export default function (d3func: () => Record<string, Setter>, args: RawValue[], props?: Record<string, RawValue>): Record<string, Setter>;
8
8
  export {};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Helper function to call a D3 "function class" while also calling
3
- * porperty setter functions on the result.
3
+ * property setter functions on the result.
4
4
  */
5
5
  export default function (d3func, args, props = {}) {
6
6
  const res = d3func(...args);
@@ -1,5 +1,5 @@
1
1
  import { geoClipRectangle, geoPath, geoTransform } from 'd3-geo';
2
- import { constant, isObject, isValid } from './index.js';
2
+ import { constant, isObject } from './index.js';
3
3
  const identity = constant({ stream: (stream) => stream });
4
4
  const defaultAspectRatio = 0.618;
5
5
  export function createProjection({ projOptions, inset: globalInset = 2, insetTop = globalInset, insetRight = globalInset, insetBottom = globalInset, insetLeft = globalInset } = {}, dimensions) {
@@ -1,4 +1,4 @@
1
- import { min, max, mode, sum, mean, median, variance, deviation, quantile, range } from 'd3-array';
1
+ import { min, max, mode, sum, mean, median, variance, deviation, quantile } from 'd3-array';
2
2
  import { resolveChannel } from './resolve.js';
3
3
  import { POSITION_CHANNELS } from './index.js';
4
4
  const niceReduceNames = {
@@ -2,7 +2,6 @@ import { CHANNEL_SCALE } from '../constants.js';
2
2
  import isDataRecord from './isDataRecord.js';
3
3
  import isRawValue from './isRawValue.js';
4
4
  import { isValid } from './isValid.js';
5
- import { pick } from 'es-toolkit';
6
5
  import { getBaseStylesObject } from './getBaseStyles.js';
7
6
  import { RAW_VALUE } from '../transforms/recordize.js';
8
7
  export function resolveProp(accessor, datum, _defaultValue = null) {
@@ -30,9 +30,9 @@ export declare function createScale<T extends ScaleOptions>(name: ScaleName, sca
30
30
  */
31
31
  export declare function inferScaleType(name: ScaleName, dataValues: RawValue[], markTypes: Set<MarkType>): ScaleType;
32
32
  /**
33
- * Mark channels can explicitely or implicitely be exempt from being
33
+ * Mark channels can explicitly or implicitly be exempt from being
34
34
  * mapped to a scale, so everywhere where values are being mapped to
35
- * scales, we need to check if the the scale is supposed to be used
35
+ * scales, we need to check if the scale is supposed to be used
36
36
  * not. That's what this function is used for.
37
37
  */
38
38
  export declare function getUsedScales(plot: PlotState, options: GenericMarkOptions, mark: Mark<GenericMarkOptions>): UsedScales;
@@ -1,4 +1,4 @@
1
- import { extent, range as d3Range, ascending } from 'd3-array';
1
+ import { extent, ascending } from 'd3-array';
2
2
  import { isColorOrNull, isDateOrNull, isNumberOrNull, isNumberOrNullOrNaN, isStringOrNull } from './typeChecks.js';
3
3
  import { CHANNEL_SCALE, VALID_SCALE_TYPES } from '../constants.js';
4
4
  import { isSymbolOrNull } from './typeChecks.js';
@@ -247,9 +247,9 @@ const scaledChannelNames = [
247
247
  'length'
248
248
  ];
249
249
  /**
250
- * Mark channels can explicitely or implicitely be exempt from being
250
+ * Mark channels can explicitly or implicitly be exempt from being
251
251
  * mapped to a scale, so everywhere where values are being mapped to
252
- * scales, we need to check if the the scale is supposed to be used
252
+ * scales, we need to check if the scale is supposed to be used
253
253
  * not. That's what this function is used for.
254
254
  */
255
255
  export function getUsedScales(plot, options, mark) {
@@ -277,7 +277,7 @@ function looksLikeOpacity(input) {
277
277
  export function projectXY(scales, x, y, useXScale = true, useYScale = true) {
278
278
  if (scales.projection) {
279
279
  // TODO: pretty sure this is not how projection streams are supposed to be used
280
- // efficiantly, in observable plot, all data points of a mark are projected using
280
+ // efficiently, in observable plot, all data points of a mark are projected using
281
281
  // the same stream
282
282
  let x_, y_;
283
283
  const stream = scales.projection.stream({
@@ -9,7 +9,6 @@
9
9
  BaseMarkProps,
10
10
  ConstantAccessor,
11
11
  ChannelAccessor,
12
- FacetContext,
13
12
  RawValue
14
13
  } from '../types.js';
15
14
  import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
@@ -6,11 +6,9 @@
6
6
  PlotContext,
7
7
  BaseMarkProps,
8
8
  RawValue,
9
- DataRecord,
10
9
  FacetContext,
11
10
  DefaultOptions
12
11
  } from '../types.js';
13
- import getBaseStyles from '../helpers/getBaseStyles.js';
14
12
  import autoTimeFormat from '../helpers/autoTimeFormat.js';
15
13
  import type { ConstantAccessor } from '../types.js';
16
14
  import { autoTicks } from '../helpers/autoTicks.js';
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import Cell from './Cell.svelte';
3
- import { recordizeX, recordizeY } from '../index.js';
3
+ import { recordizeY } from '../index.js';
4
4
  import type { BaseMarkProps, DataRow, RectMarkProps } from '../types.js';
5
5
  import type { ChannelAccessor } from '../types.js';
6
6
 
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext } from 'svelte';
3
3
  import { Plot, AxisX, Frame } from '../index.js';
4
- import { symbol as d3Symbol, symbol } from 'd3-shape';
4
+ import { symbol as d3Symbol } from 'd3-shape';
5
5
  import { range as d3Range, extent } from 'd3-array';
6
6
  import { maybeSymbol } from '../helpers/symbols.js';
7
7
 
@@ -2,7 +2,6 @@
2
2
  import type {
3
3
  BaseMarkProps,
4
4
  ChannelAccessor,
5
- ConstantAccessor,
6
5
  CurveName,
7
6
  DataRecord,
8
7
  PlotContext
@@ -15,7 +15,7 @@
15
15
  import { sort } from '../index.js';
16
16
  import Mark from '../Mark.svelte';
17
17
  import DotCanvas from './helpers/DotCanvas.svelte';
18
- import { maybeData, testFilter, isValid } from '../helpers/index.js';
18
+ import { maybeData, isValid } from '../helpers/index.js';
19
19
  import { recordizeXY } from '../transforms/recordize.js';
20
20
  import { addEventHandlers } from './helpers/events.js';
21
21
 
@@ -4,9 +4,7 @@
4
4
  DataRecord,
5
5
  PlotContext,
6
6
  BaseMarkProps,
7
- FacetContext,
8
- ConstantAccessor,
9
- UsedScales
7
+ ConstantAccessor
10
8
  } from '../types.js';
11
9
  import Mark from '../Mark.svelte';
12
10
  import { geoPath } from 'd3-geo';
@@ -7,12 +7,12 @@
7
7
  import { testFilter } from '../helpers/index.js';
8
8
  import { RAW_VALUE } from '../transforms/recordize.js';
9
9
 
10
- type GrixXMarkProps = BaseMarkProps & {
10
+ type GridXMarkProps = BaseMarkProps & {
11
11
  data?: RawValue[];
12
12
  automatic?: boolean;
13
13
  };
14
14
 
15
- let { data = [], automatic = false, ...options }: GrixXMarkProps = $props();
15
+ let { data = [], automatic = false, ...options }: GridXMarkProps = $props();
16
16
 
17
17
  const { getPlotState } = getContext<PlotContext>('svelteplot');
18
18
  const plot = $derived(getPlotState());
@@ -1,8 +1,8 @@
1
1
  import type { BaseMarkProps, RawValue } from '../types.js';
2
- type GrixXMarkProps = BaseMarkProps & {
2
+ type GridXMarkProps = BaseMarkProps & {
3
3
  data?: RawValue[];
4
4
  automatic?: boolean;
5
5
  };
6
- declare const GridX: import("svelte").Component<GrixXMarkProps, {}, "">;
6
+ declare const GridX: import("svelte").Component<GridXMarkProps, {}, "">;
7
7
  type GridX = ReturnType<typeof GridX>;
8
8
  export default GridX;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext } from 'svelte';
3
3
  import Mark from '../Mark.svelte';
4
- import type { PlotContext, BaseMarkProps, RawValue, DataRecord } from '../types.js';
4
+ import type { PlotContext, BaseMarkProps, RawValue } from '../types.js';
5
5
  import { resolveChannel, resolveStyles } from '../helpers/resolve.js';
6
6
  import { autoTicks } from '../helpers/autoTicks.js';
7
7
  import { testFilter } from '../helpers/index.js';
@@ -41,7 +41,7 @@
41
41
  import MarkerPath from './helpers/MarkerPath.svelte';
42
42
  import { getContext } from 'svelte';
43
43
  import { resolveProp, resolveStyles } from '../helpers/resolve.js';
44
- import { line, type CurveFactory, type Line } from 'd3-shape';
44
+ import { line, type CurveFactory, type Line as D3Line } from 'd3-shape';
45
45
  import { geoPath } from 'd3-geo';
46
46
  import callWithProps from '../helpers/callWithProps.js';
47
47
  import { maybeCurve } from '../helpers/curves.js';
@@ -100,7 +100,7 @@
100
100
  const { getPlotState } = getContext<PlotContext>('svelteplot');
101
101
  const plot = $derived(getPlotState());
102
102
 
103
- const linePath: Line<ScaledDataRecord> = $derived(
103
+ const linePath: D3Line<ScaledDataRecord> = $derived(
104
104
  plot.scales.projection && curve === 'auto'
105
105
  ? sphereLine(plot.scales.projection)
106
106
  : callWithProps(line, [], {
@@ -21,7 +21,7 @@ export type BaseLineMarkProps = {
21
21
  lineClass?: ConstantAccessor<string>;
22
22
  canvas?: boolean;
23
23
  } & MarkerOptions;
24
- import { type CurveFactory, type Line } from 'd3-shape';
24
+ import { type CurveFactory } from 'd3-shape';
25
25
  import type { RawValue } from '../types.js';
26
26
  type LineMarkProps = BaseMarkProps & {
27
27
  x?: ChannelAccessor;
@@ -6,8 +6,6 @@
6
6
  import Mark from '../Mark.svelte';
7
7
  import { getContext } from 'svelte';
8
8
  import { intervalX, intervalY } from '../index.js';
9
- import { resolveProp, resolveStyles } from '../helpers/resolve.js';
10
- import { coalesce, maybeNumber } from '../helpers/index.js';
11
9
  import type {
12
10
  PlotContext,
13
11
  DataRecord,
@@ -15,7 +13,6 @@
15
13
  BaseRectMarkProps,
16
14
  ChannelAccessor
17
15
  } from '../types.js';
18
- import { addEventHandlers } from './helpers/events.js';
19
16
  import GroupMultiple from './helpers/GroupMultiple.svelte';
20
17
  import RectPath from './helpers/RectPath.svelte';
21
18
 
@@ -88,7 +88,7 @@
88
88
  const T = tickObjects.length;
89
89
  for (let i = 0; i < T; i++) {
90
90
  let j = i;
91
- // find the preceeding tick that was not hidden
91
+ // find the preceding tick that was not hidden
92
92
  do {
93
93
  j--;
94
94
  } while (j >= 0 && tickObjects[j].hidden);
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { getContext, tick, untrack } from 'svelte';
2
+ import { getContext, untrack } from 'svelte';
3
3
  import { randomId, testFilter } from '../../helpers/index.js';
4
4
  import { resolveProp, resolveStyles } from '../../helpers/resolve.js';
5
5
  import { max } from 'd3-array';
@@ -70,7 +70,7 @@
70
70
  const T = tickObjects.length;
71
71
  for (let i = 0; i < T; i++) {
72
72
  let j = i;
73
- // find the preceeding tick that was not hidden
73
+ // find the preceding tick that was not hidden
74
74
  do {
75
75
  j--;
76
76
  } while (j >= 0 && tickObjects[j].hidden);
@@ -6,7 +6,6 @@
6
6
  ScaledDataRecord,
7
7
  PlotContext
8
8
  } from '../../types.js';
9
- import { CSS_VAR } from '../../constants.js';
10
9
  import { resolveProp } from '../../helpers/resolve.js';
11
10
  import { maybeSymbol } from '../../helpers/symbols.js';
12
11
  import { symbol as d3Symbol } from 'd3-shape';
@@ -8,7 +8,7 @@
8
8
  } from '../../types.js';
9
9
  import { CSS_VAR } from '../../constants.js';
10
10
  import { resolveProp, resolveScaledStyleProps } from '../../helpers/resolve.js';
11
- import { getContext, untrack } from 'svelte';
11
+ import { getContext } from 'svelte';
12
12
  import { type GeoPath } from 'd3-geo';
13
13
  import CanvasLayer from './CanvasLayer.svelte';
14
14
  import type { Attachment } from 'svelte/attachments';
@@ -25,7 +25,7 @@
25
25
  datum: DataRecord;
26
26
  /**
27
27
  * the marker shape to use at the start of the path, defaults to
28
- * cirlce
28
+ * circle
29
29
  */
30
30
  markerStart?: boolean | MarkerShape;
31
31
  /**
@@ -8,7 +8,7 @@ type MarkerPathProps = BaseMarkProps & {
8
8
  datum: DataRecord;
9
9
  /**
10
10
  * the marker shape to use at the start of the path, defaults to
11
- * cirlce
11
+ * circle
12
12
  */
13
13
  markerStart?: boolean | MarkerShape;
14
14
  /**
@@ -1,4 +1,4 @@
1
- import { invert, pick } from 'es-toolkit';
1
+ import { pick } from 'es-toolkit';
2
2
  import { RAW_VALUE } from '../../transforms/recordize.js';
3
3
  import { INDEX } from '../../constants.js';
4
4
  /**
@@ -45,7 +45,7 @@ export declare function binX<T>({ data, ...channels }: TransformArg<T, DataRecor
45
45
  */
46
46
  export declare function binY<T>({ data, ...channels }: TransformArg<T, DataRecord>, options?: BinYOptions): TransformArg<T, DataRecord>;
47
47
  /**
48
- * for binning in x and y dimension simulatenously
48
+ * for binning in x and y dimension simultaneously
49
49
  */
50
50
  export declare function bin<T>({ data, ...channels }: TransformArg<T, DataRecord>, options?: BinOptions): TransformArg<T, DataRecord>;
51
51
  export {};
@@ -1,7 +1,7 @@
1
1
  import { resolveChannel } from '../helpers/resolve.js';
2
2
  import { maybeInterval } from '../helpers/autoTicks.js';
3
- import { bin as d3Bin, extent, groups as d3Groups, thresholdFreedmanDiaconis, thresholdScott, thresholdSturges } from 'd3-array';
4
- import { Reducer, reduceOutputs } from '../helpers/reduce.js';
3
+ import { bin as d3Bin, extent, thresholdFreedmanDiaconis, thresholdScott, thresholdSturges } from 'd3-array';
4
+ import { reduceOutputs } from '../helpers/reduce.js';
5
5
  import { groupFacetsAndZ } from '../helpers/group.js';
6
6
  import { isDate } from '../helpers/typeChecks.js';
7
7
  const ThresholdGenerators = {
@@ -87,7 +87,7 @@ export function binY({ data, ...channels }, options = { thresholds: 'auto', cumu
87
87
  return binBy('y', { data, ...channels }, options);
88
88
  }
89
89
  /**
90
- * for binning in x and y dimension simulatenously
90
+ * for binning in x and y dimension simultaneously
91
91
  */
92
92
  export function bin({ data, ...channels }, options = { thresholds: 'auto', cumulative: false }) {
93
93
  const { domain, thresholds = 'auto', interval, cumulative = false } = options;
@@ -1,6 +1,6 @@
1
1
  import { maybeInterval } from '../helpers/autoTicks.js';
2
2
  import { isValid } from '../helpers/index.js';
3
- import { Reducer, mayberReducer } from '../helpers/reduce.js';
3
+ import { mayberReducer } from '../helpers/reduce.js';
4
4
  import { resolveChannel } from '../helpers/resolve.js';
5
5
  import { groups as d3Groups } from 'd3-array';
6
6
  export function windowX(args, options) {
package/dist/types.d.ts CHANGED
@@ -339,6 +339,10 @@ export type PlotDefaults = {
339
339
  */
340
340
  numberFormat: Intl.NumberFormatOptions;
341
341
  markerDotRadius: number;
342
+ /**
343
+ * fallback color to be used for null/NA
344
+ */
345
+ unknown: string;
342
346
  css: (d: string) => string | undefined;
343
347
  };
344
348
  export type GenericMarkOptions = Record<string, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.2.6-next.0",
3
+ "version": "0.2.6-next.2",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",