Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/wp-react-blocks-plugin/blocks/map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A Gutenberg block that renders an interactive choropleth/symbol map by embedding
| `csv` | `String` | `""` | Inline CSV data used when `app` is `"csv"`. |
| `dimension1` | `String` | `"zone"` | Primary geographic dimension field. |
| `dimension2` | `String` | `"gender"` | Secondary dimension field (e.g. for disaggregation). |
| `measures` | `Array` | `["prevalenceSmokeAny"]` | Measure fields to visualise on the map. |
| `measures` | `Array` | `[]` | Measure fields to visualise on the map. Must be configured; no measure is pre-selected by default. |
| `filters` | `Array` | `[]` | Active filter values passed as query params to the data API. |
| `mapFile` | `String` | `""` | Path (relative to the UI app) to the TopoJSON map file. |
| `mapCenter` | `String` | `"NGA"` | Country/region key that determines the initial map centre and zoom scale (e.g. `"NGA"`, `"KEN"`, `"Africa"`). |
Expand Down
80 changes: 40 additions & 40 deletions plugins/wp-react-blocks-plugin/blocks/map/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {__} from '@wordpress/i18n';
import {registerBlockType} from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';
import { registerBlockType } from '@wordpress/blocks';
import BlockSave from "./BlockSave";
import BlockEdit from "./BlockEdit";
import {GenericIcon, BLOCKS_NS, BLOCKS_CATEGORY} from '@devgateway/dvz-wp-commons';
import { GenericIcon, BLOCKS_NS, BLOCKS_CATEGORY } from '@devgateway/dvz-wp-commons';

registerBlockType(BLOCKS_NS+'/map',
registerBlockType(BLOCKS_NS + '/map',
{
title: __('Data Map'),
icon: GenericIcon,
Expand All @@ -21,7 +21,7 @@ registerBlockType(BLOCKS_NS+'/map',
},
dataSourceText: {
type: 'String',
default: "NIDS"
default: "Source"
},
source: {
type: 'string',
Expand All @@ -41,7 +41,7 @@ registerBlockType(BLOCKS_NS+'/map',
},
measures: {
type: "Array",
default: ["prevalenceSmokeAny"]
default: []
},
Comment on lines 42 to 45
filters: {
type: "Array",
Expand All @@ -54,30 +54,30 @@ registerBlockType(BLOCKS_NS+'/map',
},
nationalAverageLabel: {
type: "String",
default: "National Prevalence Avg"
default: "National Avg"
},
legendTitle: {
type: "String",
default: "Tobacco Prevalence Rate"
default: "Rate"
},
types: {
type: "Array",
default: [{label: 'Map', value: 'map', supports: {singleMeasure: false, singleDimension: false}}]
default: [{ label: 'Map', value: 'map', supports: { singleMeasure: false, singleDimension: false } }]
},
showLegendLabels:{
type:'Boolean',
showLegendLabels: {
type: 'Boolean',
default: false
},
legendBreaks: {
type: "Array",
default: [{ min: 0, max: 2.99, color: '#66A3D9', label: '', filters: []}, { min: 3, max: 4.99, color: '#BC91D9', label: '', filters: []}, { min: 5, color: '#F26363', label: '', filters: []}]
default: [{ min: 0, max: 2.99, color: '#66A3D9', label: '', filters: [] }, { min: 3, max: 4.99, color: '#BC91D9', label: '', filters: [] }, { min: 5, color: '#F26363', label: '', filters: [] }]
},
showNoDataLegendItem: {
type:'Boolean',
type: 'Boolean',
default: false
},
zoomEnabled:{
type:'Boolean',
zoomEnabled: {
type: 'Boolean',
default: false
},
mapFile: {
Expand All @@ -86,7 +86,7 @@ registerBlockType(BLOCKS_NS+'/map',
},
enabledLayers: {
type: "Array",
default:[]
default: []
},
mainLayerId: {
type: "String",
Expand All @@ -101,38 +101,38 @@ registerBlockType(BLOCKS_NS+'/map',
default: "zone"
},
hasMultipleMeasures: {
type:'Boolean',
type: 'Boolean',
default: false
},
mapCenter:{
mapCenter: {
type: "String",
default: "NGA"
},
mapLabelShowValue:{
type:'Boolean',
mapLabelShowValue: {
type: 'Boolean',
default: false
},
showTooltip:{
type:'Boolean',
showTooltip: {
type: 'Boolean',
default: true
},
measureSelectorLabel: {
type: "String",
default: ""
},
valueFormat:{
valueFormat: {
type: "String",
default: "%({value},2)"
},
showOverallValue:{
type:'Boolean',
showOverallValue: {
type: 'Boolean',
default: false
},
autoGenerateBreaks: {
type:'Boolean',
type: 'Boolean',
default: false
},
numberOfBreaks:{
numberOfBreaks: {
type: 'Numeric',
default: 5
},
Expand All @@ -141,14 +141,14 @@ registerBlockType(BLOCKS_NS+'/map',
default: 'reds'
},
showNoDataLabel: {
type:'Boolean',
type: 'Boolean',
default: false
},
group: {
type: 'String',
default: 'default',
},
mapSymbols:{
mapSymbols: {
type: 'Array',
default: []
},
Expand All @@ -168,11 +168,11 @@ registerBlockType(BLOCKS_NS+'/map',
type: 'String',
default: 'normal',
},
legendFontSize:{
legendFontSize: {
type: 'Numeric',
default: 12,
},
legendFontWeight:{
legendFontWeight: {
type: 'String',
default: 'normal',
},
Expand All @@ -192,7 +192,7 @@ registerBlockType(BLOCKS_NS+'/map',
type: "String",
default: "USD"
},
tooltipFontSize:{
tooltipFontSize: {
type: 'Numeric',
default: 14,
},
Expand All @@ -216,20 +216,20 @@ registerBlockType(BLOCKS_NS+'/map',
type: 'String',
default: encodeURIComponent("#000"),
},
highlightedLocation:{
highlightedLocation: {
type: "String",
default: ""
},
highlightedLocLabelFormat:{
highlightedLocLabelFormat: {
type: "String",
default: "{locationName} - Score: #({value},2)"
},
tooltipFormat:{
tooltipFormat: {
type: "String",
default: "{locationName} %({value},2) \n {label}: %({value},2)"
},
showNoDataTooltip: {
type:'Boolean',
type: 'Boolean',
default: false
},
mapContainerBgColor: {
Expand All @@ -256,7 +256,7 @@ registerBlockType(BLOCKS_NS+'/map',
type: "Object",
default: {}
},
pointLabelFormat:{
pointLabelFormat: {
type: "String",
default: "%({value},2)"
},
Expand All @@ -273,19 +273,19 @@ registerBlockType(BLOCKS_NS+'/map',
default: ""
},
enableSummaryView: {
type:'Boolean',
type: 'Boolean',
default: false
},
aggregationFormula: {
type: 'String',
default: "COUNT"
},
zoomLevelToShowPoints:{
zoomLevelToShowPoints: {
type: "Numeric",
default: 2
},
zoomOnFilter: {
type:'Boolean',
type: 'Boolean',
default: false
},
zoomOnFilterField: {
Expand Down
Loading