Label changes when coloured

G'day,

when I create a map with this code:
shapeData: new ej.maps.MapAjax('./src/maps/map-data/world-map.json'),
            shapePropertyPath: 'name',
            shapeDataPath: 'name',
...
shapeSettings: {
                colorValuePath: 'value',
                colorMapping: [
                    {
                        from: 0, to: 0, color: ['gray', 'green', 'blue', 'yellow', 'red'],
                    },
                ],
            },


and use this world-map.json:

{ "type": "Feature", "properties": { "countryCode": "AF", "admin": "Afghanistan", "name": "Afghanistan",
{ "type": "Feature", "properties": { "countryCode": "AO", "admin": "Angola", "name": "Angola",
.....

and the provided dataSource looks like this:
[{"name": "China", "value": 1, "countryCode": "CN"}, {"name": "New Zealand", "value": 1, "countryCode": "NZ"}, {"name": "United States", "value": 2, "countryCode": "US"}]
I receive the below - as expected - chart:


############
If I make this change though (I substitute 'name' with countryCode):
shapeData: new ej.maps.MapAjax('./src/maps/map-data/world-map.json'),
            shapePropertyPath: 'countryCode',
            shapeDataPath: 'countryCode',


The label 'United States' gets changed to the countryCode 'US' (while all other countries not in the dataSource, e.g. Mexico in the above picture), remains unchanged and still display the full country name.

I cannot find a way that a country that is now shown in a different colour still gets displayed with full country name, e.g. United States (and _not_ 'US') and would appreciate any help!

Thank you,
Daniel




14 Replies 1 reply marked as answer

SB Swetha Babu Syncfusion Team March 16, 2021 07:29 PM UTC

Hi Daniel,

Thank you for contacting Syncfusion support.

 

When we set the shapeData and dataSource properties in the Maps component for rendering shape map and data labels are enabled, the value which matches the fields in the shapeData and the dataSource property will be visible on the map. Similarly, when we set the “countryCode” in the shapeDataPath and shapePropertyPath properties, the value that matches will be rendered. We are unable to reproduce the reported issue when we change the valuePath of dataLabelSettingsdynamically. However, we have created a simple JavaScript application to demonstrate the same and it can be downloaded from the below link.

https://www.syncfusion.com/downloads/support/forum/163539/ze/Map-171860724

In the above sample, we have rendered a world map with a button. When we click on the button, the shapeDataPath, shapePropertyPath and valuePath of dataLabelSettings will be changed. The labels are rendered fine. Please modify the above sample to reproduce the reported issue. It will be helpful for us to analyze further and assist you better. 

Regards,
Swetha Babu



DA Daniel March 17, 2021 07:35 AM UTC

Hi Swetha,

thank you very much for your response and the provided application.
I believe there is a slight misunderstanding. My reported issue is not related to  'dynamically' changing the data, but something you have confirmed - that if the match (between shapeData and dataSource) is on 'countryCode', that value will then be displayed on the map.
Is there no way to still display 'name' on the map even though 'countryCode' is used for determining which country to highlight / change color?

The problem with worldmap data is that (externally sourced) data is very inconsistent. E.g. some call it 'United States', others 'United States of America' or 'The United States of America', etc. To achieve a 100% match between such data and the used JSON worldmap, I included the countrycode as that is unambiguous. But to have that countryCode displayed on the map is not user-friendly at all.

Thank you,
Daniel


DA Daniel March 24, 2021 08:35 PM UTC

Hi Swetha,

I saw you posted a reply but then deleted it again. Would you have an update on this question?

Thank you,
Daniel


SA Sabari Anand Senthamarai Kannan Syncfusion Team March 25, 2021 02:03 PM UTC

Hi Daniel, 
 
Sorry for the inconvenience caused. 
 
We are able to reproduce the reported issue when shapeDataPath and shapePropertyPath is set with the country code and valuePath of the labels as name of the shape in the Maps. We will analyze this issue and update you with further details on March 26, 2021. 
 
Regards, 
Sabari Anand


DA Daniel March 25, 2021 04:20 PM UTC

Thank you Sabari for the confirmation.

Cheers,
Daniel


SA Sabari Anand Senthamarai Kannan Syncfusion Team March 27, 2021 06:13 AM UTC

Hi Daniel, 
 
Thank you for your patience. 
 
We have confirmed the reported issue as a defect and logged a defect report for the same. The fix for the reported issue will be included in our weekly NuGet release which is expected to be available by the start of April 2021. Please follow the below feedback link to keep track of the reported issue. 
 
 
Regards, 
Sabari Anand


DA Daniel March 27, 2021 07:40 AM UTC

Thank you Sabari,

Much appreciated. 

Cheers, 
Daniel


SA Sabari Anand Senthamarai Kannan Syncfusion Team March 29, 2021 07:00 AM UTC

Hi Daniel, 
 
Thank you for your update.  
 
Most Welcome! We will update you once the fix is included in our weekly NuGet release. 
 
Regards, 
Sabari Anand


SB Swetha Babu Syncfusion Team April 8, 2021 02:40 PM UTC

Hi Daniel,

Sorry for the inconvenience caused.

We have not included the fix for the reported issue in our weekly NuGet release due to some technical issues. However, we will include the fix in our next weekly NuGet release which is expected to be available by the mid of April 2021.

Regards,
Swetha Babu


DA Daniel April 9, 2021 06:54 AM UTC

Hi Swetha,

thanks for the update.

Cheers,
Daniel


SB Swetha Babu Syncfusion Team April 9, 2021 11:30 AM UTC

Hi Daniel,

Most Welcome! We will let you know once the fix is available in our weekly NuGet release. 

Please let us know if you need any further assistance.

Regards,
Swetha Babu


SB Swetha Babu Syncfusion Team April 16, 2021 02:34 PM UTC

Hi Daniel,

Thank you for your patience

We have included the fix for the reported issue "Label changes when colored" in our weekly patch release(v19.1.56). Please update the package to the latest version to resolve the reported issue.

Please let us know if you need any further assistance.

Regards,
Swetha Babu

Marked as answer

DA Daniel April 17, 2021 08:41 AM UTC

Fantastic - thank you Swetha,

I can confirm this fix remediated the issue.

Have a great day,

Daniel


SB Swetha Babu Syncfusion Team April 19, 2021 10:07 AM UTC

Hi Daniel, 
 
Thank you for your update. 
 
Most Welcome! Please get back to us if you need any further assistance. 
 
Regards, 
Swetha Babu

Loader.
Up arrow icon