@kanaries/graphic-walker 0.2.15 → 0.2.17
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 +4 -3
- package/dist/assets/transform.worker-5d54ff09.js.map +1 -0
- package/dist/assets/viewQuery.worker-ffefc111.js.map +1 -0
- package/dist/components/codeExport/index.d.ts +3 -0
- package/dist/components/loadingLayer.d.ts +2 -0
- package/dist/components/tabs/defaultTab.d.ts +1 -0
- package/dist/components/tabs/editableTab.d.ts +1 -2
- package/dist/dataSource/dataSelection/config.d.ts +1 -0
- package/dist/dataSource/dataSelection/utils.d.ts +2 -0
- package/dist/dataSource/index.d.ts +0 -1
- package/dist/datasets/tmp/test.json +1 -0
- package/dist/fields/encodeFields/singleEncodeEditor.d.ts +4 -4
- package/dist/graphic-walker.es.js +29228 -33650
- package/dist/graphic-walker.es.js.map +1 -1
- package/dist/graphic-walker.umd.js +218 -256
- package/dist/graphic-walker.umd.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/interfaces.d.ts +52 -17
- package/dist/lib/execExp.d.ts +8 -0
- package/dist/lib/inferMeta.d.ts +2 -9
- package/dist/lib/insights/explainByChildren.d.ts +16 -0
- package/dist/lib/insights/explainBySelection.d.ts +5 -0
- package/dist/lib/insights/explainValue.d.ts +2 -0
- package/dist/lib/insights/utils.d.ts +11 -0
- package/dist/lib/interfaces.d.ts +23 -0
- package/dist/lib/op/aggregate.d.ts +3 -0
- package/dist/lib/op/bin.d.ts +3 -0
- package/dist/lib/op/fold.d.ts +3 -0
- package/dist/lib/op/stat.d.ts +8 -0
- package/dist/lib/viewQuery.d.ts +4 -0
- package/dist/models/visSpecHistory.d.ts +2 -0
- package/dist/renderer/index.d.ts +8 -7
- package/dist/renderer/specRenderer.d.ts +13 -0
- package/dist/services.d.ts +5 -31
- package/dist/store/commonStore.d.ts +6 -0
- package/dist/store/index.d.ts +3 -2
- package/dist/store/visualSpecStore.d.ts +11 -5
- package/dist/utils/autoMark.d.ts +1 -1
- package/dist/utils/dataPrep.d.ts +3 -2
- package/dist/utils/index.d.ts +3 -5
- package/dist/utils/save.d.ts +1 -2
- package/dist/vis/react-vega.d.ts +2 -22
- package/dist/vis/spec/aggregate.d.ts +4 -0
- package/dist/vis/spec/encode.d.ts +20 -0
- package/dist/vis/spec/field.d.ts +2 -0
- package/dist/vis/spec/mark.d.ts +7 -0
- package/dist/vis/spec/stack.d.ts +4 -0
- package/dist/vis/spec/tooltip.d.ts +4 -0
- package/dist/vis/spec/view.d.ts +73 -0
- package/dist/workers/transform.d.ts +2 -0
- package/package.json +5 -6
- package/src/App.tsx +56 -66
- package/src/components/codeExport/index.tsx +114 -0
- package/src/components/dataTable/index.tsx +10 -10
- package/src/components/loadingLayer.tsx +7 -0
- package/src/components/tabs/defaultTab.tsx +4 -2
- package/src/components/tabs/editableTab.tsx +74 -39
- package/src/dataSource/dataSelection/config.ts +11 -0
- package/src/dataSource/dataSelection/csvData.tsx +71 -39
- package/src/dataSource/dataSelection/gwFile.tsx +2 -2
- package/src/dataSource/dataSelection/utils.ts +28 -0
- package/src/dataSource/index.tsx +0 -17
- package/src/dataSource/utils.ts +8 -3
- package/src/fields/aestheticFields.tsx +1 -2
- package/src/fields/datasetFields/meaFields.tsx +12 -4
- package/src/fields/encodeFields/singleEncodeEditor.tsx +11 -12
- package/src/fields/fieldsContext.tsx +1 -0
- package/src/index.css +4 -4
- package/src/index.tsx +22 -22
- package/src/interfaces.ts +85 -49
- package/src/lib/execExp.ts +147 -0
- package/src/lib/inferMeta.ts +26 -29
- package/src/lib/insights/explainByChildren.ts +50 -0
- package/src/lib/insights/explainBySelection.ts +47 -0
- package/src/lib/insights/explainValue.ts +30 -0
- package/src/lib/insights/utils.ts +21 -0
- package/src/lib/interfaces.ts +33 -0
- package/src/lib/op/aggregate.ts +49 -0
- package/src/lib/op/bin.ts +25 -0
- package/src/lib/op/fold.ts +17 -0
- package/src/lib/op/stat.ts +46 -0
- package/src/lib/viewQuery.ts +22 -0
- package/src/locales/en-US.json +6 -3
- package/src/locales/i18n.ts +0 -1
- package/src/locales/ja-JP.json +4 -2
- package/src/locales/zh-CN.json +6 -3
- package/src/main.tsx +1 -1
- package/src/models/visSpecHistory.ts +14 -0
- package/src/renderer/index.tsx +58 -126
- package/src/renderer/specRenderer.tsx +121 -0
- package/src/segments/segmentNav.tsx +3 -16
- package/src/segments/visNav.tsx +17 -6
- package/src/services.ts +101 -67
- package/src/store/commonStore.ts +14 -9
- package/src/store/index.tsx +11 -4
- package/src/store/visualSpecStore.ts +89 -52
- package/src/utils/autoMark.ts +1 -1
- package/src/utils/dataPrep.ts +25 -2
- package/src/utils/index.ts +16 -17
- package/src/utils/normalization.ts +3 -1
- package/src/utils/save.ts +1 -2
- package/src/vis/react-vega.tsx +9 -340
- package/src/vis/spec/aggregate.ts +13 -0
- package/src/vis/spec/encode.ts +70 -0
- package/src/vis/spec/field.ts +10 -0
- package/src/vis/spec/mark.ts +30 -0
- package/src/vis/spec/stack.ts +11 -0
- package/src/vis/spec/tooltip.ts +16 -0
- package/src/vis/spec/view.ts +136 -0
- package/src/vis/theme.ts +12 -0
- package/src/visualSettings/index.tsx +10 -1
- package/src/workers/transform.ts +12 -0
- package/src/workers/transform.worker.js +13 -0
- package/src/workers/viewQuery.worker.js +16 -0
- package/dist/assets/explainer.worker-8428eb12.js.map +0 -1
- package/dist/dataSource/pannel.d.ts +0 -5
- package/dist/insightBoard/index.d.ts +0 -3
- package/dist/insightBoard/mainBoard.d.ts +0 -11
- package/dist/insightBoard/radioGroupButtons.d.ts +0 -12
- package/dist/insightBoard/selectionSpec.d.ts +0 -13
- package/dist/insightBoard/std2vegaSpec.d.ts +0 -12
- package/dist/insightBoard/utils.d.ts +0 -8
- package/dist/insights.d.ts +0 -61
- package/src/dataSource/pannel.tsx +0 -71
- package/src/insightBoard/index.tsx +0 -31
- package/src/insightBoard/mainBoard.tsx +0 -224
- package/src/insightBoard/radioGroupButtons.tsx +0 -57
- package/src/insightBoard/selectionSpec.ts +0 -113
- package/src/insightBoard/std2vegaSpec.ts +0 -184
- package/src/insightBoard/utils.ts +0 -32
- package/src/insights.ts +0 -408
- package/src/workers/explainer.worker.js +0 -76
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/* eslint no-restricted-globals: 0 */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
// import { Record, Filters } from '../interfaces';
|
|
4
|
-
import { getPredicatesFromVegaSignals } from '../utils';
|
|
5
|
-
import { DataExplainer } from '../insights';
|
|
6
|
-
const state = {
|
|
7
|
-
de: null
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
function preAnalysis (props) {
|
|
11
|
-
const { fields, dataSource } = props; // as ReqData;
|
|
12
|
-
const de = new DataExplainer(dataSource);
|
|
13
|
-
de.setFields(fields);
|
|
14
|
-
de.preAnalysis();
|
|
15
|
-
state.de = de;
|
|
16
|
-
return true
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function getFieldsSummary (props) {
|
|
20
|
-
const de = state.de;
|
|
21
|
-
if (de !== null) {
|
|
22
|
-
return de.engine.fields;
|
|
23
|
-
}
|
|
24
|
-
throw new Error('data explainer is not init.')
|
|
25
|
-
}
|
|
26
|
-
function getExplaination(props) {
|
|
27
|
-
|
|
28
|
-
const { filters = {}, currentSpace } = props; // as ReqData;
|
|
29
|
-
const predicates = getPredicatesFromVegaSignals(filters, currentSpace.dimensions, []);
|
|
30
|
-
const de = state.de;
|
|
31
|
-
const ansSpaces = de.explain(predicates, currentSpace.dimensions, currentSpace.measures);
|
|
32
|
-
const visSpaces = de.getVisSpec(ansSpaces);
|
|
33
|
-
const valueExp = de.explainValue(predicates, currentSpace.dimensions, currentSpace.measures);
|
|
34
|
-
const measureStats = [];
|
|
35
|
-
for (let i = 0; i < valueExp.length; i++) {
|
|
36
|
-
if (valueExp[i] !== 0) {
|
|
37
|
-
measureStats.push({
|
|
38
|
-
...currentSpace.measures[i],
|
|
39
|
-
score: valueExp[i]
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const fields = de.engine.fields;
|
|
44
|
-
return {
|
|
45
|
-
explainations: ansSpaces,
|
|
46
|
-
visSpaces,
|
|
47
|
-
valueExp: measureStats,
|
|
48
|
-
fieldsWithSemanticType: fields.map(f => ({
|
|
49
|
-
key: f.key,
|
|
50
|
-
type: f.semanticType
|
|
51
|
-
}))
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function main (e) {
|
|
56
|
-
const { type, data } = e.data;
|
|
57
|
-
let res = false;
|
|
58
|
-
try {
|
|
59
|
-
switch (type) {
|
|
60
|
-
case 'getExplaination':
|
|
61
|
-
res = getExplaination(data);
|
|
62
|
-
break;
|
|
63
|
-
case 'preAnalysis':
|
|
64
|
-
res = preAnalysis(data);
|
|
65
|
-
break;
|
|
66
|
-
default:
|
|
67
|
-
throw new Error(`type ${type} is not supported.`);
|
|
68
|
-
}
|
|
69
|
-
self.postMessage(res);
|
|
70
|
-
} catch (error) {
|
|
71
|
-
console.log(error)
|
|
72
|
-
self.postMessage(false)
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
self.addEventListener('message', main, false);
|