svelteplot 0.5.1-pr-245.3 → 0.5.1-pr-249.0

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.
@@ -14,6 +14,7 @@
14
14
  sort?: ConstantAccessor<RawValue> | { channel: 'stroke' | 'fill' };
15
15
  stack?: Partial<StackOptions>;
16
16
  canvas?: boolean;
17
+ areaClass?: ConstantAccessor<string, Datum>;
17
18
  }
18
19
 
19
20
  import Mark from '../Mark.svelte';
@@ -37,7 +38,6 @@
37
38
  ChannelAccessor,
38
39
  ScaledDataRecord,
39
40
  LinkableMarkProps,
40
- PlotDefaults,
41
41
  RawValue
42
42
  } from '../types/index.js';
43
43
  import type { StackOptions } from '../transforms/stack.js';
@@ -59,6 +59,7 @@
59
59
  curve = 'linear' as CurveName,
60
60
  tension = 0,
61
61
  class: className = '',
62
+ areaClass,
62
63
  canvas = false,
63
64
  ...options
64
65
  }: AreaMarkProps = $derived({ ...DEFAULTS, ...markProps });
@@ -120,7 +121,7 @@
120
121
  {#if canvas}
121
122
  <AreaCanvas groupedAreaData={grouped} {mark} {usedScales} {areaPath} />
122
123
  {:else}
123
- <GroupMultiple length={grouped.length}>
124
+ <GroupMultiple class={className} length={grouped.length}>
124
125
  {#each grouped as areaData, i (i)}
125
126
  {@const datum = areaData[0]}
126
127
  {#if areaData.length > 0}
@@ -134,7 +135,11 @@
134
135
  usedScales
135
136
  )}
136
137
  <path
137
- class={['svelteplot-area', className, styleClass]}
138
+ class={[
139
+ 'area',
140
+ resolveProp(areaClass, areaData[0].datum),
141
+ styleClass
142
+ ]}
138
143
  clip-path={options.clipPath}
139
144
  d={areaPath(areaData)}
140
145
  {@attach addEventHandlers({
@@ -79,6 +79,7 @@ declare class __sveltets_Render<Datum extends DataRecord> {
79
79
  };
80
80
  stack?: Partial<StackOptions>;
81
81
  canvas?: boolean;
82
+ areaClass?: ConstantAccessor<string, Datum>;
82
83
  };
83
84
  events(): {};
84
85
  slots(): {};
@@ -77,6 +77,7 @@ declare class __sveltets_Render<Datum extends DataRow> {
77
77
  };
78
78
  stack?: Partial<renameChannels>;
79
79
  canvas?: boolean;
80
+ areaClass?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
80
81
  }, "y1" | "y2"> & {
81
82
  x?: ChannelAccessor<Datum>;
82
83
  y?: ChannelAccessor<Datum>;
@@ -5,7 +5,7 @@ export type StackOptions = {
5
5
  offset: null | StackOffset;
6
6
  order: null | StackOrder;
7
7
  reverse: boolean;
8
- };
8
+ } | false;
9
9
  export declare function stackY<T>({ data, ...channels }: TransformArg<T>, opts?: Partial<StackOptions>): TransformArg<T>;
10
10
  export declare function stackX<T>({ data, ...channels }: TransformArg<T>, opts?: Partial<StackOptions>): TransformArg<T>;
11
11
  export declare function stackMosaicX<T>(args: any, opts: any): any;
@@ -38,6 +38,10 @@ const STACK_OFFSET = {
38
38
  normalize: stackOffsetExpand
39
39
  };
40
40
  function stackXY(byDim, data, channels, options) {
41
+ if (options === false) {
42
+ // no stacking
43
+ return { data, ...channels };
44
+ }
41
45
  // we need to stack the data for each facet separately
42
46
  const groupFacetsBy = [
43
47
  channels.fx != null ? 'fx' : null,
@@ -158,6 +162,8 @@ export function stackX({ data, ...channels }, opts = {}) {
158
162
  return stackXY('x', data, channels, applyDefaults(opts));
159
163
  }
160
164
  function applyDefaults(opts) {
165
+ if (opts === false)
166
+ return false;
161
167
  if (opts.offset === 'wiggle' && opts.order === undefined) {
162
168
  return { ...DEFAULT_STACK_OPTIONS, order: 'inside-out', ...opts };
163
169
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.5.1-pr-245.3",
3
+ "version": "0.5.1-pr-249.0",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",