superset icon indicating copy to clipboard operation
superset copied to clipboard

How to add a new Country Map when using Docker?

Open klazaj opened this issue 7 years ago • 18 comments

According to the docs, a user can add a new CountryMap by putting the .geojson file in this directory: superset/assets/src/visualizations/CountryMap/countries. This directory however does not exist in this path. It's located only in node modules directory.

Is it possible to add a new country when Superset is installed with Docker? Or is building from source the only way to achieve this?

klazaj avatar Oct 22 '19 16:10 klazaj

Issue-Label Bot is automatically applying the label #question to this issue, with a confidence of 0.64. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Oct 22 '19 16:10 issue-label-bot[bot]

@klazaj You need to refer here: https://github.com/apache-superset/superset-ui-plugins/tree/master/packages/superset-ui-legacy-plugin-chart-country-map

syazshafei avatar Oct 23 '19 02:10 syazshafei

@syazwan0913 which file do I configure the key and Superchart?

klazaj avatar Oct 23 '19 10:10 klazaj

Same issue here Dont know where I should place the .geojson file inside the docker for superset or add the key and config

visakhmurukes avatar Oct 29 '19 11:10 visakhmurukes

@visakhmurukes what I did was put the CountryMap in /visualizations directory and change the path of the plugin in MainPreset.js file, so that it points to the CountryMap in visualizations directory.

klazaj avatar Oct 29 '19 12:10 klazaj

Where can I find MainPreset.js? I searched inside Superset docker using find but couldn't find the specified file.

On Tue, Oct 29, 2019 at 4:25 PM klazaj [email protected] wrote:

@visakhmurukes https://github.com/visakhmurukes what I did was put the CountryMap https://github.com/apache-superset/superset-ui-plugins/tree/master/packages/superset-ui-legacy-plugin-chart-country-map/src in /visualizations directory and change the path of the plugin in MainPreset.js file, so that it points to the CountryMap in visualizations directory.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apache/incubator-superset/issues/8429?email_source=notifications&email_token=ADMF53NHNRMAGZRQXM7MMFLQRATTFA5CNFSM4JDSFAZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECQJHPY#issuecomment-547394495, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMF53NA7JFNSYW3MNTQ7ZDQRATTFANCNFSM4JDSFAZQ .

visakhmurukes avatar Oct 30 '19 05:10 visakhmurukes

@visakhmurukes https://github.com/apache/incubator-superset/blob/master/superset/assets/src/visualizations/presets/MainPreset.js

syazshafei avatar Oct 30 '19 05:10 syazshafei

@visakhmurukes The file is under your local if you create the docker from source. it is mapped to docker volume

jackyq2015 avatar Dec 25 '19 04:12 jackyq2015

So we need to build it from source? Is there not a direct way to add map to superset running from docker?

visakhmurukes avatar Jan 28 '20 08:01 visakhmurukes

@visakhmurukes you don't need to build it from source, and yes there is a direct way (at least when I installed superset). As I mention above, move https://github.com/apache-superset/superset-ui-plugins/tree/master/packages/superset-ui-legacy-plugin-chart-country-map/src to /visualizations and do this countrymap

klazaj avatar Jan 28 '20 08:01 klazaj

I dont have Mainpreset.js. Instead I see MapChartPreset.js And it already has these lines

import CountryMapChartPlugin from '@superset-ui/legacy-plugin-chart-country-map';

export default class MapChartPreset extends Preset {
  constructor() {
    super({
      name: 'Maps',
      plugins: [
        new CountryMapChartPlugin().configure({ key: 'country_map' })
      ],
    });
  }



visakhmurukes avatar Jan 28 '20 08:01 visakhmurukes

substitute import CountryMapChartPlugin from '@superset-ui/legacy-plugin-chart-country-map'; with import CountryMapChartPlugin from '../CountryMap/CountryMapChartPlugin';

klazaj avatar Jan 28 '20 09:01 klazaj

I substituted the lines as specified and added new country geojson file to assets/src/visualizations/CountryMap/countries folder I also added new country name to explore/controls.jsx I restarted docker container as well Still the map doesnt show new country in the list

visakhmurukes avatar Jan 28 '20 11:01 visakhmurukes

That is weird, the country name at least has to show on the list, since docker updates frontend with every change you make. Is your superset in development mode?

klazaj avatar Jan 28 '20 11:01 klazaj

Yes The webserver is in development mode Do you want me to change it?

visakhmurukes avatar Jan 28 '20 11:01 visakhmurukes

@visakhmurukes no, the websever should stay in development mode in order for the frontend to be updated

klazaj avatar Jan 30 '20 11:01 klazaj

Sorry @klazaj still not much luck with this :(

visakhmurukes avatar Feb 04 '20 13:02 visakhmurukes

@visakhmurukes Hi, were able to figure it out in the end?

harshal-c avatar Oct 22 '20 13:10 harshal-c