diff --git a/package-lock.json b/package-lock.json index 6df40e8..ef14bac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vizart-geo", - "version": "2.0.1", + "version": "2.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a705857..2563aeb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vizart-geo", - "version": "2.0.1", + "version": "2.0.2", "description": "VizArt: Geo", "main": "dist/vizart-geo.js", "module": "dist/vizart-geo.esm.js", diff --git a/src/choropleth/api-color.js b/src/choropleth/api-color.js index 08df182..03dfa95 100644 --- a/src/choropleth/api-color.js +++ b/src/choropleth/api-color.js @@ -1,7 +1,21 @@ const apiColor = state => ({ color(colorOptions) { - state._options.color = colorOptions; - state._color = state._composers.color(colorOptions); + if (!colorOptions) { + console.warn('color opt is null, either scheme or type is required'); + return; + } else if (!colorOptions.type && !colorOptions.scheme) { + console.warn('invalid color opt, either scheme or type is required'); + return; + } + + if (colorOptions.type) { + state._options.color.type = colorOptions.type; + } + + if (colorOptions.scheme) { + state._options.color.scheme = colorOptions.scheme; + } + state._color = state._composers.color(state._options.color); const { _svg, _options, _c } = state; _svg