svelteplot 0.0.1-alpha.2 → 0.0.1-alpha.20
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/dist/Plot.svelte +47 -41
- package/dist/Plot.svelte.d.ts +3 -3
- package/dist/classes/Mark.svelte.js +4 -0
- package/dist/classes/Plot.svelte.js +50 -24
- package/dist/classes/Scale.svelte.js +94 -0
- package/dist/contants.d.ts +3 -3
- package/dist/contants.js +18 -16
- package/dist/helpers/GroupMultiple.svelte.d.ts +3 -3
- package/dist/helpers/autoTimeFormat.d.ts +2 -2
- package/dist/helpers/autoTimeFormat.js +1 -1
- package/dist/helpers/callWithProps.d.ts +4 -0
- package/dist/helpers/callWithProps.js +9 -0
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/createScale.d.ts +2 -1
- package/dist/helpers/createScale.js +37 -16
- package/dist/helpers/curves.d.ts +3 -0
- package/dist/helpers/curves.js +42 -0
- package/dist/helpers/getBaseStyles.d.ts +1 -1
- package/dist/helpers/getBaseStyles.js +2 -3
- package/dist/helpers/getLogTicks.js +5 -5
- package/dist/helpers/isDataRecord.d.ts +1 -1
- package/dist/helpers/isRawValue.d.ts +2 -0
- package/dist/helpers/isRawValue.js +5 -0
- package/dist/helpers/resolveChannel.d.ts +6 -2
- package/dist/helpers/resolveChannel.js +16 -6
- package/dist/helpers/typeChecks.d.ts +1 -1
- package/dist/helpers/typeChecks.js +1 -1
- package/dist/helpers/wrapArray.d.ts +2 -2
- package/dist/helpers/wrapValueArray.d.ts +6 -0
- package/dist/helpers/wrapValueArray.js +5 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.js +17 -1
- package/dist/marks/Area.svelte +95 -0
- package/dist/marks/Area.svelte.d.ts +28 -0
- package/dist/marks/AreaX.svelte +11 -0
- package/dist/marks/AreaX.svelte.d.ts +30 -0
- package/dist/marks/AreaY.svelte +12 -0
- package/dist/marks/AreaY.svelte.d.ts +30 -0
- package/dist/marks/AxisX.svelte +17 -17
- package/dist/marks/AxisX.svelte.d.ts +3 -3
- package/dist/marks/AxisY.svelte +25 -11
- package/dist/marks/AxisY.svelte.d.ts +3 -3
- package/dist/marks/BarX.svelte +52 -0
- package/dist/marks/BarX.svelte.d.ts +25 -0
- package/dist/marks/BarY.svelte +52 -0
- package/dist/marks/BarY.svelte.d.ts +25 -0
- package/dist/marks/BaseMark.svelte +10 -3
- package/dist/marks/BaseMark.svelte.d.ts +5 -4
- package/dist/marks/ColorLegend.svelte +26 -24
- package/dist/marks/ColorLegend.svelte.d.ts +2 -2
- package/dist/marks/Dot.svelte +28 -43
- package/dist/marks/Dot.svelte.d.ts +11 -3
- package/dist/marks/DotX.svelte.d.ts +3 -3
- package/dist/marks/DotY.svelte.d.ts +3 -3
- package/dist/marks/Frame.svelte +1 -1
- package/dist/marks/Frame.svelte.d.ts +4 -4
- package/dist/marks/GridX.svelte +29 -18
- package/dist/marks/GridX.svelte.d.ts +6 -6
- package/dist/marks/GridY.svelte +17 -7
- package/dist/marks/GridY.svelte.d.ts +3 -3
- package/dist/marks/Line.svelte +28 -29
- package/dist/marks/Line.svelte.d.ts +15 -3
- package/dist/marks/LineX.svelte +5 -7
- package/dist/marks/LineX.svelte.d.ts +13 -6
- package/dist/marks/LineY.svelte +4 -6
- package/dist/marks/LineY.svelte.d.ts +14 -6
- package/dist/marks/RuleX.svelte +17 -9
- package/dist/marks/RuleX.svelte.d.ts +3 -3
- package/dist/marks/RuleY.svelte +17 -10
- package/dist/marks/RuleY.svelte.d.ts +3 -3
- package/dist/marks/SymbolLegend.svelte +17 -17
- package/dist/marks/SymbolLegend.svelte.d.ts +2 -2
- package/dist/marks/TickX.svelte +30 -0
- package/dist/marks/TickX.svelte.d.ts +15 -0
- package/dist/marks/TickY.svelte +30 -0
- package/dist/marks/TickY.svelte.d.ts +15 -0
- package/dist/transforms/normalize.d.ts +18 -0
- package/dist/transforms/normalize.js +25 -0
- package/dist/transforms/recordize.d.ts +3 -0
- package/dist/transforms/recordize.js +36 -0
- package/dist/transforms/rename.d.ts +4 -0
- package/dist/transforms/rename.js +10 -0
- package/dist/transforms/stack.d.ts +11 -0
- package/dist/transforms/stack.js +80 -0
- package/dist/types.d.ts +60 -23
- package/package.json +28 -23
- package/dist/classes/Channel.svelte.js +0 -72
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type {
|
|
3
|
-
import type { Plot } from './classes/Plot.svelte';
|
|
2
|
+
import type { SCALE_TYPES } from './contants.js';
|
|
3
|
+
import type { Plot } from './classes/Plot.svelte.js';
|
|
4
4
|
import type { MouseEventHandler } from 'svelte/elements';
|
|
5
|
+
export type ScaleName = 'opacity' | 'color' | 'x' | 'y' | 'angle' | 'radius' | 'symbol' | 'width' | 'fontSize';
|
|
5
6
|
export type Datasets = {
|
|
6
7
|
aapl: {
|
|
7
8
|
Date: Date;
|
|
@@ -11,6 +12,10 @@ export type Datasets = {
|
|
|
11
12
|
Close: number;
|
|
12
13
|
'Adj Close': number;
|
|
13
14
|
}[];
|
|
15
|
+
alphabet: {
|
|
16
|
+
letter: string;
|
|
17
|
+
frequency: number;
|
|
18
|
+
}[];
|
|
14
19
|
cars: {
|
|
15
20
|
name: string;
|
|
16
21
|
'economy (mpg)': number;
|
|
@@ -30,10 +35,37 @@ export type Datasets = {
|
|
|
30
35
|
body_mass_g: number;
|
|
31
36
|
sex: string;
|
|
32
37
|
}[];
|
|
38
|
+
bls: {
|
|
39
|
+
division: string;
|
|
40
|
+
date: Date;
|
|
41
|
+
unemployment: number;
|
|
42
|
+
}[];
|
|
43
|
+
stageage: {
|
|
44
|
+
state: string;
|
|
45
|
+
age: string;
|
|
46
|
+
population: number;
|
|
47
|
+
pop_share: number;
|
|
48
|
+
}[];
|
|
49
|
+
stocks: {
|
|
50
|
+
Symbol: string;
|
|
51
|
+
Date: Date;
|
|
52
|
+
Open: number;
|
|
53
|
+
High: number;
|
|
54
|
+
Low: number;
|
|
55
|
+
Close: number;
|
|
56
|
+
'Adj Close': number;
|
|
57
|
+
Volume: number;
|
|
58
|
+
}[];
|
|
59
|
+
riaa: {
|
|
60
|
+
format: string;
|
|
61
|
+
group: string;
|
|
62
|
+
year: Date;
|
|
63
|
+
revenue: number;
|
|
64
|
+
}[];
|
|
33
65
|
};
|
|
34
66
|
export type AxisXAnchor = 'bottom' | 'top' | 'both';
|
|
35
67
|
export type AxisYAnchor = 'left' | 'right' | 'both';
|
|
36
|
-
export type
|
|
68
|
+
export type PositionScaleOptions = Partial<{
|
|
37
69
|
label?: string | null;
|
|
38
70
|
domain?: [number, number] | null;
|
|
39
71
|
grid?: boolean;
|
|
@@ -42,7 +74,11 @@ export type PositionChannelOptions = Partial<{
|
|
|
42
74
|
log?: boolean;
|
|
43
75
|
reverse?: boolean;
|
|
44
76
|
}>;
|
|
77
|
+
export type ScaleType = 'linear' | 'pow' | 'sqrt' | 'log' | 'symlog' | 'time' | 'point' | 'band';
|
|
78
|
+
export type PositionScaleType = ScaleType | ('point' | 'band');
|
|
79
|
+
export type ColorScaleType = ScaleType | ('categorical' | 'sequential' | 'sequentialSymlog' | 'sequentialLog' | 'sequentialPow' | 'sequentialSqrt' | 'sequentialQuantile' | 'cyclical' | 'threshold' | 'quantile' | 'quantize' | 'diverging' | 'divergingLog' | 'divergingPow' | 'divergingSqrt' | 'divergingSymlog');
|
|
45
80
|
export type PlotProps = {
|
|
81
|
+
testid?: string;
|
|
46
82
|
height?: number | 'auto';
|
|
47
83
|
marginTop?: number;
|
|
48
84
|
marginBottom?: number;
|
|
@@ -63,13 +99,15 @@ export type PlotProps = {
|
|
|
63
99
|
radius?: {
|
|
64
100
|
range?: [number, number];
|
|
65
101
|
};
|
|
66
|
-
x?:
|
|
102
|
+
x?: PositionScaleOptions & {
|
|
103
|
+
type?: PositionScaleType;
|
|
67
104
|
axis?: AxisXAnchor | {
|
|
68
105
|
anchor: AxisXAnchor;
|
|
69
106
|
tickSpacing: number;
|
|
70
107
|
};
|
|
71
108
|
};
|
|
72
|
-
y?:
|
|
109
|
+
y?: PositionScaleOptions & {
|
|
110
|
+
type?: PositionScaleType;
|
|
73
111
|
axis?: AxisYAnchor | {
|
|
74
112
|
anchor: AxisYAnchor;
|
|
75
113
|
tickSpacing: number;
|
|
@@ -80,7 +118,10 @@ export type PlotProps = {
|
|
|
80
118
|
legend?: boolean;
|
|
81
119
|
} | null;
|
|
82
120
|
color?: {
|
|
83
|
-
|
|
121
|
+
type?: ColorScaleType;
|
|
122
|
+
range?: string[];
|
|
123
|
+
domain: RawValue[];
|
|
124
|
+
scheme?: ColorScheme;
|
|
84
125
|
legend?: boolean;
|
|
85
126
|
} | null;
|
|
86
127
|
};
|
|
@@ -95,13 +136,13 @@ export type GridProps = {
|
|
|
95
136
|
};
|
|
96
137
|
export type DataRecord = Record<string, RawValue>;
|
|
97
138
|
export type DataRow = DataRecord | RawValue | [number, number];
|
|
98
|
-
export type ChannelAccessor = RawValue | ((d: DataRow) => RawValue) | null;
|
|
139
|
+
export type ChannelAccessor = RawValue | ((d: DataRow) => RawValue) | null | undefined;
|
|
99
140
|
export type RawValue = number | Date | boolean | string | null;
|
|
100
|
-
export type ChannelName = 'opacity' | '
|
|
141
|
+
export type ChannelName = 'angle' | 'fill' | 'fillOpacity' | 'fontSize' | 'opacity' | 'r' | 'sort' | 'stroke' | 'strokeDasharray' | 'strokeOpacity' | 'symbol' | 'width' | 'x' | 'x1' | 'x2' | 'y' | 'y1' | 'y2' | 'z';
|
|
101
142
|
export type MarkStyleProps = 'strokeDasharray' | 'opacity' | 'fill' | 'fillOpacity' | 'fontSize' | 'stroke' | 'strokeWidth' | 'strokeOpacity' | 'x' | 'y' | 'angle' | 'radius' | 'symbol' | 'width';
|
|
102
143
|
export type MarkProps2 = 'x' | 'y' | 'r' | 'rotate' | 'symbol';
|
|
103
144
|
export type ValueOf<T> = T[keyof T];
|
|
104
|
-
export type ChannelType = ValueOf<typeof
|
|
145
|
+
export type ChannelType = ValueOf<typeof SCALE_TYPES>;
|
|
105
146
|
export interface MarkProps {
|
|
106
147
|
data: DataRow[];
|
|
107
148
|
}
|
|
@@ -120,20 +161,6 @@ export type BaseMarkStyleProps = {
|
|
|
120
161
|
strokeDasharray?: ChannelAccessor;
|
|
121
162
|
};
|
|
122
163
|
export type FrameProps = BaseMarkStyleProps;
|
|
123
|
-
export type DotMarkProps = MarkProps & BaseMarkStyleProps & {
|
|
124
|
-
data: DataRow[];
|
|
125
|
-
x?: ChannelAccessor;
|
|
126
|
-
y?: ChannelAccessor;
|
|
127
|
-
r?: ChannelAccessor;
|
|
128
|
-
rotate?: ChannelAccessor;
|
|
129
|
-
symbol?: ChannelAccessor;
|
|
130
|
-
};
|
|
131
|
-
export type LineMarkProps = MarkProps & BaseMarkStyleProps & {
|
|
132
|
-
data: DataRow[];
|
|
133
|
-
x?: ChannelAccessor;
|
|
134
|
-
y?: ChannelAccessor;
|
|
135
|
-
z?: ChannelAccessor;
|
|
136
|
-
};
|
|
137
164
|
export type GridOptions = {
|
|
138
165
|
ticks?: RawValue[];
|
|
139
166
|
strokeDasharray?: ChannelAccessor;
|
|
@@ -184,5 +211,15 @@ export type RuleYMarkProps = MarkProps & RuleMarkProps & {
|
|
|
184
211
|
x1?: ChannelAccessor;
|
|
185
212
|
x2?: ChannelAccessor;
|
|
186
213
|
};
|
|
214
|
+
export type TickMarkProps = MarkProps & {
|
|
215
|
+
x?: ChannelAccessor;
|
|
216
|
+
y?: ChannelAccessor;
|
|
217
|
+
stroke?: ChannelAccessor;
|
|
218
|
+
};
|
|
187
219
|
export type ColorScheme = 'brbg' | 'prgn' | 'piyg' | 'puor' | 'rdbu' | 'rdgy' | 'rdylbu' | 'rdylgn' | 'spectral' | 'burd' | 'buylrd' | 'blues' | 'greens' | 'greys' | 'oranges' | 'purples' | 'reds' | 'turbo' | 'viridis' | 'magma' | 'inferno' | 'plasma' | 'cividis' | 'cubehelix' | 'warm' | 'cool' | 'bugn' | 'bupu' | 'gnbu' | 'orrd' | 'pubu' | 'pubugn' | 'purd' | 'rdpu' | 'ylgn' | 'ylgnbu' | 'ylorbr' | 'ylorrd' | 'rainbow' | 'sinebow' | 'accent' | 'category10' | 'dark2' | 'paired' | 'pastel1' | 'pastel2' | 'set1' | 'set2' | 'set3' | 'tableau10';
|
|
220
|
+
export type Curve = 'basis' | 'basis-closed' | 'basis-open' | 'bundle' | 'bump-x' | 'bump-y' | 'cardinal' | 'cardinal-closed' | 'cardinal-open' | 'catmull-rom' | 'catmull-rom-closed' | 'catmull-rom-open' | 'linear' | 'linear-closed' | 'monotone-x' | 'monotone-y' | 'natural' | 'step' | 'step-after' | 'step-before';
|
|
221
|
+
type Channels = Partial<Record<ChannelName, ChannelAccessor>>;
|
|
222
|
+
export type TransformArg = Channels & {
|
|
223
|
+
data: DataRow[];
|
|
224
|
+
};
|
|
188
225
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelteplot",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.20",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"format": "prettier --write .",
|
|
13
13
|
"test:integration": "playwright test",
|
|
14
14
|
"test:unit": "vitest",
|
|
15
|
-
"prepack": "npx svelte-package"
|
|
15
|
+
"prepack": "npx svelte-package",
|
|
16
|
+
"release-alpha": "npm run build && npm version prerelease --preid alpha && npm publish"
|
|
16
17
|
},
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|
|
@@ -25,53 +26,57 @@
|
|
|
25
26
|
"!dist/**/*.test.*",
|
|
26
27
|
"!dist/**/*.spec.*"
|
|
27
28
|
],
|
|
28
|
-
"peerDependencies": {
|
|
29
|
-
"svelte": "^4.0.0"
|
|
30
|
-
},
|
|
31
29
|
"devDependencies": {
|
|
30
|
+
"@sveltejs/package": "^2.2.5",
|
|
32
31
|
"@playwright/test": "^1.40.1",
|
|
33
|
-
"@sveltejs/adapter-auto": "^
|
|
34
|
-
"@sveltejs/kit": "^
|
|
32
|
+
"@sveltejs/adapter-auto": "^3.1.0",
|
|
33
|
+
"@sveltejs/kit": "^2.3.2",
|
|
35
34
|
"@types/chroma-js": "^2.4.3",
|
|
35
|
+
"@types/d3-dsv": "^3.0.7",
|
|
36
36
|
"@types/d3-interpolate": "^3.0.4",
|
|
37
|
+
"@types/d3-random": "^3.0.3",
|
|
37
38
|
"@types/d3-scale-chromatic": "^3.0.3",
|
|
38
39
|
"@types/d3-shape": "^3.1.6",
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
40
|
+
"@types/d3-array": "^3.2.1",
|
|
41
|
+
"@types/d3-scale": "^4.0.8",
|
|
42
|
+
"@types/underscore": "^1.11.15",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
44
|
+
"@typescript-eslint/parser": "^6.19.0",
|
|
45
|
+
"@sveltejs/vite-plugin-svelte": "^3.0.1",
|
|
46
|
+
"@sveltepress/theme-default": "^1.22.3",
|
|
47
|
+
"@sveltepress/vite": "^0.31.3",
|
|
41
48
|
"bulma": "^0.9.4",
|
|
42
49
|
"d3-dsv": "^3.0.1",
|
|
43
|
-
"
|
|
44
|
-
"eslint": "^8.55.0",
|
|
50
|
+
"eslint": "^8.56.0",
|
|
45
51
|
"eslint-config-prettier": "^9.1.0",
|
|
46
52
|
"eslint-plugin-svelte": "^2.35.1",
|
|
47
53
|
"highlight.js": "^11.9.0",
|
|
48
54
|
"highlightjs-svelte": "^1.0.6",
|
|
49
|
-
"prettier": "^3.
|
|
55
|
+
"prettier": "^3.2.2",
|
|
50
56
|
"prettier-plugin-svelte": "^3.1.2",
|
|
51
|
-
"sass": "^1.69.
|
|
52
|
-
"svelte": "5.0.0-next.
|
|
53
|
-
"svelte-check": "^3.6.
|
|
54
|
-
"svelte-highlight": "^7.4.
|
|
57
|
+
"sass": "^1.69.7",
|
|
58
|
+
"svelte": "5.0.0-next.35",
|
|
59
|
+
"svelte-check": "^3.6.3",
|
|
60
|
+
"svelte-highlight": "^7.4.8",
|
|
55
61
|
"tslib": "^2.6.2",
|
|
56
|
-
"typescript": "^5.3.
|
|
57
|
-
"vite": "^5.0.
|
|
58
|
-
"vitest": "^1.0
|
|
62
|
+
"typescript": "^5.3.3",
|
|
63
|
+
"vite": "^5.0.11",
|
|
64
|
+
"vitest": "^1.2.0"
|
|
59
65
|
},
|
|
60
66
|
"svelte": "./dist/index.js",
|
|
61
67
|
"types": "./dist/index.d.ts",
|
|
62
68
|
"type": "module",
|
|
63
69
|
"dependencies": {
|
|
64
|
-
"@
|
|
65
|
-
"@types/d3-array": "^3.2.1",
|
|
66
|
-
"@types/d3-scale": "^4.0.8",
|
|
67
|
-
"@types/underscore": "^1.11.15",
|
|
70
|
+
"@observablehq/plot": "^0.6.13",
|
|
68
71
|
"chroma-js": "^2.4.2",
|
|
69
72
|
"d3-array": "^3.2.4",
|
|
70
73
|
"d3-interpolate": "^3.0.1",
|
|
74
|
+
"d3-random": "^3.0.1",
|
|
71
75
|
"d3-scale": "^4.0.2",
|
|
72
76
|
"d3-scale-chromatic": "^3.0.0",
|
|
73
77
|
"d3-shape": "^3.2.0",
|
|
74
78
|
"d3-time-format": "^4.1.0",
|
|
79
|
+
"dayjs": "^1.11.10",
|
|
75
80
|
"merge-deep": "^3.0.3",
|
|
76
81
|
"underscore": "^1.13.6"
|
|
77
82
|
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import resolveChannel from '../helpers/resolveChannel';
|
|
2
|
-
import { extent } from 'd3-array';
|
|
3
|
-
import { MARK_PROP_CHANNEL, CHANNEL_TYPES } from '../contants';
|
|
4
|
-
import { isBooleanOrNull, isColorOrNull, isDateOrNull, isNumberOrNull, isStringOrNull } from '../helpers/typeChecks';
|
|
5
|
-
import { uniq } from 'underscore';
|
|
6
|
-
export class Channel {
|
|
7
|
-
name = undefined;
|
|
8
|
-
plot = undefined;
|
|
9
|
-
constructor(name, plot) {
|
|
10
|
-
this.name = name;
|
|
11
|
-
this.plot = plot;
|
|
12
|
-
}
|
|
13
|
-
// readonly type: ChannelType = CHANNEL_TYPES.position;
|
|
14
|
-
// all marks that have this channel
|
|
15
|
-
marks = $derived(this.plot?.marks ?? []);
|
|
16
|
-
forceDomain = $derived(this.plot && (this.name === 'x' || this.name === 'y')
|
|
17
|
-
? this.plot.options[this.name]?.domain || null
|
|
18
|
-
: null);
|
|
19
|
-
possibleProps = $derived(Object.entries(MARK_PROP_CHANNEL)
|
|
20
|
-
.filter(([, channel]) => channel === this.name)
|
|
21
|
-
.map(([prop]) => prop));
|
|
22
|
-
activeMarks = $derived(this.marks.filter((mark) => mark.channels.has(this.name) && this.possibleProps.find((prop) => mark.props[prop])));
|
|
23
|
-
manualActiveMarks = $derived(this.activeMarks.filter((mark) => !mark.automatic));
|
|
24
|
-
autoTitle = $derived(this.manualActiveMarks.length === 1 &&
|
|
25
|
-
typeof this.manualActiveMarks[0].props?.[this.name] === 'string'
|
|
26
|
-
? this.manualActiveMarks[0].props?.[this.name]
|
|
27
|
-
: null);
|
|
28
|
-
uniqueMarkProps = $derived(uniq(this.manualActiveMarks
|
|
29
|
-
.map((mark) => this.possibleProps
|
|
30
|
-
.filter((prop) => mark.props[prop])
|
|
31
|
-
.map((prop) => mark.props[prop]))
|
|
32
|
-
.flat(2)));
|
|
33
|
-
dataValues = $derived([
|
|
34
|
-
...this.activeMarks
|
|
35
|
-
// only check marks with data
|
|
36
|
-
.filter((mark) => mark.props.data.length)
|
|
37
|
-
.map((mark) => this.possibleProps.map((prop) => mark.props.data.map((row) => resolveChannel(this.name, row, mark.props[prop]))))
|
|
38
|
-
.flat(3)
|
|
39
|
-
.filter((d) => d != null),
|
|
40
|
-
...(this.forceDomain || [])
|
|
41
|
-
]);
|
|
42
|
-
valueType = $derived(this.dataValues.every((v) => v == null)
|
|
43
|
-
? 'null'
|
|
44
|
-
: this.dataValues.every(isColorOrNull)
|
|
45
|
-
? 'color'
|
|
46
|
-
: this.dataValues.every(isBooleanOrNull)
|
|
47
|
-
? 'boolean'
|
|
48
|
-
: this.dataValues.every(isStringOrNull)
|
|
49
|
-
? 'text'
|
|
50
|
-
: this.dataValues.every(isNumberOrNull)
|
|
51
|
-
? 'number'
|
|
52
|
-
: this.dataValues.every(isDateOrNull)
|
|
53
|
-
? 'date'
|
|
54
|
-
: 'mixed');
|
|
55
|
-
domain = $derived(!this.dataValues.length
|
|
56
|
-
? [0, 1]
|
|
57
|
-
: this.valueType === 'boolean' ||
|
|
58
|
-
this.valueType === 'text' ||
|
|
59
|
-
this.valueType === 'color'
|
|
60
|
-
? uniq(this.dataValues)
|
|
61
|
-
: extent(this.dataValues));
|
|
62
|
-
scaleType = $derived(this.name === 'radius'
|
|
63
|
-
? 'sqrt'
|
|
64
|
-
: this.valueType === 'date'
|
|
65
|
-
? 'time'
|
|
66
|
-
: this.valueType === 'number'
|
|
67
|
-
? 'linear'
|
|
68
|
-
: this.valueType === 'text'
|
|
69
|
-
? 'band'
|
|
70
|
-
: 'linear');
|
|
71
|
-
}
|
|
72
|
-
// opacity: typeof === 'number' && between [0,1]
|