@kanaries/graphic-walker 0.4.1 → 0.4.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.
- package/dist/App.d.ts +5 -1
- package/dist/assets/buildMetricTable.worker-5555966a.js.map +1 -0
- package/dist/components/leafletRenderer/ChoroplethRenderer.d.ts +22 -0
- package/dist/components/leafletRenderer/POIRenderer.d.ts +20 -0
- package/dist/components/leafletRenderer/encodings.d.ts +7 -0
- package/dist/components/leafletRenderer/geoConfigPanel.d.ts +3 -0
- package/dist/components/leafletRenderer/index.d.ts +15 -0
- package/dist/components/leafletRenderer/tooltip.d.ts +9 -0
- package/dist/components/leafletRenderer/utils.d.ts +2 -0
- package/dist/components/pivotTable/index.d.ts +2 -1
- package/dist/components/pivotTable/inteface.d.ts +6 -2
- package/dist/components/pivotTable/leftTree.d.ts +1 -0
- package/dist/components/pivotTable/topTree.d.ts +2 -0
- package/dist/components/pivotTable/utils.d.ts +1 -2
- package/dist/config.d.ts +3 -2
- package/dist/graphic-walker.es.js +37811 -30386
- package/dist/graphic-walker.es.js.map +1 -1
- package/dist/graphic-walker.umd.js +145 -137
- package/dist/graphic-walker.umd.js.map +1 -1
- package/dist/interfaces.d.ts +28 -0
- package/dist/renderer/specRenderer.d.ts +2 -1
- package/dist/services.d.ts +7 -1
- package/dist/store/commonStore.d.ts +6 -0
- package/dist/store/visualSpecStore.d.ts +180 -4
- package/dist/utils/save.d.ts +1 -0
- package/dist/workers/buildPivotTable.d.ts +7 -0
- package/package.json +14 -2
- package/src/App.tsx +18 -4
- package/src/components/leafletRenderer/ChoroplethRenderer.tsx +312 -0
- package/src/components/leafletRenderer/POIRenderer.tsx +189 -0
- package/src/components/leafletRenderer/encodings.ts +194 -0
- package/src/components/leafletRenderer/geoConfigPanel.tsx +197 -0
- package/src/components/leafletRenderer/index.tsx +70 -0
- package/src/components/leafletRenderer/tooltip.tsx +24 -0
- package/src/components/leafletRenderer/utils.ts +52 -0
- package/src/components/pivotTable/index.tsx +171 -67
- package/src/components/pivotTable/inteface.ts +6 -2
- package/src/components/pivotTable/leftTree.tsx +24 -11
- package/src/components/pivotTable/metricTable.tsx +15 -10
- package/src/components/pivotTable/topTree.tsx +50 -17
- package/src/components/pivotTable/utils.ts +70 -11
- package/src/components/visualConfig/index.tsx +17 -1
- package/src/config.ts +27 -16
- package/src/dataSource/table.tsx +7 -11
- package/src/fields/aestheticFields.tsx +4 -0
- package/src/fields/fieldsContext.tsx +3 -0
- package/src/fields/posFields/index.tsx +8 -2
- package/src/global.d.ts +4 -4
- package/src/index.tsx +11 -9
- package/src/interfaces.ts +35 -0
- package/src/locales/en-US.json +27 -2
- package/src/locales/ja-JP.json +27 -2
- package/src/locales/zh-CN.json +27 -2
- package/src/renderer/hooks.ts +1 -1
- package/src/renderer/index.tsx +24 -1
- package/src/renderer/pureRenderer.tsx +27 -13
- package/src/renderer/specRenderer.tsx +46 -30
- package/src/services.ts +32 -23
- package/src/shadow-dom.tsx +7 -0
- package/src/store/commonStore.ts +29 -1
- package/src/store/visualSpecStore.ts +38 -23
- package/src/utils/save.ts +28 -1
- package/src/utils/vegaApiExport.ts +3 -0
- package/src/visualSettings/index.tsx +58 -6
- package/src/workers/buildMetricTable.worker.js +27 -0
- package/src/workers/buildPivotTable.ts +27 -0
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Config as VgConfig, View } from 'vega';
|
|
2
2
|
import { Config as VlConfig } from 'vega-lite';
|
|
3
|
+
import type { FeatureCollection } from 'geojson';
|
|
4
|
+
import type { feature } from 'topojson-client';
|
|
3
5
|
import type { IViewQuery } from "./lib/viewQuery";
|
|
4
6
|
export type DeepReadonly<T extends Record<keyof any, any>> = {
|
|
5
7
|
readonly [K in keyof T]: T[K] extends Record<keyof any, any> ? DeepReadonly<T[K]> : T[K];
|
|
@@ -75,6 +77,7 @@ export interface IExpression {
|
|
|
75
77
|
params: IExpParamter[];
|
|
76
78
|
as: string;
|
|
77
79
|
}
|
|
80
|
+
export type IGeoRole = 'longitude' | 'latitude' | 'none';
|
|
78
81
|
export interface IField {
|
|
79
82
|
/**
|
|
80
83
|
* fid: key in data record
|
|
@@ -90,6 +93,7 @@ export interface IField {
|
|
|
90
93
|
aggName?: string;
|
|
91
94
|
semanticType: ISemanticType;
|
|
92
95
|
analyticType: IAnalyticType;
|
|
96
|
+
geoRole?: IGeoRole;
|
|
93
97
|
cmp?: (a: any, b: any) => number;
|
|
94
98
|
computed?: boolean;
|
|
95
99
|
expression?: IExpression;
|
|
@@ -162,6 +166,9 @@ export interface DraggableFieldState {
|
|
|
162
166
|
shape: IViewField[];
|
|
163
167
|
theta: IViewField[];
|
|
164
168
|
radius: IViewField[];
|
|
169
|
+
longitude: IViewField[];
|
|
170
|
+
latitude: IViewField[];
|
|
171
|
+
geoId: IViewField[];
|
|
165
172
|
details: IViewField[];
|
|
166
173
|
filters: IFilterField[];
|
|
167
174
|
text: IViewField[];
|
|
@@ -181,14 +188,20 @@ export type IFilterRule = {
|
|
|
181
188
|
value: Set<string | number>;
|
|
182
189
|
};
|
|
183
190
|
export type IStackMode = 'none' | 'stack' | 'normalize' | 'zero' | 'center';
|
|
191
|
+
export type ICoordMode = 'generic' | 'geographic';
|
|
184
192
|
export interface IVisualConfig {
|
|
185
193
|
defaultAggregated: boolean;
|
|
186
194
|
geoms: string[];
|
|
195
|
+
showTableSummary: boolean;
|
|
196
|
+
/** @default "generic" */
|
|
197
|
+
coordSystem?: ICoordMode;
|
|
187
198
|
stack: IStackMode;
|
|
188
199
|
showActions: boolean;
|
|
189
200
|
interactiveScale: boolean;
|
|
190
201
|
sorted: ISortMode;
|
|
191
202
|
zeroScale: boolean;
|
|
203
|
+
/** @default false */
|
|
204
|
+
scaleIncludeUnmatchedChoropleth?: boolean;
|
|
192
205
|
background?: string;
|
|
193
206
|
format: {
|
|
194
207
|
numberFormat?: string;
|
|
@@ -208,6 +221,8 @@ export interface IVisualConfig {
|
|
|
208
221
|
width: number;
|
|
209
222
|
height: number;
|
|
210
223
|
};
|
|
224
|
+
geojson?: FeatureCollection;
|
|
225
|
+
geoKey?: string;
|
|
211
226
|
limit: number;
|
|
212
227
|
}
|
|
213
228
|
export interface IVisSpec {
|
|
@@ -255,6 +270,7 @@ export interface IChartExportResult<T extends 'svg' | 'data-url' = 'svg' | 'data
|
|
|
255
270
|
canvas(): HTMLCanvasElement | null;
|
|
256
271
|
}[];
|
|
257
272
|
container(): HTMLDivElement | null;
|
|
273
|
+
chartType?: string;
|
|
258
274
|
}
|
|
259
275
|
interface IExportChart {
|
|
260
276
|
<T extends Extract<IChartExportResult['mode'], 'svg'>>(mode?: T): Promise<IChartExportResult<T>>;
|
|
@@ -388,4 +404,16 @@ export type IResponse<T> = ({
|
|
|
388
404
|
options?: Record<string, string>;
|
|
389
405
|
};
|
|
390
406
|
});
|
|
407
|
+
export type Topology = Parameters<typeof feature>[0];
|
|
408
|
+
export type IGeographicData = ({
|
|
409
|
+
type: 'GeoJSON';
|
|
410
|
+
data: FeatureCollection;
|
|
411
|
+
} | {
|
|
412
|
+
type: 'TopoJSON';
|
|
413
|
+
data: Topology;
|
|
414
|
+
/**
|
|
415
|
+
* default to the first key of `objects` in Topology
|
|
416
|
+
*/
|
|
417
|
+
objectKey?: string;
|
|
418
|
+
});
|
|
391
419
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IReactVegaHandler } from '../vis/react-vega';
|
|
3
|
-
import { DeepReadonly, DraggableFieldState, IDarkMode, IRow, IThemeKey, IVisualConfig } from '../interfaces';
|
|
3
|
+
import { DeepReadonly, DraggableFieldState, IDarkMode, IRow, IThemeKey, IVisualConfig, IComputationFunction } from '../interfaces';
|
|
4
4
|
interface SpecRendererProps {
|
|
5
5
|
name?: string;
|
|
6
6
|
themeKey?: IThemeKey;
|
|
@@ -12,6 +12,7 @@ interface SpecRendererProps {
|
|
|
12
12
|
onGeomClick?: ((values: any, e: any) => void) | undefined;
|
|
13
13
|
onChartResize?: ((width: number, height: number) => void) | undefined;
|
|
14
14
|
locale?: string;
|
|
15
|
+
computationFunction: IComputationFunction;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Sans-store renderer of GraphicWalker.
|
package/dist/services.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IRow, Specification, IFilterFiledSimple, IExpression } from './interfaces';
|
|
1
|
+
import { IRow, IViewField, Specification, IFilterFiledSimple, IExpression } from './interfaces';
|
|
2
|
+
import { INestNode } from "./components/pivotTable/inteface";
|
|
2
3
|
import { IViewQuery } from './lib/viewQuery';
|
|
3
4
|
export interface IVisSpace {
|
|
4
5
|
dataView: IRow[];
|
|
@@ -10,4 +11,9 @@ export declare const transformDataService: (data: IRow[], trans: {
|
|
|
10
11
|
expression: IExpression;
|
|
11
12
|
}[]) => Promise<IRow[]>;
|
|
12
13
|
export declare const applyViewQuery: (data: IRow[], query: IViewQuery) => Promise<IRow[]>;
|
|
14
|
+
export declare const buildPivotTableService: (dimsInRow: IViewField[], dimsInColumn: IViewField[], allData: IRow[], aggData: IRow[], collapsedKeyList: string[], showTableSummary: boolean) => Promise<{
|
|
15
|
+
lt: INestNode;
|
|
16
|
+
tt: INestNode;
|
|
17
|
+
metric: (IRow | null)[][];
|
|
18
|
+
}>;
|
|
13
19
|
export declare const applySort: (data: IRow[], viewMeasures: string[], sort: 'ascending' | 'descending') => Promise<IRow[]>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DataSet, Filters, IDataSet, IDataSetInfo, IDataSource, IMutField, IRow, ISegmentKey } from '../interfaces';
|
|
2
|
+
import { INestNode } from '../components/pivotTable/inteface';
|
|
2
3
|
export declare class CommonStore {
|
|
3
4
|
datasets: IDataSet[];
|
|
4
5
|
dataSources: IDataSource[];
|
|
@@ -15,8 +16,10 @@ export declare class CommonStore {
|
|
|
15
16
|
showDataConfig: boolean;
|
|
16
17
|
showCodeExportPanel: boolean;
|
|
17
18
|
showVisualConfigPanel: boolean;
|
|
19
|
+
showGeoJSONConfigPanel: boolean;
|
|
18
20
|
filters: Filters;
|
|
19
21
|
segmentKey: ISegmentKey;
|
|
22
|
+
tableCollapsedHeaderMap: Map<string, INestNode["path"]>;
|
|
20
23
|
constructor();
|
|
21
24
|
get currentDataset(): DataSet;
|
|
22
25
|
setSegmentKey(sk: ISegmentKey): void;
|
|
@@ -26,6 +29,9 @@ export declare class CommonStore {
|
|
|
26
29
|
showEmbededMenu(position: [number, number]): void;
|
|
27
30
|
setShowCodeExportPanel(show: boolean): void;
|
|
28
31
|
setShowVisualConfigPanel(show: boolean): void;
|
|
32
|
+
updateTableCollapsedHeader(node: INestNode): void;
|
|
33
|
+
resetTableCollapsedHeader(): void;
|
|
34
|
+
setShowGeoJSONConfigPanel(show: boolean): void;
|
|
29
35
|
closeEmbededMenu(): void;
|
|
30
36
|
initTempDS(): void;
|
|
31
37
|
updateTempFields(fields: IMutField[]): void;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { DataSet, DraggableFieldState, IFilterRule, ISortMode, IStackMode, IViewField, IVisualConfig, Specification, IComputationFunction } from '../interfaces';
|
|
1
|
+
import { DataSet, DraggableFieldState, IFilterRule, IGeographicData, ISortMode, IStackMode, IViewField, IVisualConfig, Specification, IComputationFunction } from '../interfaces';
|
|
2
2
|
import { VisSpecWithHistory } from '../models/visSpecHistory';
|
|
3
3
|
import { IStoInfo } from '../utils/save';
|
|
4
4
|
import { CommonStore } from './commonStore';
|
|
5
|
-
export declare function initEncoding(): DraggableFieldState;
|
|
6
5
|
type DeepReadonly<T extends Record<keyof any, any>> = {
|
|
7
6
|
readonly [K in keyof T]: T[K] extends Record<keyof any, any> ? DeepReadonly<T[K]> : T[K];
|
|
8
7
|
};
|
|
@@ -46,7 +45,7 @@ export declare class VizSpecStore {
|
|
|
46
45
|
canUndo: boolean;
|
|
47
46
|
canRedo: boolean;
|
|
48
47
|
editingFilterIdx: number | null;
|
|
49
|
-
|
|
48
|
+
computationFunction: IComputationFunction;
|
|
50
49
|
constructor(commonStore: CommonStore);
|
|
51
50
|
private __dangerous_is_inside_useMutable__;
|
|
52
51
|
/**
|
|
@@ -129,6 +128,7 @@ export declare class VizSpecStore {
|
|
|
129
128
|
readonly aggName?: string | undefined;
|
|
130
129
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
131
130
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
131
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
132
132
|
readonly cmp?: {} | undefined;
|
|
133
133
|
readonly computed?: boolean | undefined;
|
|
134
134
|
readonly expression?: {
|
|
@@ -159,6 +159,7 @@ export declare class VizSpecStore {
|
|
|
159
159
|
readonly aggName?: string | undefined;
|
|
160
160
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
161
161
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
162
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
162
163
|
readonly cmp?: {} | undefined;
|
|
163
164
|
readonly computed?: boolean | undefined;
|
|
164
165
|
readonly expression?: {
|
|
@@ -189,6 +190,7 @@ export declare class VizSpecStore {
|
|
|
189
190
|
readonly aggName?: string | undefined;
|
|
190
191
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
191
192
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
193
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
192
194
|
readonly cmp?: {} | undefined;
|
|
193
195
|
readonly computed?: boolean | undefined;
|
|
194
196
|
readonly expression?: {
|
|
@@ -219,6 +221,7 @@ export declare class VizSpecStore {
|
|
|
219
221
|
readonly aggName?: string | undefined;
|
|
220
222
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
221
223
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
224
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
222
225
|
readonly cmp?: {} | undefined;
|
|
223
226
|
readonly computed?: boolean | undefined;
|
|
224
227
|
readonly expression?: {
|
|
@@ -249,6 +252,7 @@ export declare class VizSpecStore {
|
|
|
249
252
|
readonly aggName?: string | undefined;
|
|
250
253
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
251
254
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
255
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
252
256
|
readonly cmp?: {} | undefined;
|
|
253
257
|
readonly computed?: boolean | undefined;
|
|
254
258
|
readonly expression?: {
|
|
@@ -279,6 +283,7 @@ export declare class VizSpecStore {
|
|
|
279
283
|
readonly aggName?: string | undefined;
|
|
280
284
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
281
285
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
286
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
282
287
|
readonly cmp?: {} | undefined;
|
|
283
288
|
readonly computed?: boolean | undefined;
|
|
284
289
|
readonly expression?: {
|
|
@@ -309,6 +314,7 @@ export declare class VizSpecStore {
|
|
|
309
314
|
readonly aggName?: string | undefined;
|
|
310
315
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
311
316
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
317
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
312
318
|
readonly cmp?: {} | undefined;
|
|
313
319
|
readonly computed?: boolean | undefined;
|
|
314
320
|
readonly expression?: {
|
|
@@ -339,6 +345,7 @@ export declare class VizSpecStore {
|
|
|
339
345
|
readonly aggName?: string | undefined;
|
|
340
346
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
341
347
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
348
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
342
349
|
readonly cmp?: {} | undefined;
|
|
343
350
|
readonly computed?: boolean | undefined;
|
|
344
351
|
readonly expression?: {
|
|
@@ -369,6 +376,7 @@ export declare class VizSpecStore {
|
|
|
369
376
|
readonly aggName?: string | undefined;
|
|
370
377
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
371
378
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
379
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
372
380
|
readonly cmp?: {} | undefined;
|
|
373
381
|
readonly computed?: boolean | undefined;
|
|
374
382
|
readonly expression?: {
|
|
@@ -399,6 +407,100 @@ export declare class VizSpecStore {
|
|
|
399
407
|
readonly aggName?: string | undefined;
|
|
400
408
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
401
409
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
410
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
411
|
+
readonly cmp?: {} | undefined;
|
|
412
|
+
readonly computed?: boolean | undefined;
|
|
413
|
+
readonly expression?: {
|
|
414
|
+
op: "bin" | "log2" | "log10" | "one" | "binCount";
|
|
415
|
+
params: ({
|
|
416
|
+
type: "field";
|
|
417
|
+
value: string;
|
|
418
|
+
} | {
|
|
419
|
+
type: "value";
|
|
420
|
+
value: any;
|
|
421
|
+
} | {
|
|
422
|
+
type: "expression";
|
|
423
|
+
value: any;
|
|
424
|
+
} | {
|
|
425
|
+
type: "constant";
|
|
426
|
+
value: any;
|
|
427
|
+
})[];
|
|
428
|
+
as: string;
|
|
429
|
+
} | undefined;
|
|
430
|
+
readonly basename?: string | undefined;
|
|
431
|
+
readonly path?: string[] | undefined;
|
|
432
|
+
}[];
|
|
433
|
+
readonly longitude: readonly {
|
|
434
|
+
readonly dragId: string;
|
|
435
|
+
readonly sort?: ISortMode | undefined;
|
|
436
|
+
readonly fid: string;
|
|
437
|
+
readonly name: string;
|
|
438
|
+
readonly aggName?: string | undefined;
|
|
439
|
+
readonly semanticType: import("../interfaces").ISemanticType;
|
|
440
|
+
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
441
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
442
|
+
readonly cmp?: {} | undefined;
|
|
443
|
+
readonly computed?: boolean | undefined;
|
|
444
|
+
readonly expression?: {
|
|
445
|
+
op: "bin" | "log2" | "log10" | "one" | "binCount";
|
|
446
|
+
params: ({
|
|
447
|
+
type: "field";
|
|
448
|
+
value: string;
|
|
449
|
+
} | {
|
|
450
|
+
type: "value";
|
|
451
|
+
value: any;
|
|
452
|
+
} | {
|
|
453
|
+
type: "expression";
|
|
454
|
+
value: any;
|
|
455
|
+
} | {
|
|
456
|
+
type: "constant";
|
|
457
|
+
value: any;
|
|
458
|
+
})[];
|
|
459
|
+
as: string;
|
|
460
|
+
} | undefined;
|
|
461
|
+
readonly basename?: string | undefined;
|
|
462
|
+
readonly path?: string[] | undefined;
|
|
463
|
+
}[];
|
|
464
|
+
readonly latitude: readonly {
|
|
465
|
+
readonly dragId: string;
|
|
466
|
+
readonly sort?: ISortMode | undefined;
|
|
467
|
+
readonly fid: string;
|
|
468
|
+
readonly name: string;
|
|
469
|
+
readonly aggName?: string | undefined;
|
|
470
|
+
readonly semanticType: import("../interfaces").ISemanticType;
|
|
471
|
+
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
472
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
473
|
+
readonly cmp?: {} | undefined;
|
|
474
|
+
readonly computed?: boolean | undefined;
|
|
475
|
+
readonly expression?: {
|
|
476
|
+
op: "bin" | "log2" | "log10" | "one" | "binCount";
|
|
477
|
+
params: ({
|
|
478
|
+
type: "field";
|
|
479
|
+
value: string;
|
|
480
|
+
} | {
|
|
481
|
+
type: "value";
|
|
482
|
+
value: any;
|
|
483
|
+
} | {
|
|
484
|
+
type: "expression";
|
|
485
|
+
value: any;
|
|
486
|
+
} | {
|
|
487
|
+
type: "constant";
|
|
488
|
+
value: any;
|
|
489
|
+
})[];
|
|
490
|
+
as: string;
|
|
491
|
+
} | undefined;
|
|
492
|
+
readonly basename?: string | undefined;
|
|
493
|
+
readonly path?: string[] | undefined;
|
|
494
|
+
}[];
|
|
495
|
+
readonly geoId: readonly {
|
|
496
|
+
readonly dragId: string;
|
|
497
|
+
readonly sort?: ISortMode | undefined;
|
|
498
|
+
readonly fid: string;
|
|
499
|
+
readonly name: string;
|
|
500
|
+
readonly aggName?: string | undefined;
|
|
501
|
+
readonly semanticType: import("../interfaces").ISemanticType;
|
|
502
|
+
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
503
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
402
504
|
readonly cmp?: {} | undefined;
|
|
403
505
|
readonly computed?: boolean | undefined;
|
|
404
506
|
readonly expression?: {
|
|
@@ -429,6 +531,7 @@ export declare class VizSpecStore {
|
|
|
429
531
|
readonly aggName?: string | undefined;
|
|
430
532
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
431
533
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
534
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
432
535
|
readonly cmp?: {} | undefined;
|
|
433
536
|
readonly computed?: boolean | undefined;
|
|
434
537
|
readonly expression?: {
|
|
@@ -469,6 +572,7 @@ export declare class VizSpecStore {
|
|
|
469
572
|
readonly aggName?: string | undefined;
|
|
470
573
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
471
574
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
575
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
472
576
|
readonly cmp?: {} | undefined;
|
|
473
577
|
readonly computed?: boolean | undefined;
|
|
474
578
|
readonly expression?: {
|
|
@@ -499,6 +603,7 @@ export declare class VizSpecStore {
|
|
|
499
603
|
readonly aggName?: string | undefined;
|
|
500
604
|
readonly semanticType: import("../interfaces").ISemanticType;
|
|
501
605
|
readonly analyticType: import("../interfaces").IAnalyticType;
|
|
606
|
+
readonly geoRole?: import("../interfaces").IGeoRole | undefined;
|
|
502
607
|
readonly cmp?: {} | undefined;
|
|
503
608
|
readonly computed?: boolean | undefined;
|
|
504
609
|
readonly expression?: {
|
|
@@ -525,11 +630,14 @@ export declare class VizSpecStore {
|
|
|
525
630
|
readonly config: {
|
|
526
631
|
readonly defaultAggregated: boolean;
|
|
527
632
|
readonly geoms: readonly string[];
|
|
633
|
+
readonly showTableSummary: boolean;
|
|
634
|
+
readonly coordSystem?: import("../interfaces").ICoordMode | undefined;
|
|
528
635
|
readonly stack: IStackMode;
|
|
529
636
|
readonly showActions: boolean;
|
|
530
637
|
readonly interactiveScale: boolean;
|
|
531
638
|
readonly sorted: ISortMode;
|
|
532
639
|
readonly zeroScale: boolean;
|
|
640
|
+
readonly scaleIncludeUnmatchedChoropleth?: boolean | undefined;
|
|
533
641
|
readonly background?: string | undefined;
|
|
534
642
|
readonly format: {
|
|
535
643
|
readonly numberFormat?: string | undefined;
|
|
@@ -549,16 +657,84 @@ export declare class VizSpecStore {
|
|
|
549
657
|
readonly width: number;
|
|
550
658
|
readonly height: number;
|
|
551
659
|
};
|
|
660
|
+
readonly geojson?: {
|
|
661
|
+
type: "FeatureCollection";
|
|
662
|
+
features: {
|
|
663
|
+
type: "Feature";
|
|
664
|
+
geometry: {
|
|
665
|
+
type: "Point";
|
|
666
|
+
coordinates: number[];
|
|
667
|
+
bbox?: import("geojson").BBox | undefined;
|
|
668
|
+
} | {
|
|
669
|
+
type: "MultiPoint";
|
|
670
|
+
coordinates: number[][];
|
|
671
|
+
bbox?: import("geojson").BBox | undefined;
|
|
672
|
+
} | {
|
|
673
|
+
type: "LineString";
|
|
674
|
+
coordinates: number[][];
|
|
675
|
+
bbox?: import("geojson").BBox | undefined;
|
|
676
|
+
} | {
|
|
677
|
+
type: "MultiLineString";
|
|
678
|
+
coordinates: number[][][];
|
|
679
|
+
bbox?: import("geojson").BBox | undefined;
|
|
680
|
+
} | {
|
|
681
|
+
type: "Polygon";
|
|
682
|
+
coordinates: number[][][];
|
|
683
|
+
bbox?: import("geojson").BBox | undefined;
|
|
684
|
+
} | {
|
|
685
|
+
type: "MultiPolygon";
|
|
686
|
+
coordinates: number[][][][];
|
|
687
|
+
bbox?: import("geojson").BBox | undefined;
|
|
688
|
+
} | {
|
|
689
|
+
type: "GeometryCollection";
|
|
690
|
+
geometries: ({
|
|
691
|
+
type: "Point";
|
|
692
|
+
coordinates: number[];
|
|
693
|
+
bbox?: import("geojson").BBox | undefined;
|
|
694
|
+
} | {
|
|
695
|
+
type: "MultiPoint";
|
|
696
|
+
coordinates: number[][];
|
|
697
|
+
bbox?: import("geojson").BBox | undefined;
|
|
698
|
+
} | {
|
|
699
|
+
type: "LineString";
|
|
700
|
+
coordinates: number[][];
|
|
701
|
+
bbox?: import("geojson").BBox | undefined;
|
|
702
|
+
} | {
|
|
703
|
+
type: "MultiLineString";
|
|
704
|
+
coordinates: number[][][];
|
|
705
|
+
bbox?: import("geojson").BBox | undefined;
|
|
706
|
+
} | {
|
|
707
|
+
type: "Polygon";
|
|
708
|
+
coordinates: number[][][];
|
|
709
|
+
bbox?: import("geojson").BBox | undefined;
|
|
710
|
+
} | {
|
|
711
|
+
type: "MultiPolygon";
|
|
712
|
+
coordinates: number[][][][];
|
|
713
|
+
bbox?: import("geojson").BBox | undefined;
|
|
714
|
+
} | any)[];
|
|
715
|
+
bbox?: import("geojson").BBox | undefined;
|
|
716
|
+
};
|
|
717
|
+
id?: string | number | undefined;
|
|
718
|
+
properties: {
|
|
719
|
+
[x: string]: any;
|
|
720
|
+
} | null;
|
|
721
|
+
bbox?: import("geojson").BBox | undefined;
|
|
722
|
+
}[];
|
|
723
|
+
bbox?: import("geojson").BBox | undefined;
|
|
724
|
+
} | undefined;
|
|
725
|
+
readonly geoKey?: string | undefined;
|
|
552
726
|
readonly limit: number;
|
|
553
727
|
};
|
|
554
728
|
}[];
|
|
555
729
|
importStoInfo(stoInfo: IStoInfo): void;
|
|
556
730
|
importRaw(raw: string): void;
|
|
731
|
+
setGeographicData(data: IGeographicData, geoKey: string): void;
|
|
732
|
+
updateGeoKey(key: string): void;
|
|
557
733
|
private visSpecEncoder;
|
|
558
734
|
get limit(): number;
|
|
559
735
|
setLimit(value: number): void;
|
|
560
736
|
get sort(): ISortMode;
|
|
561
737
|
getWorkflow(): import("../interfaces").IDataQueryWorkflowStep[];
|
|
562
|
-
setComputationFunction(f: IComputationFunction): void;
|
|
738
|
+
setComputationFunction(f: IComputationFunction, timeout?: number): void;
|
|
563
739
|
}
|
|
564
740
|
export {};
|
package/dist/utils/save.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { DraggableFieldState, IDataSet, IDataSource, IVisSpec, IVisSpecForExport
|
|
|
2
2
|
import { VisSpecWithHistory } from "../models/visSpecHistory";
|
|
3
3
|
export declare function dumpsGWPureSpec(list: VisSpecWithHistory[]): IVisSpec[];
|
|
4
4
|
export declare function parseGWPureSpec(list: IVisSpec[]): VisSpecWithHistory[];
|
|
5
|
+
export declare function initEncoding(): DraggableFieldState;
|
|
5
6
|
export declare function initVisualConfig(): IVisualConfig;
|
|
6
7
|
export declare function visSpecDecoder(visList: IVisSpecForExport[]): IVisSpec[];
|
|
7
8
|
export declare const forwardVisualConfigs: (backwards: ReturnType<typeof parseGWContent>['specList']) => IVisSpecForExport[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { INestNode } from "../components/pivotTable/inteface";
|
|
2
|
+
import { IViewField, IRow } from "../interfaces";
|
|
3
|
+
export declare function buildPivotTable(dimsInRow: IViewField[], dimsInColumn: IViewField[], allData: IRow[], aggData: IRow[], collapsedKeyList: string[], showTableSummary: boolean): {
|
|
4
|
+
lt: INestNode;
|
|
5
|
+
tt: INestNode;
|
|
6
|
+
metric: (IRow | null)[][];
|
|
7
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanaries/graphic-walker",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev:front_end": "vite --host",
|
|
6
6
|
"dev": "npm run dev:front_end",
|
|
@@ -36,13 +36,17 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@headlessui/react": "^1.7.12",
|
|
38
38
|
"@heroicons/react": "^2.0.8",
|
|
39
|
-
"@kanaries/react-beautiful-dnd": "0.0.
|
|
39
|
+
"@kanaries/react-beautiful-dnd": "^0.0.3",
|
|
40
40
|
"@kanaries/web-data-loader": "^0.1.7",
|
|
41
41
|
"@tailwindcss/forms": "^0.5.4",
|
|
42
42
|
"autoprefixer": "^10.3.5",
|
|
43
|
+
"d3-format": "^3.1.0",
|
|
44
|
+
"d3-scale": "^4.0.2",
|
|
45
|
+
"d3-time-format": "^4.1.0",
|
|
43
46
|
"i18next": "^21.9.1",
|
|
44
47
|
"i18next-browser-languagedetector": "^6.1.5",
|
|
45
48
|
"immer": "^9.0.15",
|
|
49
|
+
"leaflet": "^1.9.4",
|
|
46
50
|
"mobx": "^6.3.3",
|
|
47
51
|
"mobx-react-lite": "^3.2.1",
|
|
48
52
|
"nanoid": "^4.0.2",
|
|
@@ -50,9 +54,11 @@
|
|
|
50
54
|
"postinstall-postinstall": "^2.1.0",
|
|
51
55
|
"re-resizable": "^6.9.8",
|
|
52
56
|
"react-i18next": "^11.18.6",
|
|
57
|
+
"react-leaflet": "^4.2.1",
|
|
53
58
|
"react-shadow": "^20.0.0",
|
|
54
59
|
"rxjs": "^7.3.0",
|
|
55
60
|
"tailwindcss": "^3.2.4",
|
|
61
|
+
"topojson-client": "^3.1.0",
|
|
56
62
|
"uuid": "^8.3.2",
|
|
57
63
|
"vega": "^5.22.1",
|
|
58
64
|
"vega-embed": "^6.21.0",
|
|
@@ -60,10 +66,16 @@
|
|
|
60
66
|
},
|
|
61
67
|
"devDependencies": {
|
|
62
68
|
"@rollup/plugin-typescript": "^8.2.5",
|
|
69
|
+
"@types/d3-format": "^3.0.1",
|
|
70
|
+
"@types/d3-scale": "^4.0.3",
|
|
71
|
+
"@types/d3-time-format": "^4.0.0",
|
|
72
|
+
"@types/geojson": "^7946.0.10",
|
|
73
|
+
"@types/leaflet": "^1.9.3",
|
|
63
74
|
"@types/react": "^17.x",
|
|
64
75
|
"@types/react-beautiful-dnd": "^13.1.2",
|
|
65
76
|
"@types/react-dom": "^17.x",
|
|
66
77
|
"@types/styled-components": "^5.1.26",
|
|
78
|
+
"@types/topojson-client": "^3.1.1",
|
|
67
79
|
"@types/uuid": "^8.3.1",
|
|
68
80
|
"@vercel/analytics": "^0.1.8",
|
|
69
81
|
"@vitejs/plugin-react": "^3.1.0",
|
package/src/App.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useMemo, useState } from 'react';
|
|
2
2
|
import { observer } from 'mobx-react-lite';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { IComputationFunction, IDarkMode, IMutField, IRow, ISegmentKey, IThemeKey, Specification } from './interfaces';
|
|
4
|
+
import { IGeographicData, IComputationFunction, IDarkMode, IMutField, IRow, ISegmentKey, IThemeKey, Specification } from './interfaces';
|
|
5
5
|
import type { IReactVegaHandler } from './vis/react-vega';
|
|
6
6
|
import VisualSettings from './visualSettings';
|
|
7
7
|
import PosFields from './fields/posFields';
|
|
@@ -19,6 +19,7 @@ import DatasetConfig from './dataSource/datasetConfig';
|
|
|
19
19
|
import { useCurrentMediaTheme } from './utils/media';
|
|
20
20
|
import CodeExport from './components/codeExport';
|
|
21
21
|
import VisualConfig from './components/visualConfig';
|
|
22
|
+
import GeoConfigPanel from './components/leafletRenderer/geoConfigPanel';
|
|
22
23
|
import type { ToolbarItemProps } from './components/toolbar';
|
|
23
24
|
import AskViz from './components/askViz';
|
|
24
25
|
import { getComputation } from './computation/clientComputation';
|
|
@@ -44,12 +45,16 @@ export interface IGWProps {
|
|
|
44
45
|
extra?: ToolbarItemProps[];
|
|
45
46
|
exclude?: string[];
|
|
46
47
|
};
|
|
48
|
+
geographicData?: IGeographicData & {
|
|
49
|
+
key: string;
|
|
50
|
+
};
|
|
47
51
|
enhanceAPI?: {
|
|
48
52
|
header?: Record<string, string>;
|
|
49
53
|
features?: {
|
|
50
54
|
askviz?: string | boolean;
|
|
51
55
|
}
|
|
52
56
|
};
|
|
57
|
+
computationTimeout?: number;
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
const App = observer<IGWProps>(function App(props) {
|
|
@@ -65,7 +70,9 @@ const App = observer<IGWProps>(function App(props) {
|
|
|
65
70
|
dark = 'media',
|
|
66
71
|
computation,
|
|
67
72
|
toolbar,
|
|
73
|
+
geographicData,
|
|
68
74
|
enhanceAPI,
|
|
75
|
+
computationTimeout,
|
|
69
76
|
} = props;
|
|
70
77
|
const { commonStore, vizStore } = useGlobalStore();
|
|
71
78
|
|
|
@@ -134,13 +141,19 @@ const App = observer<IGWProps>(function App(props) {
|
|
|
134
141
|
}
|
|
135
142
|
}, [spec, safeDataset]);
|
|
136
143
|
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (geographicData) {
|
|
146
|
+
vizStore.setGeographicData(geographicData, geographicData.key);
|
|
147
|
+
}
|
|
148
|
+
}, [geographicData]);
|
|
149
|
+
|
|
137
150
|
useEffect(() => {
|
|
138
151
|
if (computation) {
|
|
139
|
-
vizStore.setComputationFunction(computation);
|
|
152
|
+
vizStore.setComputationFunction(computation, computationTimeout);
|
|
140
153
|
} else {
|
|
141
154
|
vizStore.setComputationFunction(getComputation(commonStore.currentDataset.dataSource));
|
|
142
155
|
}
|
|
143
|
-
}, [vizStore, computation ?? commonStore.currentDataset.dataSource]);
|
|
156
|
+
}, [vizStore, computation ?? commonStore.currentDataset.dataSource, computationTimeout]);
|
|
144
157
|
|
|
145
158
|
const darkMode = useCurrentMediaTheme(dark);
|
|
146
159
|
|
|
@@ -172,6 +185,7 @@ const App = observer<IGWProps>(function App(props) {
|
|
|
172
185
|
<VisualSettings rendererHandler={rendererRef} darkModePreference={dark} exclude={toolbar?.exclude} extra={toolbar?.extra} />
|
|
173
186
|
<CodeExport />
|
|
174
187
|
<VisualConfig />
|
|
188
|
+
<GeoConfigPanel />
|
|
175
189
|
<div className="md:grid md:grid-cols-12 xl:grid-cols-6">
|
|
176
190
|
<div className="md:col-span-3 xl:col-span-1">
|
|
177
191
|
<DatasetFields />
|
|
@@ -195,7 +209,7 @@ const App = observer<IGWProps>(function App(props) {
|
|
|
195
209
|
// }}
|
|
196
210
|
>
|
|
197
211
|
{datasets.length > 0 && (
|
|
198
|
-
<ReactiveRenderer ref={rendererRef} themeKey={themeKey} dark={dark} computationFunction={vizStore.
|
|
212
|
+
<ReactiveRenderer ref={rendererRef} themeKey={themeKey} dark={dark} computationFunction={vizStore.computationFunction} />
|
|
199
213
|
)}
|
|
200
214
|
{/* {vizEmbededMenu.show && (
|
|
201
215
|
<ClickMenu x={vizEmbededMenu.position[0]} y={vizEmbededMenu.position[1]}>
|