@kanaries/graphic-walker 0.2.16 → 0.2.18

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.
Files changed (74) hide show
  1. package/dist/App.d.ts +3 -4
  2. package/dist/assets/viewQuery.worker-ffefc111.js.map +1 -1
  3. package/dist/dataSource/index.d.ts +0 -1
  4. package/dist/fields/encodeFields/singleEncodeEditor.d.ts +4 -4
  5. package/dist/graphic-walker.es.js +29716 -34641
  6. package/dist/graphic-walker.es.js.map +1 -1
  7. package/dist/graphic-walker.umd.js +218 -256
  8. package/dist/graphic-walker.umd.js.map +1 -1
  9. package/dist/interfaces.d.ts +31 -16
  10. package/dist/lib/inferMeta.d.ts +2 -9
  11. package/dist/lib/insights/explainByChildren.d.ts +16 -0
  12. package/dist/lib/insights/explainBySelection.d.ts +5 -0
  13. package/dist/lib/insights/explainValue.d.ts +2 -0
  14. package/dist/lib/insights/utils.d.ts +11 -0
  15. package/dist/lib/interfaces.d.ts +2 -1
  16. package/dist/lib/op/aggregate.d.ts +1 -1
  17. package/dist/lib/op/bin.d.ts +1 -1
  18. package/dist/lib/op/fold.d.ts +1 -1
  19. package/dist/lib/viewQuery.d.ts +1 -2
  20. package/dist/services.d.ts +1 -30
  21. package/dist/store/visualSpecStore.d.ts +1 -2
  22. package/dist/utils/autoMark.d.ts +1 -1
  23. package/dist/utils/dataPrep.d.ts +1 -2
  24. package/dist/vis/react-vega.d.ts +1 -0
  25. package/dist/vis/spec/encode.d.ts +1 -0
  26. package/dist/vis/spec/mark.d.ts +1 -1
  27. package/dist/vis/spec/tooltip.d.ts +4 -0
  28. package/dist/vis/spec/view.d.ts +9 -3
  29. package/package.json +2 -4
  30. package/src/App.tsx +55 -68
  31. package/src/dataSource/index.tsx +0 -17
  32. package/src/fields/aestheticFields.tsx +1 -2
  33. package/src/fields/encodeFields/singleEncodeEditor.tsx +11 -12
  34. package/src/fields/fieldsContext.tsx +1 -0
  35. package/src/interfaces.ts +75 -63
  36. package/src/lib/inferMeta.ts +26 -29
  37. package/src/lib/insights/explainByChildren.ts +50 -0
  38. package/src/lib/insights/explainBySelection.ts +47 -0
  39. package/src/lib/insights/explainValue.ts +30 -0
  40. package/src/lib/insights/utils.ts +21 -0
  41. package/src/lib/interfaces.ts +3 -9
  42. package/src/lib/op/aggregate.ts +1 -1
  43. package/src/lib/op/bin.ts +1 -1
  44. package/src/lib/op/fold.ts +1 -1
  45. package/src/lib/viewQuery.ts +1 -2
  46. package/src/locales/en-US.json +2 -1
  47. package/src/locales/zh-CN.json +2 -1
  48. package/src/main.tsx +4 -2
  49. package/src/renderer/specRenderer.tsx +2 -0
  50. package/src/services.ts +65 -67
  51. package/src/store/visualSpecStore.ts +3 -4
  52. package/src/utils/autoMark.ts +1 -1
  53. package/src/utils/dataPrep.ts +1 -2
  54. package/src/vis/react-vega.tsx +5 -0
  55. package/src/vis/spec/encode.ts +1 -0
  56. package/src/vis/spec/mark.ts +1 -1
  57. package/src/vis/spec/tooltip.ts +16 -0
  58. package/src/vis/spec/view.ts +12 -14
  59. package/dist/assets/explainer.worker-8428eb12.js.map +0 -1
  60. package/dist/insightBoard/index.d.ts +0 -3
  61. package/dist/insightBoard/mainBoard.d.ts +0 -11
  62. package/dist/insightBoard/radioGroupButtons.d.ts +0 -12
  63. package/dist/insightBoard/selectionSpec.d.ts +0 -13
  64. package/dist/insightBoard/std2vegaSpec.d.ts +0 -12
  65. package/dist/insightBoard/utils.d.ts +0 -8
  66. package/dist/insights.d.ts +0 -61
  67. package/src/insightBoard/index.tsx +0 -31
  68. package/src/insightBoard/mainBoard.tsx +0 -224
  69. package/src/insightBoard/radioGroupButtons.tsx +0 -57
  70. package/src/insightBoard/selectionSpec.ts +0 -113
  71. package/src/insightBoard/std2vegaSpec.ts +0 -184
  72. package/src/insightBoard/utils.ts +0 -32
  73. package/src/insights.ts +0 -408
  74. 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);