Skip to content

Commit

Permalink
Fix schema issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafasaifee42 committed Nov 13, 2024
1 parent 39c6acb commit 0667f2b
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 157 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@undp-data/undp-visualization-library",
"version": "0.1.60",
"version": "0.1.61",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"browser": "./dist/index.umd.js",
Expand Down
204 changes: 51 additions & 153 deletions src/Schemas.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { GraphList } from './Utils/getGraphList';

export const treeMapDataSchema = {
type: 'array',
items: {
Expand Down Expand Up @@ -5214,6 +5216,44 @@ export const SettingsSchema = {
minItems: 2,
type: 'array',
},
sortNodes: {
type: 'string',
enum: ['asc', 'desc', 'mostReadable', 'none'],
},
nodePadding: { type: 'number' },
nodeWidth: { type: 'number' },
defaultLinkOpacity: { type: 'number', minimum: 0, maximum: 1 },
animateLinks: {
oneOf: [{ type: 'number' }, { type: 'boolean' }],
},
sourceColors: {
oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
},
targetColors: {
oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
},
sourceColorDomain: {
type: 'array',
items: { oneOf: [{ type: 'string' }, { type: 'number' }] },
},
targetColorDomain: {
type: 'array',
items: { oneOf: [{ type: 'string' }, { type: 'number' }] },
},
sourceTitle: { type: 'string' },
targetTitle: { type: 'string' },
highlightedSourceDataPoints: {
type: 'array',
items: {
oneOf: [{ type: 'string' }, { type: 'number' }],
},
},
highlightedTargetDataPoints: {
type: 'array',
items: {
oneOf: [{ type: 'string' }, { type: 'number' }],
},
},
},
type: 'object',
};
Expand Down Expand Up @@ -5284,53 +5324,7 @@ export const singleGraphJSONSchema = {
},
graphType: {
type: 'string',
enum: [
'horizontalBarChart',
'horizontalStackedBarChart',
'horizontalGroupedBarChart',
'verticalBarChart',
'verticalStackedBarChart',
'verticalGroupedBarChart',
'lineChart',
'dualAxisLineChart',
'multiLineChart',
'stackedAreaChart',
'choroplethMap',
'biVariateChoroplethMap',
'dotDensityMap',
'donutChart',
'slopeChart',
'scatterPlot',
'horizontalDumbbellChart',
'verticalDumbbellChart',
'treeMap',
'circlePacking',
'heatMap',
'horizontalStripChart',
'verticalStripChart',
'horizontalBeeSwarmChart',
'verticalBeeSwarmChart',
'butterflyChart',
'histogram',
'sparkLine',
'paretoChart',
'dataTable',
'statCard',
'unitChart',
'animatedScatterPlot',
'animatedHorizontalBarChart',
'animatedHorizontalStackedBarChart',
'animatedHorizontalGroupedBarChart',
'animatedVerticalBarChart',
'animatedVerticalStackedBarChart',
'animatedVerticalGroupedBarChart',
'animatedChoroplethMap',
'animatedBiVariateChoroplethMap',
'animatedDotDensityMap',
'animatedHorizontalDumbbellChart',
'animatedVerticalDumbbellChart',
'animatedButterflyChart',
],
enum: GraphList.map(el => el.graphID),
},
dataTransform: {
type: 'object',
Expand Down Expand Up @@ -5454,7 +5448,9 @@ export const singleGraphForGeoHubMapJSONSchema = {
graphSettings: SettingsSchema,
graphType: {
type: 'string',
enum: ['geoHubMap', 'geoHubCompareMap', 'geoHubMapWithLayerSelection'],
enum: GraphList.filter(el => el.geoHubMapPresentation).map(
el => el.graphID,
),
},
debugMode: { type: 'boolean' },
mode: { type: 'string', enum: ['dark', 'light'] },
Expand Down Expand Up @@ -5528,53 +5524,9 @@ export const griddedGraphJSONSchema = {
},
graphType: {
type: 'string',
enum: [
'horizontalBarChart',
'horizontalStackedBarChart',
'horizontalGroupedBarChart',
'verticalBarChart',
'verticalStackedBarChart',
'verticalGroupedBarChart',
'lineChart',
'dualAxisLineChart',
'multiLineChart',
'stackedAreaChart',
'choroplethMap',
'biVariateChoroplethMap',
'dotDensityMap',
'donutChart',
'slopeChart',
'scatterPlot',
'horizontalDumbbellChart',
'verticalDumbbellChart',
'treeMap',
'circlePacking',
'heatMap',
'horizontalStripChart',
'verticalStripChart',
'horizontalBeeSwarmChart',
'verticalBeeSwarmChart',
'butterflyChart',
'histogram',
'sparkLine',
'paretoChart',
'dataTable',
'statCard',
'unitChart',
'animatedScatterPlot',
'animatedHorizontalBarChart',
'animatedHorizontalStackedBarChart',
'animatedHorizontalGroupedBarChart',
'animatedVerticalBarChart',
'animatedVerticalStackedBarChart',
'animatedVerticalGroupedBarChart',
'animatedChoroplethMap',
'animatedBiVariateChoroplethMap',
'animatedDotDensityMap',
'animatedHorizontalDumbbellChart',
'animatedVerticalDumbbellChart',
'animatedButterflyChart',
],
enum: GraphList.filter(el => el.availableInGriddedGraph !== false).map(
el => el.graphID,
),
},
dataTransform: {
type: 'object',
Expand Down Expand Up @@ -5812,56 +5764,7 @@ export const dashboardJSONSchema = {
type: 'array',
},
graphType: {
enum: [
'animatedBiVariateChoroplethMap',
'animatedButterflyChart',
'animatedChoroplethMap',
'animatedDotDensityMap',
'animatedHorizontalBarChart',
'animatedHorizontalDumbbellChart',
'animatedHorizontalGroupedBarChart',
'animatedHorizontalStackedBarChart',
'animatedScatterPlot',
'animatedVerticalBarChart',
'animatedVerticalDumbbellChart',
'animatedVerticalGroupedBarChart',
'animatedVerticalStackedBarChart',
'biVariateChoroplethMap',
'butterflyChart',
'choroplethMap',
'circlePacking',
'dataTable',
'donutChart',
'dotDensityMap',
'dualAxisLineChart',
'geoHubCompareMap',
'geoHubMap',
'geoHubMapWithLayerSelection',
'heatMap',
'histogram',
'horizontalBarChart',
'horizontalBeeSwarmChart',
'horizontalDumbbellChart',
'horizontalGroupedBarChart',
'horizontalStackedBarChart',
'horizontalStripChart',
'lineChart',
'multiLineChart',
'paretoChart',
'scatterPlot',
'slopeChart',
'sparkLine',
'stackedAreaChart',
'statCard',
'treeMap',
'unitChart',
'verticalBarChart',
'verticalBeeSwarmChart',
'verticalDumbbellChart',
'verticalGroupedBarChart',
'verticalStackedBarChart',
'verticalStripChart',
],
enum: GraphList.map(el => el.graphID),
type: 'string',
},
settings: SettingsSchema,
Expand Down Expand Up @@ -6098,14 +6001,9 @@ export const dashboardWideToLongFormatJSONSchema = {
type: 'array',
},
graphType: {
enum: [
'circlePacking',
'donutChart',
'horizontalBarChart',
'treeMap',
'unitChart',
'verticalBarChart',
],
enum: GraphList.filter(
el => el.availableInWideToLongFormat,
).map(el => el.graphID),
type: 'string',
},
settings: SettingsSchema,
Expand Down
Loading

0 comments on commit 0667f2b

Please sign in to comment.