@sis-cc/dotstatsuite-components 21.0.1 → 21.1.0

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 (234) hide show
  1. package/dist/dotstatsuite-components.js +38112 -0
  2. package/package.json +4 -1
  3. package/.editorconfig +0 -19
  4. package/.gitlab-ci.yml +0 -48
  5. package/prettier.config.js +0 -13
  6. package/src/app.js +0 -13
  7. package/src/bridge-d3-react/README.md +0 -42
  8. package/src/bridge-d3-react/src/app.js +0 -64
  9. package/src/bridge-d3-react/src/index.js +0 -17
  10. package/src/bridge-d3-react/src/mock-choro.js +0 -394
  11. package/src/bridge-d3-react/src/react-chart-factory.js +0 -65
  12. package/src/index.js +0 -12
  13. package/src/rules/README.md +0 -23
  14. package/src/rules/src/chart/getAxisOptions.js +0 -258
  15. package/src/rules/src/chart/getBaseOptions.js +0 -84
  16. package/src/rules/src/chart/getChartOptions.js +0 -118
  17. package/src/rules/src/chart/getGridOptions.js +0 -52
  18. package/src/rules/src/chart/getTooltipOptions.js +0 -230
  19. package/src/rules/src/constants.js +0 -64
  20. package/src/rules/src/date.js +0 -118
  21. package/src/rules/src/dimension-utils.js +0 -54
  22. package/src/rules/src/factories/choro-series.js +0 -65
  23. package/src/rules/src/factories/sample-focus.js +0 -22
  24. package/src/rules/src/factories/sample-series.js +0 -51
  25. package/src/rules/src/factories/scatter-dimension.js +0 -31
  26. package/src/rules/src/factories/scatter-focus.js +0 -39
  27. package/src/rules/src/factories/scatter-series.js +0 -94
  28. package/src/rules/src/factories/stacked-dimension.js +0 -29
  29. package/src/rules/src/factories/stacked-series.js +0 -185
  30. package/src/rules/src/factories/symbol-dimension.js +0 -29
  31. package/src/rules/src/factories/symbol-series.js +0 -62
  32. package/src/rules/src/factories/timeline-focus.js +0 -18
  33. package/src/rules/src/factories/timeline-series.js +0 -91
  34. package/src/rules/src/get-values-enhanced.js +0 -134
  35. package/src/rules/src/header/getDefaultSubtitle.js +0 -40
  36. package/src/rules/src/header/getHeaderUnits.js +0 -17
  37. package/src/rules/src/header/getSubtitleFlags.js +0 -43
  38. package/src/rules/src/header/getTitleFlags.js +0 -8
  39. package/src/rules/src/header/index.js +0 -4
  40. package/src/rules/src/index.js +0 -398
  41. package/src/rules/src/layout.js +0 -113
  42. package/src/rules/src/observation-formater.js +0 -83
  43. package/src/rules/src/preparators/enhanceObservations.js +0 -152
  44. package/src/rules/src/preparators/formatValue.js +0 -84
  45. package/src/rules/src/preparators/getObservations.js +0 -19
  46. package/src/rules/src/preparators/getReportingYearStart.js +0 -16
  47. package/src/rules/src/properties/errors.js +0 -19
  48. package/src/rules/src/properties/focus.js +0 -69
  49. package/src/rules/src/properties/getAvailableChartTypes.js +0 -34
  50. package/src/rules/src/properties/getHeaderProps.js +0 -74
  51. package/src/rules/src/properties/getInformationsStateFromNewProps.js +0 -47
  52. package/src/rules/src/properties/getObservationsType.js +0 -29
  53. package/src/rules/src/properties/getStringifiedSubtitle.js +0 -6
  54. package/src/rules/src/properties/index.js +0 -424
  55. package/src/rules/src/properties/information.js +0 -84
  56. package/src/rules/src/properties/linear.js +0 -129
  57. package/src/rules/src/properties/scatter.js +0 -158
  58. package/src/rules/src/properties/stacked.js +0 -98
  59. package/src/rules/src/properties/symbol.js +0 -79
  60. package/src/rules/src/properties/utils.js +0 -110
  61. package/src/rules/src/sdmx-data/index.js +0 -39
  62. package/src/rules/src/table/factories/getCellValue.js +0 -50
  63. package/src/rules/src/table/index.js +0 -1
  64. package/src/rules/src/v8-transformer.js +0 -176
  65. package/src/rules/test/extractSdmxArtefacts.js +0 -26
  66. package/src/rules/test/get-values-enhanced.test.js +0 -127
  67. package/src/rules/test/oecd-HEALTH_PROT-no-freq.json +0 -2903
  68. package/src/rules/test/oecd-HEALTH_PROT-parsed.js +0 -398
  69. package/src/rules/test/oecd-HEALTH_PROT-wrong-freq.json +0 -2913
  70. package/src/rules/test/oecd-HEALTH_PROT.json +0 -2913
  71. package/src/rules/test/oecd-KEI.json +0 -372
  72. package/src/rules/test/scatter-property.js +0 -455
  73. package/src/rules/test/stacked-property.js +0 -273
  74. package/src/rules/test/symbol-property.js +0 -262
  75. package/src/rules/test/v8-transformer.test.js +0 -90
  76. package/src/rules2/src/applyHierarchicalCodesToDim.js +0 -149
  77. package/src/rules2/src/combinedValuesDisplay.js +0 -74
  78. package/src/rules2/src/constants.js +0 -6
  79. package/src/rules2/src/duplicateObservations.js +0 -35
  80. package/src/rules2/src/enhanceObservations.js +0 -95
  81. package/src/rules2/src/getAdvAttrSeriesAtCoordinates.js +0 -29
  82. package/src/rules2/src/getAttributesSeries.js +0 -36
  83. package/src/rules2/src/getCombinationDefinitions.js +0 -47
  84. package/src/rules2/src/getDataflowAttributes.js +0 -23
  85. package/src/rules2/src/getDataflowTooltipAttributesIds.js +0 -31
  86. package/src/rules2/src/getDimensionValuesIndexes.js +0 -13
  87. package/src/rules2/src/getHCodelistsRefsInData.js +0 -32
  88. package/src/rules2/src/getHeaderCombinations.js +0 -48
  89. package/src/rules2/src/getHeaderCoordinates.js +0 -7
  90. package/src/rules2/src/getHeaderSubtitle.js +0 -34
  91. package/src/rules2/src/getHeaderTitle.js +0 -15
  92. package/src/rules2/src/getMSDInformations.js +0 -23
  93. package/src/rules2/src/getManyValuesDimensions.js +0 -34
  94. package/src/rules2/src/getMetadataCoordinates.js +0 -37
  95. package/src/rules2/src/getMetadataStructureFromData.js +0 -17
  96. package/src/rules2/src/getNotDisplayedIds.js +0 -53
  97. package/src/rules2/src/getOneValueDimensions.js +0 -34
  98. package/src/rules2/src/getSeriesCombinations.js +0 -24
  99. package/src/rules2/src/hasCellMetadata.js +0 -14
  100. package/src/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +0 -57
  101. package/src/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +0 -35
  102. package/src/rules2/src/index.js +0 -50
  103. package/src/rules2/src/parseAttributes.js +0 -41
  104. package/src/rules2/src/parseCombinations.js +0 -102
  105. package/src/rules2/src/parseHierarchicalCodelist.js +0 -48
  106. package/src/rules2/src/parseMetadataSeries.js +0 -117
  107. package/src/rules2/src/prepareData.js +0 -73
  108. package/src/rules2/src/refineAttributes.js +0 -16
  109. package/src/rules2/src/refineDimensions.js +0 -18
  110. package/src/rules2/src/refineMetadataCoordinates.js +0 -28
  111. package/src/rules2/src/refineTimePeriod.js +0 -127
  112. package/src/rules2/src/sdmx3.0DataFormatPatch.js +0 -9
  113. package/src/rules2/src/table/declineObservationsOverAttributes.js +0 -32
  114. package/src/rules2/src/table/getCells.js +0 -93
  115. package/src/rules2/src/table/getCellsAttributesIds.js +0 -38
  116. package/src/rules2/src/table/getCellsMetadataCoordinates.js +0 -13
  117. package/src/rules2/src/table/getCombinationDimensionsData.js +0 -39
  118. package/src/rules2/src/table/getCuratedCells.js +0 -33
  119. package/src/rules2/src/table/getFlagsAndNotes.js +0 -23
  120. package/src/rules2/src/table/getIndexedCombinationsByDisplay.js +0 -16
  121. package/src/rules2/src/table/getLayout.js +0 -84
  122. package/src/rules2/src/table/getLayoutData2.js +0 -198
  123. package/src/rules2/src/table/getSortedLayoutIndexes.js +0 -124
  124. package/src/rules2/src/table/getTableLabelAccessor.js +0 -9
  125. package/src/rules2/src/table/getTableLayoutIds.js +0 -314
  126. package/src/rules2/src/table/getTableProps.js +0 -75
  127. package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +0 -79
  128. package/src/rules2/src/table/parseValueHierarchy.js +0 -33
  129. package/src/rules2/src/table/refineLayoutSize2.js +0 -321
  130. package/src/rules2/src/utils.js +0 -37
  131. package/src/viewer/mocks/bar.js +0 -33
  132. package/src/viewer/mocks/gpp-symbol.js +0 -93
  133. package/src/viewer/mocks/gpp-time.js +0 -1103
  134. package/src/viewer/mocks/row.js +0 -39
  135. package/src/viewer/mocks/scatter.js +0 -93
  136. package/src/viewer/mocks/stack.js +0 -161
  137. package/src/viewer/src/app/leg.js +0 -36
  138. package/src/viewer/src/app/nodata-res.js +0 -22
  139. package/src/viewer/src/app/nodata-sized.js +0 -23
  140. package/src/viewer/src/app/one-table-cell.js +0 -70
  141. package/src/viewer/src/app/table.js +0 -423
  142. package/src/viewer/src/app/use-case-1.js +0 -33
  143. package/src/viewer/src/app/use-case-2.js +0 -38
  144. package/src/viewer/src/app/use-case-3.js +0 -18
  145. package/src/viewer/src/app.js +0 -116
  146. package/src/viewer/src/chart.js +0 -52
  147. package/src/viewer/src/chartUtils/options.js +0 -30
  148. package/src/viewer/src/chartUtils/series.js +0 -51
  149. package/src/viewer/src/footer.js +0 -24
  150. package/src/viewer/src/header.js +0 -10
  151. package/src/viewer/src/index.js +0 -158
  152. package/src/viewer/src/legends/AxisLegend.js +0 -41
  153. package/src/viewer/src/legends/ChartLegends.js +0 -66
  154. package/src/viewer/src/legends/FocusLegend.js +0 -63
  155. package/src/viewer/src/legends/Legend.js +0 -46
  156. package/src/viewer/src/legends/SeriesLegend.js +0 -78
  157. package/src/viewer/src/utils.js +0 -21
  158. package/test/applyHierarchicalCodesToDim.test.js +0 -160
  159. package/test/combinedValuesDisplay.test.js +0 -66
  160. package/test/duplicateObs.test.js +0 -118
  161. package/test/enhanceObservations2.test.js +0 -257
  162. package/test/getAttributesSeries.test.js +0 -66
  163. package/test/getAxisOptions.test.js +0 -309
  164. package/test/getBaseOptions.test.js +0 -77
  165. package/test/getCellValue.test.js +0 -32
  166. package/test/getCells.test.js +0 -178
  167. package/test/getCellsMetadataCoordinates.test.js +0 -40
  168. package/test/getCombinationDefinitions.test.js +0 -104
  169. package/test/getCombinationDimensionsData.test.js +0 -99
  170. package/test/getDataflowAttributes.test.js +0 -23
  171. package/test/getDataflowTooltipAttributesIds.test.js +0 -146
  172. package/test/getDimensionValuesIndexes.test.js +0 -33
  173. package/test/getGridOptions.test.js +0 -65
  174. package/test/getHCodelistsRefs.test.js +0 -23
  175. package/test/getHeaderCombinations.test.js +0 -62
  176. package/test/getHeaderTitle.test.js +0 -25
  177. package/test/getLayout.test.js +0 -54
  178. package/test/getLayoutData2.test.js +0 -535
  179. package/test/getMSDInformations.test.js +0 -35
  180. package/test/getMetadataCoordinates.test.js +0 -0
  181. package/test/getNotDisplayedIds.test.js +0 -47
  182. package/test/getObservationsType.test.js +0 -55
  183. package/test/getOneValueDimensions.test.js +0 -35
  184. package/test/getReportingYearStart.test.js +0 -59
  185. package/test/getSeriesCombinations.test.js +0 -29
  186. package/test/getSortedLayoutIndexes.test.js +0 -1138
  187. package/test/getTableLabelAccessor.test.js +0 -50
  188. package/test/getTableLayoutIds.test.js +0 -356
  189. package/test/hierarchiseDimensionWithNativeHierarchy2.test.js +0 -109
  190. package/test/isTableLayoutCompatible.test.js +0 -102
  191. package/test/metadata-parsing-perf.test.js +0 -509
  192. package/test/mocks/MSD_TEST.json +0 -490
  193. package/test/mocks/OECD_SNA_TABLE1_1.0_-_AUS_V_metadata.json +0 -152
  194. package/test/mocks/h-codelist.json +0 -2095
  195. package/test/mocks/large_metadata_series.json +0 -701
  196. package/test/mocks/observations-advanced-attributes.json +0 -55382
  197. package/test/mocks/table-invert-time--data.json +0 -80211
  198. package/test/mocks/table-invert-time--inverted.json +0 -80076
  199. package/test/mocks/table-layout-multi-hierarchies--layout.json +0 -621
  200. package/test/mocks/table-layout-multi-hierarchies--layoutData.json +0 -32411
  201. package/test/mocks/table-layout-multi-hierarchies--layoutIndexes.json +0 -2760
  202. package/test/mocks/table-layout-multi-hierarchies--observations.json +0 -30688
  203. package/test/mocks/table-layout-multi-hierarchies--sizedIndexes.json +0 -2762
  204. package/test/mocks/table-layout-truncation1--layout.json +0 -27469
  205. package/test/mocks/table-layout-truncation1--layoutData.json +0 -20358
  206. package/test/mocks/table-layout-truncation1--layoutIndexes.json +0 -7512
  207. package/test/mocks/table-layout-truncation1--observations.json +0 -70002
  208. package/test/mocks/table-layout-truncation1--sizedIndexes.json +0 -3011
  209. package/test/mocks/table-prep-multi-hierarchies--attributes.json +0 -46
  210. package/test/mocks/table-prep-multi-hierarchies--dimensions.json +0 -688
  211. package/test/mocks/table-prep-multi-hierarchies--enhancedObservations.json +0 -19696
  212. package/test/mocks/table-prep-multi-hierarchies--observations.json +0 -8246
  213. package/test/mocks/table-prep-multi-hierarchies--sdmxJson.json +0 -2985
  214. package/test/mocks/table-prep-simple-duplicate--dimensions2.json +0 -858
  215. package/test/mocks/table-prep-simple-duplicate--duplicated2.json +0 -77502
  216. package/test/mocks/table-prep-simple-duplicate--observations2.json +0 -60002
  217. package/test/mocks/table-prep-truncation1--dimensions.json +0 -35057
  218. package/test/mocks/table-prep-truncation1--enhancedObservations.json +0 -70002
  219. package/test/mocks/table-prep-truncation1--observations.json +0 -27502
  220. package/test/mocks/table-prep-truncation1--sdmxJson.json +0 -55103
  221. package/test/mocks/table-prep-units--observations.json +0 -284286
  222. package/test/mocks/table-prep-units--unitsSeries.json +0 -41042
  223. package/test/parseAttributes.test.js +0 -36
  224. package/test/parseCombinations.test.js +0 -172
  225. package/test/parseHierarchicalCodelist.test.js +0 -140
  226. package/test/parseMetadataSeries.test.js +0 -128
  227. package/test/parseSeriesIndexesHierarchies.test.js +0 -345
  228. package/test/parseValueHierarchy.test.js +0 -138
  229. package/test/refineAttributes.test.js +0 -29
  230. package/test/refineLayoutSize2.test.js +0 -3410
  231. package/test/refineMetadataCoordinates.test.js +0 -86
  232. package/test/refineTimePeriod.test.js +0 -580
  233. package/test/refinedDimensions.test.js +0 -35
  234. package/vite.config.mjs +0 -51
@@ -1,309 +0,0 @@
1
- import { expect } from 'chai';
2
- import * as R from 'ramda';
3
- import { getAxisOptions } from '../src/rules/src/chart/getAxisOptions';
4
-
5
- describe('getAxisOptions tests', () => {
6
- it('blank test', () => {
7
- expect(getAxisOptions(null, null, null)).to.deep.equal({
8
- x: {
9
- linear: { pivot: { color: 'white' } },
10
- ordinal: { gap: .3, padding: .3 },
11
- thickness: 0
12
- },
13
- y: {
14
- linear: { pivot: { color: 'white' } },
15
- ordinal: { gap: .3, padding: .3 },
16
- thickness: 0
17
- }
18
- });
19
- });
20
- it('default bar options', () => {
21
- expect(
22
- R.pipe(
23
- R.dissocPath(['x', 'format', 'proc']),
24
- R.dissocPath(['y', 'format', 'proc']),
25
- )(getAxisOptions(null, 'BarChart', null))).to.deep.equal({
26
- x: {
27
- format: {},
28
- linear: { pivot: { color: 'white' } },
29
- ordinal: { gap: .3, padding: .3 },
30
- thickness: 0,
31
- tick: { thickness: 0, size: 0 }
32
- },
33
- y: {
34
- font: { baseline: 'ideographic' },
35
- format: {},
36
- linear: { pivot: { color: 'white', value: 0 } },
37
- ordinal: { gap: .3, padding: .3 },
38
- padding: 10,
39
- thickness: 0,
40
- tick: { thickness: 0 }
41
- }
42
- });
43
- });
44
- it('default bar procs options', () => {
45
- const options = getAxisOptions(null, 'BarChart', null);
46
- const xProc = R.path(['x', 'format', 'proc'], options);
47
- const yProc = R.path(['y', 'format', 'proc'], options);
48
- expect({ x: xProc('ordinal'), y: yProc(321.573) }).to.deep.equal({ x: 'ordinal', y: '321.57' });
49
- });
50
- it('default row options', () => {
51
- expect(
52
- R.pipe(
53
- R.dissocPath(['x', 'format', 'proc']),
54
- R.dissocPath(['y', 'format', 'proc']),
55
- )(getAxisOptions(null, 'RowChart', null))).to.deep.equal({
56
- x: {
57
- format: {},
58
- linear: { pivot: { color: 'white', value: 0 } },
59
- ordinal: { gap: .3, padding: .3 },
60
- orient: 'top',
61
- padding: 10,
62
- thickness: 0,
63
- tick: { thickness: 0 }
64
- },
65
- y: {
66
- format: {},
67
- linear: { pivot: { color: 'white' } },
68
- ordinal: { gap: .3, padding: .3, minDisplaySize: 300 },
69
- thickness: 0,
70
- tick: { thickness: 0, size: 0 }
71
- }
72
- });
73
- });
74
- it('default row procs options', () => {
75
- const options = getAxisOptions(null, 'RowChart', null);
76
- const xProc = R.path(['x', 'format', 'proc'], options);
77
- const yProc = R.path(['y', 'format', 'proc'], options);
78
- expect({ y: yProc('ordinal'), x: xProc(321.573) }).to.deep.equal({ y: 'ordinal', x: '321.57' });
79
- });
80
- it('default scatter options', () => {
81
- expect(
82
- R.pipe(
83
- R.dissocPath(['x', 'format', 'proc']),
84
- R.dissocPath(['y', 'format', 'proc']),
85
- )(getAxisOptions(null, 'ScatterChart', null))).to.deep.equal({
86
- x: {
87
- format: {},
88
- linear: { pivot: { color: 'white' } },
89
- ordinal: { gap: .3, padding: .3 },
90
- thickness: 0,
91
- tick: { thickness: 0, size: 0 }
92
- },
93
- y: {
94
- font: { baseline: 'ideographic' },
95
- format: {},
96
- linear: { pivot: { color: 'white' } },
97
- ordinal: { gap: .3, padding: .3 },
98
- padding: 10,
99
- thickness: 0,
100
- tick: { thickness: 0 }
101
- }
102
- });
103
- });
104
- it('default scatter procs options', () => {
105
- const options = getAxisOptions(null, 'ScatterChart', null);
106
- const xProc = R.path(['x', 'format', 'proc'], options);
107
- const yProc = R.path(['y', 'format', 'proc'], options);
108
- expect({ x: xProc(29.686), y: yProc(321.573) }).to.deep.equal({ x: '29.69', y: '321.57' });
109
- });
110
- it('default annual timeline options', () => {
111
- expect(
112
- R.pipe(
113
- R.dissocPath(['x', 'format', 'proc']),
114
- R.dissocPath(['y', 'format', 'proc']),
115
- )(getAxisOptions({ frequency: 'A' }, 'TimelineChart', null, null))).to.deep.equal({
116
- x: {
117
- format: { isTime: true, pattern: null },
118
- linear: {
119
- frequency: 'year',
120
- step: 1,
121
- pivot: { color: 'white' }
122
- },
123
- ordinal: { gap: .3, padding: .3 },
124
- thickness: 0,
125
- tick: { size: -6, minorSize: -3, thickness: 2, minorThickness: 2, color: 'white', step: 1 }
126
- },
127
- y: {
128
- font: { baseline: 'ideographic' },
129
- format: {},
130
- linear: { pivot: { color: 'white' } },
131
- ordinal: { gap: .3, padding: .3 },
132
- padding: 10,
133
- thickness: 0,
134
- tick: { thickness: 0 }
135
- }
136
- });
137
- });
138
- it('default quarterly timeline options', () => {
139
- expect(
140
- R.pipe(
141
- R.dissocPath(['x', 'format', 'proc']),
142
- R.dissocPath(['y', 'format', 'proc']),
143
- )(getAxisOptions({ frequency: 'Q' }, 'TimelineChart', null, null))).to.deep.equal({
144
- x: {
145
- format: { isTime: true, pattern: null },
146
- linear: {
147
- frequency: 'month',
148
- step: 3,
149
- pivot: { color: 'white' }
150
- },
151
- ordinal: { gap: .3, padding: .3 },
152
- thickness: 0,
153
- tick: { size: -6, minorSize: -3, thickness: 2, minorThickness: 2, color: 'white', step: 3 }
154
- },
155
- y: {
156
- font: { baseline: 'ideographic' },
157
- format: {},
158
- linear: { pivot: { color: 'white' } },
159
- ordinal: { gap: .3, padding: .3 },
160
- padding: 10,
161
- thickness: 0,
162
- tick: { thickness: 0 }
163
- }
164
- });
165
- });
166
- it('default monthly timeline options', () => {
167
- expect(
168
- R.pipe(
169
- R.dissocPath(['x', 'format', 'proc']),
170
- R.dissocPath(['y', 'format', 'proc']),
171
- )(getAxisOptions({ frequency: 'M' }, 'TimelineChart', null, null))).to.deep.equal({
172
- x: {
173
- format: { isTime: true, pattern: null },
174
- linear: {
175
- frequency: 'month',
176
- step: 1,
177
- pivot: { color: 'white' }
178
- },
179
- ordinal: { gap: .3, padding: .3 },
180
- thickness: 0,
181
- tick: { size: -6, minorSize: -3, thickness: 2, minorThickness: 2, color: 'white', step: 1 }
182
- },
183
- y: {
184
- font: { baseline: 'ideographic' },
185
- format: {},
186
- linear: { pivot: { color: 'white' } },
187
- ordinal: { gap: .3, padding: .3 },
188
- padding: 10,
189
- thickness: 0,
190
- tick: { thickness: 0 }
191
- }
192
- });
193
- });
194
- it('default quarterly timeline procs options', () => {
195
- const options = getAxisOptions({ frequency: 'Q' }, 'TimelineChart', null, null);
196
- const xProc = R.path(['x', 'format', 'proc'], options);
197
- const yProc = R.path(['y', 'format', 'proc'], options);
198
- expect({ x: xProc(new Date(2021, 5, 1)), y: yProc(321.573) }).to.deep.equal({ x: '2021-Q2', y: '321.57' });
199
- });
200
- it('default horizontal symbol options', () => {
201
- expect(
202
- R.pipe(
203
- R.dissocPath(['x', 'format', 'proc']),
204
- R.dissocPath(['y', 'format', 'proc']),
205
- )(getAxisOptions(null, 'HorizontalSymbolChart', null))).to.deep.equal({
206
- x: {
207
- format: {},
208
- linear: { pivot: { color: 'white' } },
209
- ordinal: { gap: .3, padding: .3 },
210
- orient: 'top',
211
- padding: 10,
212
- thickness: 0,
213
- tick: { thickness: 0 }
214
- },
215
- y: {
216
- format: {},
217
- linear: { pivot: { color: 'white' } },
218
- ordinal: { gap: .3, padding: .3, minDisplaySize: 300 },
219
- thickness: 0,
220
- tick: { thickness: 0, size: 5 }
221
- }
222
- });
223
- });
224
- it('default horizontal symbol procs options', () => {
225
- const options = getAxisOptions(null, 'HorizontalSymbolChart', null);
226
- const xProc = R.path(['x', 'format', 'proc'], options);
227
- const yProc = R.path(['y', 'format', 'proc'], options);
228
- expect({ y: yProc('ordinal'), x: xProc(321.573) }).to.deep.equal({ y: 'ordinal', x: '321.57' });
229
- });
230
- it('default vertical symbol options', () => {
231
- expect(
232
- R.pipe(
233
- R.dissocPath(['x', 'format', 'proc']),
234
- R.dissocPath(['y', 'format', 'proc']),
235
- )(getAxisOptions(null, 'VerticalSymbolChart', null))).to.deep.equal({
236
- x: {
237
- format: {},
238
- linear: { pivot: { color: 'white' } },
239
- ordinal: { gap: .3, padding: .3 },
240
- thickness: 0,
241
- tick: { thickness: 0, size: 0 }
242
- },
243
- y: {
244
- font: { baseline: 'ideographic' },
245
- format: {},
246
- linear: { pivot: { color: 'white' } },
247
- ordinal: { gap: .3, padding: .3 },
248
- padding: 10,
249
- thickness: 0,
250
- tick: { thickness: 0 }
251
- }
252
- });
253
- });
254
- it('default vertical symbol procs options', () => {
255
- const options = getAxisOptions(null, 'VerticalSymbolChart', null);
256
- const xProc = R.path(['x', 'format', 'proc'], options);
257
- const yProc = R.path(['y', 'format', 'proc'], options);
258
- expect({ x: xProc('ordinal'), y: yProc(321.573) }).to.deep.equal({ x: 'ordinal', y: '321.57' });
259
- });
260
- it('default stacked bar options', () => {
261
- expect(
262
- R.pipe(
263
- R.dissocPath(['x', 'format', 'proc']),
264
- R.dissocPath(['y', 'format', 'proc']),
265
- )(getAxisOptions(null, 'StackedBarChart', null))).to.deep.equal({
266
- x: {
267
- format: {},
268
- linear: { pivot: { color: 'white' } },
269
- ordinal: { gap: .3, padding: .3 },
270
- thickness: 0,
271
- tick: { thickness: 0, size: 0 }
272
- },
273
- y: {
274
- font: { baseline: 'ideographic' },
275
- format: {},
276
- linear: { pivot: { color: 'white', value: 0 } },
277
- ordinal: { gap: .3, padding: .3 },
278
- padding: 10,
279
- thickness: 0,
280
- tick: { thickness: 0 }
281
- }
282
- });
283
- });
284
- it('default stacked procs options', () => {
285
- const options = getAxisOptions(null, 'StackedBarChart', null);
286
- const xProc = R.path(['x', 'format', 'proc'], options);
287
- const yProc = R.path(['y', 'format', 'proc'], options);
288
- expect({ x: xProc('ordinal'), y: yProc(321.573) }).to.deep.equal({ x: 'ordinal', y: '321.57' });
289
- });
290
- it('customization test', () => {
291
- expect(getAxisOptions(null, null, {
292
- axis: {
293
- x: { ordinal: { prop: 'test' }, thickness: 5 },
294
- y: { linear: { pivot: { value: 10 } } }
295
- }
296
- })).to.deep.equal({
297
- x: {
298
- linear: { pivot: { color: 'white' } },
299
- ordinal: { gap: .3, padding: .3, prop: 'test' },
300
- thickness: 5
301
- },
302
- y: {
303
- linear: { pivot: { color: 'white', value: 10 } },
304
- ordinal: { gap: .3, padding: .3 },
305
- thickness: 0
306
- }
307
- });
308
- });
309
- });
@@ -1,77 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getBaseOptions } from '../src/rules/src/chart/getBaseOptions';
3
-
4
- describe('getBaseOptions tests', () => {
5
- it('blank test', () => {
6
- expect(getBaseOptions(null, null)).to.deep.equal({});
7
- });
8
- it('default bar test', () => {
9
- expect(getBaseOptions('BarChart', {})).to.deep.equal({
10
- minDisplayWidth: 300,
11
- minDisplayHeight: 100,
12
- padding: { top: 20 },
13
- innerPadding: { left: 20, right: 20, bottom: 10 }
14
- });
15
- });
16
- it('default row test', () => {
17
- expect(getBaseOptions('RowChart', {})).to.deep.equal({
18
- minDisplayWidth: 100,
19
- minDisplayHeight: 300,
20
- padding: { top: 10, left: 10, right: 20 }
21
- });
22
- });
23
- it('default scatter test', () => {
24
- expect(getBaseOptions('ScatterChart', {})).to.deep.equal({
25
- minDisplayWidth: 100,
26
- minDisplayHeight: 100,
27
- padding: { top: 40, right: 10 }
28
- });
29
- });
30
- it('default timeline test', () => {
31
- expect(getBaseOptions('TimelineChart', {})).to.deep.equal({
32
- minDisplayWidth: 100,
33
- minDisplayHeight: 300,
34
- isAnnotated:false,
35
- padding: { top: 20 },
36
- innerPadding: { left: 40, right: 40 }
37
- });
38
- });
39
- it('default horizontal symbol test', () => {
40
- expect(getBaseOptions('HorizontalSymbolChart', {})).to.deep.equal({
41
- minDisplayWidth: 100,
42
- minDisplayHeight: 300,
43
- padding: { top: 10, left: 10, right: 20 },
44
- });
45
- });
46
- it('default vertical symbol test', () => {
47
- expect(getBaseOptions('VerticalSymbolChart', {})).to.deep.equal({
48
- minDisplayWidth: 300,
49
- minDisplayHeight: 100,
50
- padding: { top: 20 },
51
- innerPadding: { left: 20, right: 20, bottom: 10 }
52
- });
53
- });
54
- it('default stacked test', () => {
55
- expect(getBaseOptions('StackedBarChart', {})).to.deep.equal({
56
- minDisplayWidth: 300,
57
- minDisplayHeight: 100,
58
- padding: { top: 20 },
59
- innerPadding: { left: 20, right: 20, bottom: 10 }
60
- });
61
- });
62
- it('customization test', () => {
63
- expect(getBaseOptions('StackedBarChart', {
64
- base: {
65
- minDisplayHeight: 300,
66
- customOptions: { deep: 'test' },
67
- innerPadding: { top: 15, left: 0 }
68
- }
69
- })).to.deep.equal({
70
- customOptions: { deep: 'test' },
71
- minDisplayWidth: 300,
72
- minDisplayHeight: 300,
73
- padding: { top: 20 },
74
- innerPadding: { left: 0, right: 20, bottom: 10, top: 15 }
75
- });
76
- });
77
- });
@@ -1,32 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getCellValue } from '../src/rules/src/table/factories/getCellValue';
3
-
4
- describe('getCellValue tests', () => {
5
- it('simple muber test', () => {
6
- expect(getCellValue({ value: 2 })).to.equal('2');
7
- });
8
- it('number -1 scale test', () => {
9
- expect(getCellValue({ value: 8.3, prefscale: '-1' })).to.equal('83');
10
- });
11
- it('number 3 scale test', () => {
12
- expect(getCellValue({ value: 25.62, prefscale: '3' })).to.equal('0.02562');
13
- });
14
- it('number 0 decimals test', () => {
15
- expect(getCellValue({ value: 155062.56, decimals: '0' })).to.equal('155,063');
16
- });
17
- it('random string test', () => {
18
- expect(getCellValue({ value: 'blablablablabalba' })).to.equal('blablablablabalba');
19
- });
20
- it('numerical string test', () => {
21
- expect(getCellValue({ value: '654789', prefscale: '3', decimals: '1' })).to.equal('654789');
22
- });
23
- it('boolean test', () => {
24
- expect(getCellValue({ value: true })).to.equal(true);
25
- });
26
- it('month test', () => {
27
- expect(getCellValue({ value: '--06' })).to.equal('06');
28
- });
29
- it('monthDay test', () => {
30
- expect(getCellValue({ value: '--12-31' })).to.equal('12-31');
31
- });
32
- });
@@ -1,178 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getCells } from '../src/rules2/src/';
3
-
4
- const customAttributes = {
5
- flags: ['FL1', 'FL2'],
6
- notes: ['FT1', 'FT2', 'FT3']
7
- };
8
-
9
- describe('getCells tests', () => {
10
- it('flags', () => {
11
- expect(
12
- getCells(customAttributes, ['FL1', 'FL2', 'FT1', 'FT2', 'FT3'], [], {}, [])({
13
- a: {
14
- key: 'a',
15
- value: 33,
16
- formattedValue: '33',
17
- attributes: {
18
- FL1: { id: 'FL1', name: 'Flag 1', Value: null },
19
- FL2: { id: 'FL2', name: 'Flag 2', value: { id: 'FL2.1', name: 'Flag 2 Value 1' } },
20
- FT1: { id: 'FT1', name: 'Footnote 1', value: { id: 'FT1.1', name: 'Footnote 1 Value 1' } },
21
- FT3: { id: 'FT3', name: 'Footnote 3', value: { id: 'FT3.3', name: 'Footnote 3 Value 3' } },
22
- },
23
- indexedDimValIds: {}
24
- }
25
- })).to.deep.equal({
26
- a: {
27
- key: 'a',
28
- value: '33',
29
- intValue: 33,
30
- flags: [
31
- { code: 'FL2.1', id: 'FL2', name: 'Flag 2', value: { id: 'FL2.1', name: 'Flag 2 Value 1' } },
32
- { id: 'FT1', name: 'Footnote 1', value: { id: 'FT1.1', name: 'Footnote 1 Value 1' } },
33
- { id: 'FT3', name: 'Footnote 3', value: { id: 'FT3.3', name: 'Footnote 3 Value 3' } }
34
- ],
35
- indexedDimValIds: {},
36
- sideProps: null
37
- }
38
- })
39
- });
40
- it('combinations', () => {
41
- const combinations = {
42
- cells: [{ id: 'CELLS_COMB', concepts: ['D1', 'D2', 'A1', 'A4'], fixedDimValues: { D1: { id: 'D1V' } } }],
43
- layout: [{ id: 'LAYOUT_COMB', concepts: ['D3', 'A2', 'A3'] }]
44
- };
45
-
46
- const attributesSeries = {
47
- 'D3=v0': { serieKey: 'D3=v0', A2: { value: 'A2V' } }
48
- };
49
-
50
- const cellsAttributesIds = ['FL1', 'FT1', 'A1'];
51
-
52
- const observations = {
53
- 'obs': {
54
- formattedValue: '33',
55
- value: 33,
56
- attributes: {
57
- FL1: { id: 'FL1', value: { id: 'A' } },
58
- FT1: { id: 'FT1', value: { id: 'V' } },
59
- A1: { id: 'A1', value: { id: 'A1V' } },
60
- A2: { id: 'A2', value: { id: 'A2V' }, serieKey: 'D3=v0' },
61
- A3: { id: 'A3', value: { id: 'A3V' }, serieKey: 'D3=v0' },
62
- }
63
- }
64
- };
65
-
66
-
67
- expect(getCells(customAttributes, cellsAttributesIds, combinations, attributesSeries, [])(observations)).to.deep.equal({
68
- 'obs': {
69
- value: '33',
70
- intValue: 33,
71
- sideProps: null,
72
- flags: [
73
- { code: 'A', id: 'FL1', value: { id: 'A' } }, // regular flag
74
- { id: 'FT1', value: { id: 'V' } }, // regular foot note
75
- { id: 'A3', value: { id: 'A3V' } }, // rejected layout combination value displayed as a footnote
76
- { id: 'CELLS_COMB', values: [{ id: 'D1V' }, { id: 'A1V' }] } // cell level combination with fixed dim value
77
- ]
78
- }
79
- });
80
- });
81
- it('duplication between notes and combinations definitions', () => {
82
- const _customAttributes = {
83
- flags: [],
84
- notes: ['A1', 'A2']
85
- };
86
-
87
- const combinations = {
88
- cells: [],
89
- layout: [{ id: 'LAYOUT_COMB', concepts: ['D1', 'A1'] }]
90
- };
91
-
92
- const attributesSeries = { 'D1=V0': {} };
93
-
94
- const cellsAttributesIds = ['A2'];
95
-
96
- const observations = {
97
- 'obs': {
98
- value: 'val',
99
- formattedValue: 'val',
100
- attributes: {
101
- A1: { id: 'A1', value: { id: 'A1V' }, serieKey: 'D1=V0' },
102
- A2: { id: 'A2', value: { id: 'A2V' } },
103
- }
104
- }
105
- };
106
- expect(getCells(_customAttributes, cellsAttributesIds, combinations, attributesSeries, [])(observations)).to.deep.equal({
107
- 'obs': {
108
- value: 'val',
109
- intValue: null,
110
- sideProps: null,
111
- flags: [
112
- { id: 'A1', value: { id: 'A1V' } },
113
- { id: 'A2', value: { id: 'A2V' } }
114
- ]
115
- }
116
- });
117
- });
118
- it('metadata and OBS_ATTRIBUTES', () => {
119
- const _customAttributes = {
120
- flags: [],
121
- notes: []
122
- };
123
-
124
- const combinations = {
125
- cells: [],
126
- layout: []
127
- };
128
-
129
- const observations = {
130
- 'a': {
131
- value: 'val',
132
- formattedValue: 'val',
133
- attributes: {},
134
- indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' }
135
- },
136
- 'b': {
137
- value: 'attr val',
138
- formattedValue: 'attr val',
139
- attributes: {},
140
- indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'A' }
141
- },
142
- 'c': {
143
- value: 'val',
144
- formattedValue: 'val',
145
- attributes: { ADV_ATTR: { id: 'ADV_ATTR', value: { id: 'v' } } },
146
- indexedDimValIds: { d0: 'v1', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' }
147
- },
148
- };
149
- const metadataCoordinates = [{ d0: 'v0', d1: 'v0' }];
150
- expect(getCells(_customAttributes, {}, combinations, {}, metadataCoordinates)(observations)).to.deep.equal({
151
- 'a': {
152
- value: 'val',
153
- intValue: null,
154
- indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' },
155
- sideProps: { advancedAttributes: {}, hasMetadata: true, coordinates: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' } },
156
- flags: []
157
- },
158
- 'b': {
159
- value: 'attr val',
160
- intValue: null,
161
- indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'A' },
162
- sideProps: null,
163
- flags: []
164
- },
165
- 'c': {
166
- value: 'val',
167
- intValue: null,
168
- indexedDimValIds: { d0: 'v1', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' },
169
- flags: [],
170
- sideProps: {
171
- advancedAttributes: { ADV_ATTR: { id: 'ADV_ATTR', value: { id: 'v' } } },
172
- hasMetadata: false,
173
- coordinates: { d0: 'v1', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' }
174
- },
175
- },
176
- });
177
- });
178
- });
@@ -1,40 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getCellsMetadataCoordinates } from '../src/rules2/src/';
3
-
4
- describe('getCellsMetadataCoordinates tests', () => {
5
- it('basic tests', () => {
6
- const oneValueDimensions = [
7
- { id: 'HEADER1' },
8
- { id: 'HEADER2' },
9
- ];
10
-
11
- const layoutIds = {
12
- header: ['COLUMN1', 'COLUMN2'],
13
- sections: ['SECTION1', 'SECTION2'],
14
- rows: ['ROW1', 'ROW2'],
15
- };
16
-
17
- const coordinates = [
18
- {},
19
- { HEADER1: 'v' },
20
- { HEADER1: 'v', HEADER2: 'v' },
21
- { COLUMN1: 'v' },
22
- { COLUMN1: 'v', COLUMN2: 'v' },
23
- { HEADER1: 'v', COLUMN1: 'v', COLUMN2: 'v' },
24
- { SECTION1: 'v' },
25
- { SECTION1: 'v', SECTION2: 'v' },
26
- { HEADER1: 'v', SECTION1: 'v', SECTION2: 'v' },
27
- { ROW1: 'v' },
28
- { ROW1: 'v', ROW2: 'v' },
29
- { HEADER1: 'v', ROW1: 'v', ROW2: 'v' },
30
- { HEADER1: 'v', SECTION1: 'v', SECTION2: 'v', ROW1: 'v', ROW2: 'v' },
31
- { ROW1: 'v', HEADER2: 'v', COLUMN2: 'v' },
32
- { SECTION1: 'v', ROW2: 'v', COLUMN1: 'v' }
33
- ];
34
-
35
- expect(getCellsMetadataCoordinates(coordinates, oneValueDimensions, layoutIds)).to.deep.equal([
36
- { ROW1: 'v', HEADER2: 'v', COLUMN2: 'v' },
37
- { SECTION1: 'v', ROW2: 'v', COLUMN1: 'v' }
38
- ]);
39
- });
40
- });