@sis-cc/dotstatsuite-components 22.0.3 → 22.0.5
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { sortBy, map, head, split, isNil, isEmpty } from 'lodash';
|
|
2
2
|
import { categoryDisplay } from '../dimension-utils.js';
|
|
3
|
+
import { getFormatedObservation } from '../observation-formater.js';
|
|
3
4
|
|
|
4
5
|
const getDatapoints = (
|
|
5
|
-
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
6
|
+
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
6
7
|
) => {
|
|
7
8
|
const [categoryKey, valueKey] = keys;
|
|
8
9
|
const sortFunc = dp => dp[valueKey] * sortDirection;
|
|
@@ -29,21 +30,21 @@ const getDatapoints = (
|
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
const series = (
|
|
32
|
-
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
33
|
+
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
33
34
|
) => {
|
|
34
35
|
return [{
|
|
35
36
|
datapoints: getDatapoints(
|
|
36
|
-
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
37
|
+
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
37
38
|
)
|
|
38
39
|
}]
|
|
39
40
|
};
|
|
40
41
|
|
|
41
|
-
var __sampleSeries = (chartType, { observations, dimensions }, dimensionsWithValuesIndexedById, display, formaterAttrs
|
|
42
|
+
var __sampleSeries = (chartType, { observations, dimensions }, dimensionsWithValuesIndexedById, display, formaterAttrs) => {
|
|
42
43
|
switch(chartType) {
|
|
43
44
|
case 'BarChart':
|
|
44
|
-
return series(['x', 'y'], observations, dimensions, dimensionsWithValuesIndexedById, 1, display, formaterAttrs
|
|
45
|
+
return series(['x', 'y'], observations, dimensions, dimensionsWithValuesIndexedById, 1, display, formaterAttrs);
|
|
45
46
|
case 'RowChart':
|
|
46
|
-
return series(['y', 'x'], observations, dimensions, dimensionsWithValuesIndexedById, -1, display, formaterAttrs
|
|
47
|
+
return series(['y', 'x'], observations, dimensions, dimensionsWithValuesIndexedById, -1, display, formaterAttrs);
|
|
47
48
|
default:
|
|
48
49
|
return [];
|
|
49
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sample-series.js","sources":["../../../../src/rules/src/factories/sample-series.js"],"sourcesContent":["import { map, sortBy, head, isEmpty, isNil, split } from 'lodash';\nimport { categoryDisplay } from '../dimension-utils';\n\nexport const getDatapoints = (\n keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
1
|
+
{"version":3,"file":"sample-series.js","sources":["../../../../src/rules/src/factories/sample-series.js"],"sourcesContent":["import { map, sortBy, head, isEmpty, isNil, split } from 'lodash';\nimport { categoryDisplay } from '../dimension-utils';\nimport { getFormatedObservation } from '../observation-formater';\n\nexport const getDatapoints = (\n keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs\n) => {\n const [categoryKey, valueKey] = keys;\n const sortFunc = dp => dp[valueKey] * sortDirection;\n\n return sortBy(\n map(\n observations,\n (observationValue, observationKey) => {\n const value = head(observationValue);\n const category = categoryDisplay(split(observationKey, ':'), dimensions, dimensionsWithValuesIndexedById, null, display);\n const categoryIds = categoryDisplay(split(observationKey, ':'), dimensions, dimensionsWithValuesIndexedById, null, 'code');\n const formatedValue = getFormatedObservation(observationValue, formaterAttrs);\n\n let key = categoryIds;\n if (isNil(key) || isEmpty(key)) {\n key = 'uniq-dp';\n }\n\n return { value, category, [valueKey]: value, [categoryKey]: category, key, formatedValue };\n }\n ),\n sortFunc\n );\n};\n\nexport const series = (\n keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs\n) => {\n return [{\n datapoints: getDatapoints(\n keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs\n )\n }]\n};\n\nexport default (chartType, { observations, dimensions }, dimensionsWithValuesIndexedById, display, formaterAttrs) => {\n switch(chartType) {\n case 'BarChart':\n return series(['x', 'y'], observations, dimensions, dimensionsWithValuesIndexedById, 1, display, formaterAttrs);\n case 'RowChart':\n return series(['y', 'x'], observations, dimensions, dimensionsWithValuesIndexedById, -1, display, formaterAttrs);\n default:\n return [];\n }\n};\n"],"names":[],"mappings":";;;;AAIY,MAAC,aAAa,GAAG;AAC7B,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,+BAA+B,EAAE,aAAa,EAAE,OAAO,EAAE;AAC3F,KAAK;AACL,EAAE,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,GAAG,IAAI;AACtC,EAAE,MAAM,QAAQ,IAAI,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,aAAa;;AAEtD,EAAE,OAAO,MAAM;AACf,IAAI,GAAG;AACP,MAAM,YAAY;AAClB,MAAM,CAAC,gBAAgB,EAAE,cAAc,KAAK;AAC5C,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC;AAC5C,QAAQ,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,+BAA+B,EAAE,IAAI,EAAE,OAAO,CAAC;AAChI,QAAQ,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,+BAA+B,EAAE,IAAI,EAAE,MAAM,CAAC;AAClI,QAAQ,MAAM,aAAa,GAAG,sBAAsB,CAAC,gBAAgB,EAAE,aAAa,CAAC;;AAErF,QAAQ,IAAI,GAAG,GAAG,WAAW;AAC7B,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;AACxC,UAAU,GAAG,GAAG,SAAS;AACzB,QAAQ;;AAER,QAAQ,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,QAAQ,GAAG,KAAK,EAAE,CAAC,WAAW,GAAG,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE;AAClG,MAAM;AACN,KAAK;AACL,IAAI;AACJ,GAAG;AACH;;AAEY,MAAC,MAAM,GAAG;AACtB,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,+BAA+B,EAAE,aAAa,EAAE,OAAO,EAAE;AAC3F,KAAK;AACL,EAAE,OAAO,CAAC;AACV,IAAI,UAAU,EAAE,aAAa;AAC7B,MAAM,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,+BAA+B,EAAE,aAAa,EAAE,OAAO,EAAE;AAC/F;AACA,GAAG;AACH;;AAEA,qBAAe,CAAC,SAAS,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,+BAA+B,EAAE,OAAO,EAAE,aAAa,KAAK;AACrH,EAAE,OAAO,SAAS;AAClB,IAAI,KAAK,UAAU;AACnB,MAAM,OAAO,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,+BAA+B,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC;AACrH,IAAI,KAAK,UAAU;AACnB,MAAM,OAAO,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,+BAA+B,EAAE,EAAE,EAAE,OAAO,EAAE,aAAa,CAAC;AACtH,IAAI;AACJ,MAAM,OAAO,EAAE;AACf;AACA,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { map, sortBy, head, isEmpty, isNil, split } from 'lodash';
|
|
2
2
|
import { categoryDisplay } from '../dimension-utils';
|
|
3
|
+
import { getFormatedObservation } from '../observation-formater';
|
|
3
4
|
|
|
4
5
|
export const getDatapoints = (
|
|
5
|
-
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
6
|
+
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
6
7
|
) => {
|
|
7
8
|
const [categoryKey, valueKey] = keys;
|
|
8
9
|
const sortFunc = dp => dp[valueKey] * sortDirection;
|
|
@@ -29,21 +30,21 @@ export const getDatapoints = (
|
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
export const series = (
|
|
32
|
-
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
33
|
+
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
33
34
|
) => {
|
|
34
35
|
return [{
|
|
35
36
|
datapoints: getDatapoints(
|
|
36
|
-
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
37
|
+
keys, observations, dimensions, dimensionsWithValuesIndexedById, sortDirection, display, formaterAttrs
|
|
37
38
|
)
|
|
38
39
|
}]
|
|
39
40
|
};
|
|
40
41
|
|
|
41
|
-
export default (chartType, { observations, dimensions }, dimensionsWithValuesIndexedById, display, formaterAttrs
|
|
42
|
+
export default (chartType, { observations, dimensions }, dimensionsWithValuesIndexedById, display, formaterAttrs) => {
|
|
42
43
|
switch(chartType) {
|
|
43
44
|
case 'BarChart':
|
|
44
|
-
return series(['x', 'y'], observations, dimensions, dimensionsWithValuesIndexedById, 1, display, formaterAttrs
|
|
45
|
+
return series(['x', 'y'], observations, dimensions, dimensionsWithValuesIndexedById, 1, display, formaterAttrs);
|
|
45
46
|
case 'RowChart':
|
|
46
|
-
return series(['y', 'x'], observations, dimensions, dimensionsWithValuesIndexedById, -1, display, formaterAttrs
|
|
47
|
+
return series(['y', 'x'], observations, dimensions, dimensionsWithValuesIndexedById, -1, display, formaterAttrs);
|
|
47
48
|
default:
|
|
48
49
|
return [];
|
|
49
50
|
}
|