@kanaries/graphic-walker 0.2.16 → 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 +3 -4
- package/dist/assets/viewQuery.worker-ffefc111.js.map +1 -1
- package/dist/dataSource/index.d.ts +0 -1
- package/dist/fields/encodeFields/singleEncodeEditor.d.ts +4 -4
- package/dist/graphic-walker.es.js +29716 -34642
- 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/interfaces.d.ts +31 -16
- 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 +2 -1
- package/dist/lib/op/aggregate.d.ts +1 -1
- package/dist/lib/op/bin.d.ts +1 -1
- package/dist/lib/op/fold.d.ts +1 -1
- package/dist/lib/viewQuery.d.ts +1 -2
- package/dist/services.d.ts +1 -30
- package/dist/store/visualSpecStore.d.ts +1 -2
- package/dist/utils/autoMark.d.ts +1 -1
- package/dist/utils/dataPrep.d.ts +1 -2
- package/dist/vis/react-vega.d.ts +1 -0
- package/dist/vis/spec/encode.d.ts +1 -0
- package/dist/vis/spec/mark.d.ts +1 -1
- package/dist/vis/spec/tooltip.d.ts +4 -0
- package/dist/vis/spec/view.d.ts +9 -3
- package/package.json +2 -4
- package/src/App.tsx +55 -68
- package/src/dataSource/index.tsx +0 -17
- package/src/fields/aestheticFields.tsx +1 -2
- package/src/fields/encodeFields/singleEncodeEditor.tsx +11 -12
- package/src/fields/fieldsContext.tsx +1 -0
- package/src/interfaces.ts +75 -63
- 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 +3 -9
- package/src/lib/op/aggregate.ts +1 -1
- package/src/lib/op/bin.ts +1 -1
- package/src/lib/op/fold.ts +1 -1
- package/src/lib/viewQuery.ts +1 -2
- package/src/locales/en-US.json +2 -1
- package/src/locales/zh-CN.json +2 -1
- package/src/renderer/specRenderer.tsx +2 -0
- package/src/services.ts +65 -67
- package/src/store/visualSpecStore.ts +2 -4
- package/src/utils/autoMark.ts +1 -1
- package/src/utils/dataPrep.ts +1 -2
- package/src/vis/react-vega.tsx +5 -0
- package/src/vis/spec/encode.ts +1 -0
- package/src/vis/spec/mark.ts +1 -1
- package/src/vis/spec/tooltip.ts +16 -0
- package/src/vis/spec/view.ts +12 -14
- package/dist/assets/explainer.worker-8428eb12.js.map +0 -1
- 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/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);
|