From de2d4686a73ede87b4303740119ecc7ea82ccd78 Mon Sep 17 00:00:00 2001 From: HendrikThePendric Date: Mon, 2 Dec 2024 12:32:38 +0100 Subject: [PATCH] chore: use fixtures for single value story for easier debugging --- src/__demo__/SingleValue.stories.js | 609 +------------------- src/__fixtures__/SingleValue/FnYCr2EAzWS.js | 593 +++++++++++++++++++ src/__fixtures__/SingleValue/abcWXyv0zpa.js | 414 +++++++++++++ src/__fixtures__/SingleValue/index.js | 4 + 4 files changed, 1022 insertions(+), 598 deletions(-) create mode 100644 src/__fixtures__/SingleValue/FnYCr2EAzWS.js create mode 100644 src/__fixtures__/SingleValue/abcWXyv0zpa.js create mode 100644 src/__fixtures__/SingleValue/index.js diff --git a/src/__demo__/SingleValue.stories.js b/src/__demo__/SingleValue.stories.js index 2b382123f..b094b9664 100644 --- a/src/__demo__/SingleValue.stories.js +++ b/src/__demo__/SingleValue.stories.js @@ -1,5 +1,13 @@ import React, { useState, useMemo, useRef, useEffect } from 'react' +import fixtures from '../__fixtures__/SingleValue/index.js' import { createVisualization } from '../index.js' + +const ID = 'FnYCr2EAzWS' +const { baseDataObj, layout, baseExtraOptions } = fixtures[ID] +const icon = + baseExtraOptions.icon ?? + '' + const constainerStyleBase = { width: 800, height: 800, @@ -13,420 +21,6 @@ const innerContainerStyle = { height: '100%', } -const baseDataObj = { - response: { - headers: [ - { - name: 'dx', - column: 'Data', - valueType: 'TEXT', - type: 'java.lang.String', - hidden: false, - meta: true, - }, - { - name: 'value', - column: 'Value', - valueType: 'NUMBER', - type: 'java.lang.Double', - hidden: false, - meta: false, - }, - ], - metaData: { - items: { - 202308: { - uid: '202308', - code: '202308', - name: 'August 2023', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2023-08-01T00:00:00.000', - endDate: '2023-08-31T00:00:00.000', - }, - 202309: { - uid: '202309', - code: '202309', - name: 'September 2023', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2023-09-01T00:00:00.000', - endDate: '2023-09-30T00:00:00.000', - }, - 202310: { - uid: '202310', - code: '202310', - name: 'October 2023', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2023-10-01T00:00:00.000', - endDate: '2023-10-31T00:00:00.000', - }, - 202311: { - uid: '202311', - code: '202311', - name: 'November 2023', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2023-11-01T00:00:00.000', - endDate: '2023-11-30T00:00:00.000', - }, - 202312: { - uid: '202312', - code: '202312', - name: 'December 2023', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2023-12-01T00:00:00.000', - endDate: '2023-12-31T00:00:00.000', - }, - 202401: { - uid: '202401', - code: '202401', - name: 'January 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-01-01T00:00:00.000', - endDate: '2024-01-31T00:00:00.000', - }, - 202402: { - uid: '202402', - code: '202402', - name: 'February 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-02-01T00:00:00.000', - endDate: '2024-02-29T00:00:00.000', - }, - 202403: { - uid: '202403', - code: '202403', - name: 'March 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-03-01T00:00:00.000', - endDate: '2024-03-31T00:00:00.000', - }, - 202404: { - uid: '202404', - code: '202404', - name: 'April 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-04-01T00:00:00.000', - endDate: '2024-04-30T00:00:00.000', - }, - 202405: { - uid: '202405', - code: '202405', - name: 'May 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-05-01T00:00:00.000', - endDate: '2024-05-31T00:00:00.000', - }, - 202406: { - uid: '202406', - code: '202406', - name: 'June 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-06-01T00:00:00.000', - endDate: '2024-06-30T00:00:00.000', - }, - 202407: { - uid: '202407', - code: '202407', - name: 'July 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-07-01T00:00:00.000', - endDate: '2024-07-31T00:00:00.000', - }, - ou: { - uid: 'ou', - name: 'Organisation unit', - dimensionType: 'ORGANISATION_UNIT', - }, - O6uvpzGd5pu: { - uid: 'O6uvpzGd5pu', - code: 'OU_264', - name: 'Bo', - dimensionItemType: 'ORGANISATION_UNIT', - valueType: 'TEXT', - totalAggregationType: 'SUM', - }, - LAST_12_MONTHS: { - name: 'Last 12 months', - }, - dx: { - uid: 'dx', - name: 'Data', - dimensionType: 'DATA_X', - }, - pe: { - uid: 'pe', - name: 'Period', - dimensionType: 'PERIOD', - }, - FnYCr2EAzWS: { - uid: 'FnYCr2EAzWS', - code: 'IN_52493', - name: 'BCG Coverage <1y', - legendSet: 'BtxOoQuLyg1', - dimensionItemType: 'INDICATOR', - valueType: 'NUMBER', - totalAggregationType: 'AVERAGE', - indicatorType: { - name: 'Per cent', - displayName: 'Per cent', - factor: 100, - number: false, - }, - }, - }, - dimensions: { - dx: ['FnYCr2EAzWS'], - pe: [ - '202308', - '202309', - '202310', - '202311', - '202312', - '202401', - '202402', - '202403', - '202404', - '202405', - '202406', - '202407', - ], - ou: ['O6uvpzGd5pu'], - co: [], - }, - }, - rowContext: {}, - rows: [['FnYCr2EAzWS', '34.19']], - width: 2, - height: 1, - headerWidth: 2, - }, - headers: [ - { - name: 'dx', - column: 'Data', - valueType: 'TEXT', - type: 'java.lang.String', - hidden: false, - meta: true, - isPrefix: false, - isCollect: false, - index: 0, - }, - { - name: 'value', - column: 'Value', - valueType: 'NUMBER', - type: 'java.lang.Double', - hidden: false, - meta: false, - isPrefix: false, - isCollect: false, - index: 1, - }, - ], - rows: [['FnYCr2EAzWS', '34.19']], - metaData: { - items: { - 202308: { - uid: '202308', - code: '202308', - name: 'August 2023', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2023-08-01T00:00:00.000', - endDate: '2023-08-31T00:00:00.000', - }, - 202309: { - uid: '202309', - code: '202309', - name: 'September 2023', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2023-09-01T00:00:00.000', - endDate: '2023-09-30T00:00:00.000', - }, - 202310: { - uid: '202310', - code: '202310', - name: 'October 2023', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2023-10-01T00:00:00.000', - endDate: '2023-10-31T00:00:00.000', - }, - 202311: { - uid: '202311', - code: '202311', - name: 'November 2023', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2023-11-01T00:00:00.000', - endDate: '2023-11-30T00:00:00.000', - }, - 202312: { - uid: '202312', - code: '202312', - name: 'December 2023', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2023-12-01T00:00:00.000', - endDate: '2023-12-31T00:00:00.000', - }, - 202401: { - uid: '202401', - code: '202401', - name: 'January 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-01-01T00:00:00.000', - endDate: '2024-01-31T00:00:00.000', - }, - 202402: { - uid: '202402', - code: '202402', - name: 'February 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-02-01T00:00:00.000', - endDate: '2024-02-29T00:00:00.000', - }, - 202403: { - uid: '202403', - code: '202403', - name: 'March 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-03-01T00:00:00.000', - endDate: '2024-03-31T00:00:00.000', - }, - 202404: { - uid: '202404', - code: '202404', - name: 'April 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-04-01T00:00:00.000', - endDate: '2024-04-30T00:00:00.000', - }, - 202405: { - uid: '202405', - code: '202405', - name: 'May 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-05-01T00:00:00.000', - endDate: '2024-05-31T00:00:00.000', - }, - 202406: { - uid: '202406', - code: '202406', - name: 'June 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-06-01T00:00:00.000', - endDate: '2024-06-30T00:00:00.000', - }, - 202407: { - uid: '202407', - code: '202407', - name: 'July 2024', - dimensionItemType: 'PERIOD', - valueType: 'TEXT', - totalAggregationType: 'SUM', - startDate: '2024-07-01T00:00:00.000', - endDate: '2024-07-31T00:00:00.000', - }, - ou: { - uid: 'ou', - name: 'Organisation unit', - dimensionType: 'ORGANISATION_UNIT', - }, - O6uvpzGd5pu: { - uid: 'O6uvpzGd5pu', - code: 'OU_264', - name: 'Bo', - dimensionItemType: 'ORGANISATION_UNIT', - valueType: 'TEXT', - totalAggregationType: 'SUM', - }, - LAST_12_MONTHS: { - name: 'Last 12 months', - }, - dx: { - uid: 'dx', - name: 'Data', - dimensionType: 'DATA_X', - }, - pe: { - uid: 'pe', - name: 'Period', - dimensionType: 'PERIOD', - }, - FnYCr2EAzWS: { - uid: 'FnYCr2EAzWS', - code: 'IN_52493', - name: 'BCG Coverage <1y', - legendSet: 'BtxOoQuLyg1', - dimensionItemType: 'INDICATOR', - valueType: 'NUMBER', - totalAggregationType: 'AVERAGE', - }, - }, - dimensions: { - dx: ['FnYCr2EAzWS'], - pe: [ - '202308', - '202309', - '202310', - '202311', - '202312', - '202401', - '202402', - '202403', - '202404', - '202405', - '202406', - '202407', - ], - ou: ['O6uvpzGd5pu'], - co: [], - }, - }, -} const numberIndicatorType = { name: 'Plain', number: true, @@ -442,187 +36,6 @@ const percentIndicatorType = { factor: 100, number: false, } -const layout = { - name: 'BCG coverage last 12 months - Bo', - created: '2013-10-16T19:50:52.464', - lastUpdated: '2021-07-06T12:53:57.296', - translations: [], - favorites: [], - lastUpdatedBy: { - id: 'xE7jOejl9FI', - code: null, - name: 'John Traore', - displayName: 'John Traore', - username: 'admin', - }, - regressionType: 'NONE', - displayDensity: 'NORMAL', - fontSize: 'NORMAL', - sortOrder: 0, - topLimit: 0, - hideEmptyRows: false, - showHierarchy: false, - completedOnly: false, - skipRounding: false, - dataDimensionItems: [ - { - indicator: { - name: 'BCG Coverage <1y', - dimensionItemType: 'INDICATOR', - displayName: 'BCG Coverage <1y', - access: { - manage: true, - externalize: true, - write: true, - read: true, - update: true, - delete: true, - }, - displayShortName: 'BCG Coverage <1y', - id: 'FnYCr2EAzWS', - }, - dataDimensionItemType: 'INDICATOR', - }, - ], - subscribers: [], - aggregationType: 'DEFAULT', - digitGroupSeparator: 'SPACE', - hideEmptyRowItems: 'NONE', - noSpaceBetweenColumns: false, - cumulativeValues: false, - percentStackedValues: false, - showData: true, - colTotals: false, - rowTotals: false, - rowSubTotals: false, - colSubTotals: false, - hideTitle: false, - hideSubtitle: false, - showDimensionLabels: false, - interpretations: [], - type: 'SINGLE_VALUE', - reportingParams: { - grandParentOrganisationUnit: false, - parentOrganisationUnit: false, - organisationUnit: false, - reportingPeriod: false, - }, - numberType: 'VALUE', - fontStyle: {}, - colorSet: 'DEFAULT', - yearlySeries: [], - regression: false, - hideEmptyColumns: false, - fixColumnHeaders: false, - fixRowHeaders: false, - filters: [ - { - items: [ - { - name: 'Bo', - dimensionItemType: 'ORGANISATION_UNIT', - displayShortName: 'Bo', - displayName: 'Bo', - access: { - manage: true, - externalize: true, - write: true, - read: true, - update: true, - delete: true, - }, - id: 'O6uvpzGd5pu', - }, - ], - dimension: 'ou', - }, - { - items: [ - { - name: 'LAST_12_MONTHS', - dimensionItemType: 'PERIOD', - displayShortName: 'LAST_12_MONTHS', - displayName: 'LAST_12_MONTHS', - access: { - manage: true, - externalize: true, - write: true, - read: true, - update: true, - delete: true, - }, - id: 'LAST_12_MONTHS', - }, - ], - dimension: 'pe', - }, - ], - parentGraphMap: { - O6uvpzGd5pu: 'ImspTQPwCqd', - }, - columns: [ - { - items: [ - { - name: 'BCG Coverage <1y', - dimensionItemType: 'INDICATOR', - displayName: 'BCG Coverage <1y', - access: { - manage: true, - externalize: true, - write: true, - read: true, - update: true, - delete: true, - }, - displayShortName: 'BCG Coverage <1y', - id: 'FnYCr2EAzWS', - }, - ], - dimension: 'dx', - }, - ], - rows: [], - subscribed: false, - displayName: 'BCG coverage last 12 months - Bo', - access: { - manage: true, - externalize: true, - write: true, - read: true, - update: true, - delete: true, - }, - favorite: false, - user: { - id: 'xE7jOejl9FI', - code: null, - name: 'John Traore', - displayName: 'John Traore', - username: 'admin', - }, - href: 'http://localhost:8080/api/41/visualizations/mYMnDl5Z9oD', - id: 'mYMnDl5Z9oD', - legend: { - showKey: false, - }, - sorting: [], - series: [], - icons: [], - seriesKey: { - hidden: false, - }, - axes: [], -} -const icon = - '' - -const baseExtraOptions = { - dashboard: true, - animation: 200, - legendSets: [], - icon, -} const indicatorTypes = ['plain', 'percent', 'subtext'] @@ -657,15 +70,15 @@ export const Default = () => { const dataObj = { ...baseDataObj } if (indicatorType === 'plain') { - dataObj.metaData.items.FnYCr2EAzWS.indicatorType = + dataObj.metaData.items[ID].indicatorType = numberIndicatorType } if (indicatorType === 'percent') { - dataObj.metaData.items.FnYCr2EAzWS.indicatorType = + dataObj.metaData.items[ID].indicatorType = percentIndicatorType } if (indicatorType === 'subtext') { - dataObj.metaData.items.FnYCr2EAzWS.indicatorType = + dataObj.metaData.items[ID].indicatorType = subtextIndicatorType } const newVisualization = createVisualization( diff --git a/src/__fixtures__/SingleValue/FnYCr2EAzWS.js b/src/__fixtures__/SingleValue/FnYCr2EAzWS.js new file mode 100644 index 000000000..dcef82d6b --- /dev/null +++ b/src/__fixtures__/SingleValue/FnYCr2EAzWS.js @@ -0,0 +1,593 @@ +export const baseDataObj = { + response: { + headers: [ + { + name: 'dx', + column: 'Data', + valueType: 'TEXT', + type: 'java.lang.String', + hidden: false, + meta: true, + }, + { + name: 'value', + column: 'Value', + valueType: 'NUMBER', + type: 'java.lang.Double', + hidden: false, + meta: false, + }, + ], + metaData: { + items: { + 202308: { + uid: '202308', + code: '202308', + name: 'August 2023', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2023-08-01T00:00:00.000', + endDate: '2023-08-31T00:00:00.000', + }, + 202309: { + uid: '202309', + code: '202309', + name: 'September 2023', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2023-09-01T00:00:00.000', + endDate: '2023-09-30T00:00:00.000', + }, + 202310: { + uid: '202310', + code: '202310', + name: 'October 2023', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2023-10-01T00:00:00.000', + endDate: '2023-10-31T00:00:00.000', + }, + 202311: { + uid: '202311', + code: '202311', + name: 'November 2023', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2023-11-01T00:00:00.000', + endDate: '2023-11-30T00:00:00.000', + }, + 202312: { + uid: '202312', + code: '202312', + name: 'December 2023', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2023-12-01T00:00:00.000', + endDate: '2023-12-31T00:00:00.000', + }, + 202401: { + uid: '202401', + code: '202401', + name: 'January 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-01-01T00:00:00.000', + endDate: '2024-01-31T00:00:00.000', + }, + 202402: { + uid: '202402', + code: '202402', + name: 'February 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-02-01T00:00:00.000', + endDate: '2024-02-29T00:00:00.000', + }, + 202403: { + uid: '202403', + code: '202403', + name: 'March 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-03-01T00:00:00.000', + endDate: '2024-03-31T00:00:00.000', + }, + 202404: { + uid: '202404', + code: '202404', + name: 'April 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-04-01T00:00:00.000', + endDate: '2024-04-30T00:00:00.000', + }, + 202405: { + uid: '202405', + code: '202405', + name: 'May 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-05-01T00:00:00.000', + endDate: '2024-05-31T00:00:00.000', + }, + 202406: { + uid: '202406', + code: '202406', + name: 'June 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-06-01T00:00:00.000', + endDate: '2024-06-30T00:00:00.000', + }, + 202407: { + uid: '202407', + code: '202407', + name: 'July 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-07-01T00:00:00.000', + endDate: '2024-07-31T00:00:00.000', + }, + ou: { + uid: 'ou', + name: 'Organisation unit', + dimensionType: 'ORGANISATION_UNIT', + }, + O6uvpzGd5pu: { + uid: 'O6uvpzGd5pu', + code: 'OU_264', + name: 'Bo', + dimensionItemType: 'ORGANISATION_UNIT', + valueType: 'TEXT', + totalAggregationType: 'SUM', + }, + LAST_12_MONTHS: { + name: 'Last 12 months', + }, + dx: { + uid: 'dx', + name: 'Data', + dimensionType: 'DATA_X', + }, + pe: { + uid: 'pe', + name: 'Period', + dimensionType: 'PERIOD', + }, + FnYCr2EAzWS: { + uid: 'FnYCr2EAzWS', + code: 'IN_52493', + name: 'BCG Coverage <1y', + legendSet: 'BtxOoQuLyg1', + dimensionItemType: 'INDICATOR', + valueType: 'NUMBER', + totalAggregationType: 'AVERAGE', + indicatorType: { + name: 'Per cent', + displayName: 'Per cent', + factor: 100, + number: false, + }, + }, + }, + dimensions: { + dx: ['FnYCr2EAzWS'], + pe: [ + '202308', + '202309', + '202310', + '202311', + '202312', + '202401', + '202402', + '202403', + '202404', + '202405', + '202406', + '202407', + ], + ou: ['O6uvpzGd5pu'], + co: [], + }, + }, + rowContext: {}, + rows: [['FnYCr2EAzWS', '34.19']], + width: 2, + height: 1, + headerWidth: 2, + }, + headers: [ + { + name: 'dx', + column: 'Data', + valueType: 'TEXT', + type: 'java.lang.String', + hidden: false, + meta: true, + isPrefix: false, + isCollect: false, + index: 0, + }, + { + name: 'value', + column: 'Value', + valueType: 'NUMBER', + type: 'java.lang.Double', + hidden: false, + meta: false, + isPrefix: false, + isCollect: false, + index: 1, + }, + ], + rows: [['FnYCr2EAzWS', '34.19']], + metaData: { + items: { + 202308: { + uid: '202308', + code: '202308', + name: 'August 2023', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2023-08-01T00:00:00.000', + endDate: '2023-08-31T00:00:00.000', + }, + 202309: { + uid: '202309', + code: '202309', + name: 'September 2023', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2023-09-01T00:00:00.000', + endDate: '2023-09-30T00:00:00.000', + }, + 202310: { + uid: '202310', + code: '202310', + name: 'October 2023', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2023-10-01T00:00:00.000', + endDate: '2023-10-31T00:00:00.000', + }, + 202311: { + uid: '202311', + code: '202311', + name: 'November 2023', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2023-11-01T00:00:00.000', + endDate: '2023-11-30T00:00:00.000', + }, + 202312: { + uid: '202312', + code: '202312', + name: 'December 2023', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2023-12-01T00:00:00.000', + endDate: '2023-12-31T00:00:00.000', + }, + 202401: { + uid: '202401', + code: '202401', + name: 'January 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-01-01T00:00:00.000', + endDate: '2024-01-31T00:00:00.000', + }, + 202402: { + uid: '202402', + code: '202402', + name: 'February 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-02-01T00:00:00.000', + endDate: '2024-02-29T00:00:00.000', + }, + 202403: { + uid: '202403', + code: '202403', + name: 'March 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-03-01T00:00:00.000', + endDate: '2024-03-31T00:00:00.000', + }, + 202404: { + uid: '202404', + code: '202404', + name: 'April 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-04-01T00:00:00.000', + endDate: '2024-04-30T00:00:00.000', + }, + 202405: { + uid: '202405', + code: '202405', + name: 'May 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-05-01T00:00:00.000', + endDate: '2024-05-31T00:00:00.000', + }, + 202406: { + uid: '202406', + code: '202406', + name: 'June 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-06-01T00:00:00.000', + endDate: '2024-06-30T00:00:00.000', + }, + 202407: { + uid: '202407', + code: '202407', + name: 'July 2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-07-01T00:00:00.000', + endDate: '2024-07-31T00:00:00.000', + }, + ou: { + uid: 'ou', + name: 'Organisation unit', + dimensionType: 'ORGANISATION_UNIT', + }, + O6uvpzGd5pu: { + uid: 'O6uvpzGd5pu', + code: 'OU_264', + name: 'Bo', + dimensionItemType: 'ORGANISATION_UNIT', + valueType: 'TEXT', + totalAggregationType: 'SUM', + }, + LAST_12_MONTHS: { + name: 'Last 12 months', + }, + dx: { + uid: 'dx', + name: 'Data', + dimensionType: 'DATA_X', + }, + pe: { + uid: 'pe', + name: 'Period', + dimensionType: 'PERIOD', + }, + FnYCr2EAzWS: { + uid: 'FnYCr2EAzWS', + code: 'IN_52493', + name: 'BCG Coverage <1y', + legendSet: 'BtxOoQuLyg1', + dimensionItemType: 'INDICATOR', + valueType: 'NUMBER', + totalAggregationType: 'AVERAGE', + }, + }, + dimensions: { + dx: ['FnYCr2EAzWS'], + pe: [ + '202308', + '202309', + '202310', + '202311', + '202312', + '202401', + '202402', + '202403', + '202404', + '202405', + '202406', + '202407', + ], + ou: ['O6uvpzGd5pu'], + co: [], + }, + }, +} + +export const layout = { + name: 'BCG coverage last 12 months - Bo', + created: '2013-10-16T19:50:52.464', + lastUpdated: '2021-07-06T12:53:57.296', + translations: [], + favorites: [], + lastUpdatedBy: { + id: 'xE7jOejl9FI', + code: null, + name: 'John Traore', + displayName: 'John Traore', + username: 'admin', + }, + regressionType: 'NONE', + displayDensity: 'NORMAL', + fontSize: 'NORMAL', + sortOrder: 0, + topLimit: 0, + hideEmptyRows: false, + showHierarchy: false, + completedOnly: false, + skipRounding: false, + dataDimensionItems: [ + { + indicator: { + name: 'BCG Coverage <1y', + dimensionItemType: 'INDICATOR', + displayName: 'BCG Coverage <1y', + access: { + manage: true, + externalize: true, + write: true, + read: true, + update: true, + delete: true, + }, + displayShortName: 'BCG Coverage <1y', + id: 'FnYCr2EAzWS', + }, + dataDimensionItemType: 'INDICATOR', + }, + ], + subscribers: [], + aggregationType: 'DEFAULT', + digitGroupSeparator: 'SPACE', + hideEmptyRowItems: 'NONE', + noSpaceBetweenColumns: false, + cumulativeValues: false, + percentStackedValues: false, + showData: true, + colTotals: false, + rowTotals: false, + rowSubTotals: false, + colSubTotals: false, + hideTitle: false, + hideSubtitle: false, + showDimensionLabels: false, + interpretations: [], + type: 'SINGLE_VALUE', + reportingParams: { + grandParentOrganisationUnit: false, + parentOrganisationUnit: false, + organisationUnit: false, + reportingPeriod: false, + }, + numberType: 'VALUE', + fontStyle: {}, + colorSet: 'DEFAULT', + yearlySeries: [], + regression: false, + hideEmptyColumns: false, + fixColumnHeaders: false, + fixRowHeaders: false, + filters: [ + { + items: [ + { + name: 'Bo', + dimensionItemType: 'ORGANISATION_UNIT', + displayShortName: 'Bo', + displayName: 'Bo', + access: { + manage: true, + externalize: true, + write: true, + read: true, + update: true, + delete: true, + }, + id: 'O6uvpzGd5pu', + }, + ], + dimension: 'ou', + }, + { + items: [ + { + name: 'LAST_12_MONTHS', + dimensionItemType: 'PERIOD', + displayShortName: 'LAST_12_MONTHS', + displayName: 'LAST_12_MONTHS', + access: { + manage: true, + externalize: true, + write: true, + read: true, + update: true, + delete: true, + }, + id: 'LAST_12_MONTHS', + }, + ], + dimension: 'pe', + }, + ], + parentGraphMap: { + O6uvpzGd5pu: 'ImspTQPwCqd', + }, + columns: [ + { + items: [ + { + name: 'BCG Coverage <1y', + dimensionItemType: 'INDICATOR', + displayName: 'BCG Coverage <1y', + access: { + manage: true, + externalize: true, + write: true, + read: true, + update: true, + delete: true, + }, + displayShortName: 'BCG Coverage <1y', + id: 'FnYCr2EAzWS', + }, + ], + dimension: 'dx', + }, + ], + rows: [], + subscribed: false, + displayName: 'BCG coverage last 12 months - Bo', + access: { + manage: true, + externalize: true, + write: true, + read: true, + update: true, + delete: true, + }, + favorite: false, + user: { + id: 'xE7jOejl9FI', + code: null, + name: 'John Traore', + displayName: 'John Traore', + username: 'admin', + }, + href: 'http://localhost:8080/api/41/visualizations/mYMnDl5Z9oD', + id: 'mYMnDl5Z9oD', + legend: { + showKey: false, + }, + sorting: [], + series: [], + icons: [], + seriesKey: { + hidden: false, + }, + axes: [], +} +export const baseExtraOptions = { + dashboard: true, + animation: 200, + legendSets: [], + icon: '', +} diff --git a/src/__fixtures__/SingleValue/abcWXyv0zpa.js b/src/__fixtures__/SingleValue/abcWXyv0zpa.js new file mode 100644 index 000000000..c473b5efc --- /dev/null +++ b/src/__fixtures__/SingleValue/abcWXyv0zpa.js @@ -0,0 +1,414 @@ +export const baseDataObj = { + response: { + headers: [ + { + name: 'dx', + column: 'Data', + valueType: 'TEXT', + type: 'java.lang.String', + hidden: false, + meta: true, + }, + { + name: 'value', + column: 'Value', + valueType: 'NUMBER', + type: 'java.lang.Double', + hidden: false, + meta: false, + }, + ], + metaData: { + items: { + 2024: { + uid: '2024', + code: '2024', + name: '2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-01-01T00:00:00.000', + endDate: '2024-12-31T00:00:00.000', + }, + dx: { + uid: 'dx', + name: 'Data', + dimensionType: 'DATA_X', + }, + pe: { + uid: 'pe', + name: 'Period', + dimensionType: 'PERIOD', + }, + ou: { + uid: 'ou', + name: 'Organisation unit', + dimensionType: 'ORGANISATION_UNIT', + }, + THIS_YEAR: { + name: 'This year', + }, + abcWXyv0zpa: { + uid: 'abcWXyv0zpa', + name: 'Penta3 coverage under 1', + dimensionItemType: 'INDICATOR', + valueType: 'NUMBER', + totalAggregationType: 'AVERAGE', + indicatorType: { + name: 'Percentage', + displayName: 'Percentage', + factor: 100, + number: false, + }, + }, + E4h5WBOg71F: { + uid: 'E4h5WBOg71F', + code: 'GHA', + name: 'Ghana', + dimensionItemType: 'ORGANISATION_UNIT', + valueType: 'TEXT', + totalAggregationType: 'SUM', + }, + }, + dimensions: { + dx: ['abcWXyv0zpa'], + pe: ['2024'], + ou: ['E4h5WBOg71F'], + co: [], + }, + }, + rowContext: {}, + rows: [['abcWXyv0zpa', '79.41']], + width: 2, + height: 1, + headerWidth: 2, + }, + headers: [ + { + name: 'dx', + column: 'Data', + valueType: 'TEXT', + type: 'java.lang.String', + hidden: false, + meta: true, + isPrefix: false, + isCollect: false, + index: 0, + }, + { + name: 'value', + column: 'Value', + valueType: 'NUMBER', + type: 'java.lang.Double', + hidden: false, + meta: false, + isPrefix: false, + isCollect: false, + index: 1, + }, + ], + rows: [['abcWXyv0zpa', '79.41']], + metaData: { + items: { + 2024: { + uid: '2024', + code: '2024', + name: '2024', + dimensionItemType: 'PERIOD', + valueType: 'TEXT', + totalAggregationType: 'SUM', + startDate: '2024-01-01T00:00:00.000', + endDate: '2024-12-31T00:00:00.000', + }, + dx: { + uid: 'dx', + name: 'Data', + dimensionType: 'DATA_X', + }, + pe: { + uid: 'pe', + name: 'Period', + dimensionType: 'PERIOD', + }, + ou: { + uid: 'ou', + name: 'Organisation unit', + dimensionType: 'ORGANISATION_UNIT', + }, + THIS_YEAR: { + name: 'This year', + }, + abcWXyv0zpa: { + uid: 'abcWXyv0zpa', + name: 'Penta3 coverage under 1', + dimensionItemType: 'INDICATOR', + valueType: 'NUMBER', + totalAggregationType: 'AVERAGE', + indicatorType: { + name: 'Percentage', + displayName: 'Percentage', + factor: 100, + number: false, + }, + }, + E4h5WBOg71F: { + uid: 'E4h5WBOg71F', + code: 'GHA', + name: 'Ghana', + dimensionItemType: 'ORGANISATION_UNIT', + valueType: 'TEXT', + totalAggregationType: 'SUM', + }, + }, + dimensions: { + dx: ['abcWXyv0zpa'], + pe: ['2024'], + ou: ['E4h5WBOg71F'], + co: [], + }, + }, +} +export const layout = { + name: 'RMNCA-N08: Immunisation Coverage (Penta3)', + created: '2024-10-15T09:32:31.113', + lastUpdated: '2024-11-11T23:49:50.939', + translations: [], + favorites: [], + lastUpdatedBy: { + id: 'ihTi0mMcuzs', + code: null, + name: 'Oswald Dachaga', + displayName: 'Oswald Dachaga', + username: 'Oswald', + }, + regressionType: 'NONE', + displayDensity: 'NORMAL', + fontSize: 'NORMAL', + sortOrder: 1, + topLimit: 0, + hideEmptyRows: false, + showHierarchy: false, + completedOnly: false, + skipRounding: false, + dataDimensionItems: [ + { + indicator: { + name: 'Penta3 coverage under 1', + dimensionItemType: 'INDICATOR', + displayName: 'Penta3 coverage under 1', + access: { + manage: true, + externalize: true, + write: true, + read: true, + update: true, + delete: true, + }, + displayShortName: 'Penta3 coverage under 1', + id: 'abcWXyv0zpa', + }, + dataDimensionItemType: 'INDICATOR', + }, + ], + subscribers: [], + aggregationType: 'DEFAULT', + digitGroupSeparator: 'SPACE', + hideEmptyRowItems: 'NONE', + noSpaceBetweenColumns: false, + cumulativeValues: false, + percentStackedValues: false, + showData: true, + colTotals: false, + rowTotals: false, + rowSubTotals: false, + colSubTotals: false, + hideTitle: false, + hideSubtitle: false, + showDimensionLabels: false, + interpretations: [], + type: 'SINGLE_VALUE', + reportingParams: { + grandParentOrganisationUnit: false, + parentOrganisationUnit: false, + organisationUnit: false, + reportingPeriod: false, + }, + numberType: 'VALUE', + fontStyle: { + visualizationTitle: { + bold: true, + textColor: '#104b9e', + }, + visualizationSubtitle: { + fontSize: 18, + }, + }, + colorSet: 'GRAY', + yearlySeries: [], + regression: false, + hideEmptyColumns: false, + fixColumnHeaders: false, + fixRowHeaders: false, + rows: [], + subscribed: false, + parentGraphMap: { + E4h5WBOg71F: '', + }, + columns: [ + { + items: [ + { + name: 'Penta3 coverage under 1', + dimensionItemType: 'INDICATOR', + displayName: 'Penta3 coverage under 1', + access: { + manage: true, + externalize: true, + write: true, + read: true, + update: true, + delete: true, + }, + displayShortName: 'Penta3 coverage under 1', + id: 'abcWXyv0zpa', + }, + ], + dimension: 'dx', + }, + ], + filters: [ + { + items: [ + { + name: 'THIS_YEAR', + dimensionItemType: 'PERIOD', + displayShortName: 'THIS_YEAR', + displayName: 'THIS_YEAR', + access: { + manage: true, + externalize: true, + write: true, + read: true, + update: true, + delete: true, + }, + id: 'THIS_YEAR', + }, + ], + dimension: 'pe', + }, + { + items: [ + { + name: 'Ghana', + dimensionItemType: 'ORGANISATION_UNIT', + displayShortName: 'Ghana', + displayName: 'Ghana', + access: { + manage: true, + externalize: true, + write: true, + read: true, + update: true, + delete: true, + }, + id: 'E4h5WBOg71F', + }, + ], + dimension: 'ou', + }, + ], + user: { + id: 'ihTi0mMcuzs', + code: null, + name: 'Oswald Dachaga', + displayName: 'Oswald Dachaga', + username: 'Oswald', + }, + displayName: 'RMNCA-N08: Immunisation Coverage (Penta3)', + access: { + manage: true, + externalize: true, + write: true, + read: true, + update: true, + delete: true, + }, + favorite: false, + href: 'https://dhims.chimgh.org/dhims/api/41/visualizations/IziyerFnAdR', + id: 'IziyerFnAdR', + legend: { + showKey: false, + style: 'FILL', + set: { + name: 'Performance(+)', + displayName: 'Performance(+)', + id: 'j6zU70en9cL', + }, + strategy: 'FIXED', + }, + sorting: [], + series: [ + { + dimensionItem: 'THIS_YEAR', + axis: 0, + }, + { + dimensionItem: 'LAST_YEAR', + axis: 0, + }, + ], + icons: [], + seriesKey: { + hidden: false, + }, + axes: [], +} + +export const baseExtraOptions = { + dashboard: false, + animation: 200, + legendSets: [ + { + legends: [ + { + startValue: 80, + endValue: 100, + color: '#04341D', + id: 'btuo5dWE5ER', + name: '80 - 100', + }, + { + startValue: 40, + endValue: 60, + color: '#F6F305', + id: 'AsDexAV4M1N', + name: '40 - 60', + }, + { + startValue: 60, + endValue: 80, + color: '#06E84B', + id: 'BqHdGR4YNNq', + name: '60 - 80', + }, + { + startValue: 20, + endValue: 40, + color: '#F67E04', + id: 'vVOTL88A673', + name: '20 - 40', + }, + { + startValue: 0, + endValue: 20, + color: '#F80409', + id: 'Wt3Qw5tto0h', + name: '0 - 20', + }, + ], + id: 'j6zU70en9cL', + name: 'Performance(+)', + }, + ], +} diff --git a/src/__fixtures__/SingleValue/index.js b/src/__fixtures__/SingleValue/index.js new file mode 100644 index 000000000..dbe3a4658 --- /dev/null +++ b/src/__fixtures__/SingleValue/index.js @@ -0,0 +1,4 @@ +import * as abcWXyv0zpa from './abcWXyv0zpa.js' +import * as FnYCr2EAzWS from './FnYCr2EAzWS.js' + +export default { abcWXyv0zpa, FnYCr2EAzWS }