Show Custom Region Label on World jVectorMapjVectorMap - How to show region label and not only select region with external linkHow to locate/show the map continent wise in jvectormapjvectormap Show label and hand cursor on specific regionsJquery UI autocomplete show all data in input type textJvector Map how to display database value?how to change customize label function?JVectorMap - change region labelHow to get full name of key field(country name) in HTML Angular JS?Fetch MyQL Data into the Jvector Map Using JSONJvector Map JS ERROR : Uncaught TypeError: Cannot use 'in' operator to search for 'length'

Was Apollo 13 radio blackout on reentry longer than expected?

Random piece of plastic

What are the first usages of "thong" as a wearable item of clothing, both on the feet and on the waist?

Coverting list of string into integers and reshaping the original list

Why doesn't philosophy have higher standards for its arguments?

Migrating Configuration - 3750G to 3750X

What is the meaning of [[:space:]] in bash?

Why did Steve Rogers choose this character in Endgame?

How to color a tag in a math equation?

Building a Shader Switch | How to get custom values from individual objects?

How to honestly answer questions from a girlfriend like "How did you find this place" without giving the impression I'm always talking about my exes?

What impact would a dragon the size of Asia have on the environment?

How to remove the first colon ':' from a timestamp?

Is it legal for a supermarket to refuse to sell an adult beer if an adult with them doesn’t have their ID?

What details should I consider before agreeing for part of my salary to be 'retained' by employer?

Is it okay for a chapter's POV to shift as it progresses?

ROT13 encoder/decoder

What is the word for "event executor"?

Raising muscle power without increasing volume

How could a medieval fortress manage large groups of migrants and travelers?

Paradox in the definition of the electric field

Cauchy reals and Dedekind reals satisfy "the same mathematical theorems"

Get node ID or URL in Twig on field level

Where are the rest of the Dwarves of Nidavellir?



Show Custom Region Label on World jVectorMap


jVectorMap - How to show region label and not only select region with external linkHow to locate/show the map continent wise in jvectormapjvectormap Show label and hand cursor on specific regionsJquery UI autocomplete show all data in input type textJvector Map how to display database value?how to change customize label function?JVectorMap - change region labelHow to get full name of key field(country name) in HTML Angular JS?Fetch MyQL Data into the Jvector Map Using JSONJvector Map JS ERROR : Uncaught TypeError: Cannot use 'in' operator to search for 'length'






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a JSON code for A jvector Map WHich is as Follows :



[
"Country":"Australia","CountryCode":"AU","persons":"5",
"Country":"Spain","CountryCode":"ES","persons":"2",
"Country":"India","CountryCode":"IN","persons":"8",
"Country":"Mexico","CountryCode":"MX","persons":"4",
"Country":"United States","CountryCode":"US","persons":"4"
]


The JVector Map fills the colors in the countries as per the data, but the Label on it only show the Country Name. I want to Show the no. of Persons also on the Country Label :



Here is the Script That I am Using :



<script type="text/javascript">
var dataC = <?php echo $data ?>;
var countryData = ;
$.each(dataC, function()
countryData[this.CountryCode] = this.persons;
countryData[this.persons] = this.persons;
);

$(function()
$('#world-map').vectorMap(
map: 'world_mill_en',
series:
regions: [
values: countryData, //load the data
scale: ['#C8EEFF', '#0071A4'],
normalizeFunction: 'polynomial']
,
onRegionLabelShow: function(e, el, code)
//search through dataC to find the selected country by it's code
var country = $.grep(dataC.countryData, function(obj, index)
return obj.CountryCode == code;
)[0]; //snag the first one
//only if selected country was found in dataC

el.html(el.html() +
"<br/><b>Code: </b>" +country.countryCode +
"<br/><b>Percent: </b>" + country.persons +
"<br/><b>Country Name: </b>"+ country.Country);


);
);
</script>


All I want is to show the no. of persons on the Colored Label As in JSON










share|improve this question
























  • I have no knowledge of the code but isn't that what the part inside this if is doing? if (country != undefined) {

    – Andreas
    Mar 26 at 9:04











  • even if I remove the if statement it won't work.

    – Abnit Chauhan
    Mar 26 at 9:22

















0















I have a JSON code for A jvector Map WHich is as Follows :



[
"Country":"Australia","CountryCode":"AU","persons":"5",
"Country":"Spain","CountryCode":"ES","persons":"2",
"Country":"India","CountryCode":"IN","persons":"8",
"Country":"Mexico","CountryCode":"MX","persons":"4",
"Country":"United States","CountryCode":"US","persons":"4"
]


The JVector Map fills the colors in the countries as per the data, but the Label on it only show the Country Name. I want to Show the no. of Persons also on the Country Label :



Here is the Script That I am Using :



<script type="text/javascript">
var dataC = <?php echo $data ?>;
var countryData = ;
$.each(dataC, function()
countryData[this.CountryCode] = this.persons;
countryData[this.persons] = this.persons;
);

$(function()
$('#world-map').vectorMap(
map: 'world_mill_en',
series:
regions: [
values: countryData, //load the data
scale: ['#C8EEFF', '#0071A4'],
normalizeFunction: 'polynomial']
,
onRegionLabelShow: function(e, el, code)
//search through dataC to find the selected country by it's code
var country = $.grep(dataC.countryData, function(obj, index)
return obj.CountryCode == code;
)[0]; //snag the first one
//only if selected country was found in dataC

el.html(el.html() +
"<br/><b>Code: </b>" +country.countryCode +
"<br/><b>Percent: </b>" + country.persons +
"<br/><b>Country Name: </b>"+ country.Country);


);
);
</script>


All I want is to show the no. of persons on the Colored Label As in JSON










share|improve this question
























  • I have no knowledge of the code but isn't that what the part inside this if is doing? if (country != undefined) {

    – Andreas
    Mar 26 at 9:04











  • even if I remove the if statement it won't work.

    – Abnit Chauhan
    Mar 26 at 9:22













0












0








0








I have a JSON code for A jvector Map WHich is as Follows :



[
"Country":"Australia","CountryCode":"AU","persons":"5",
"Country":"Spain","CountryCode":"ES","persons":"2",
"Country":"India","CountryCode":"IN","persons":"8",
"Country":"Mexico","CountryCode":"MX","persons":"4",
"Country":"United States","CountryCode":"US","persons":"4"
]


The JVector Map fills the colors in the countries as per the data, but the Label on it only show the Country Name. I want to Show the no. of Persons also on the Country Label :



Here is the Script That I am Using :



<script type="text/javascript">
var dataC = <?php echo $data ?>;
var countryData = ;
$.each(dataC, function()
countryData[this.CountryCode] = this.persons;
countryData[this.persons] = this.persons;
);

$(function()
$('#world-map').vectorMap(
map: 'world_mill_en',
series:
regions: [
values: countryData, //load the data
scale: ['#C8EEFF', '#0071A4'],
normalizeFunction: 'polynomial']
,
onRegionLabelShow: function(e, el, code)
//search through dataC to find the selected country by it's code
var country = $.grep(dataC.countryData, function(obj, index)
return obj.CountryCode == code;
)[0]; //snag the first one
//only if selected country was found in dataC

el.html(el.html() +
"<br/><b>Code: </b>" +country.countryCode +
"<br/><b>Percent: </b>" + country.persons +
"<br/><b>Country Name: </b>"+ country.Country);


);
);
</script>


All I want is to show the no. of persons on the Colored Label As in JSON










share|improve this question
















I have a JSON code for A jvector Map WHich is as Follows :



[
"Country":"Australia","CountryCode":"AU","persons":"5",
"Country":"Spain","CountryCode":"ES","persons":"2",
"Country":"India","CountryCode":"IN","persons":"8",
"Country":"Mexico","CountryCode":"MX","persons":"4",
"Country":"United States","CountryCode":"US","persons":"4"
]


The JVector Map fills the colors in the countries as per the data, but the Label on it only show the Country Name. I want to Show the no. of Persons also on the Country Label :



Here is the Script That I am Using :



<script type="text/javascript">
var dataC = <?php echo $data ?>;
var countryData = ;
$.each(dataC, function()
countryData[this.CountryCode] = this.persons;
countryData[this.persons] = this.persons;
);

$(function()
$('#world-map').vectorMap(
map: 'world_mill_en',
series:
regions: [
values: countryData, //load the data
scale: ['#C8EEFF', '#0071A4'],
normalizeFunction: 'polynomial']
,
onRegionLabelShow: function(e, el, code)
//search through dataC to find the selected country by it's code
var country = $.grep(dataC.countryData, function(obj, index)
return obj.CountryCode == code;
)[0]; //snag the first one
//only if selected country was found in dataC

el.html(el.html() +
"<br/><b>Code: </b>" +country.countryCode +
"<br/><b>Percent: </b>" + country.persons +
"<br/><b>Country Name: </b>"+ country.Country);


);
);
</script>


All I want is to show the no. of persons on the Colored Label As in JSON







php json jvectormap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 9:25







Abnit Chauhan

















asked Mar 26 at 8:56









Abnit ChauhanAbnit Chauhan

4211 bronze badges




4211 bronze badges












  • I have no knowledge of the code but isn't that what the part inside this if is doing? if (country != undefined) {

    – Andreas
    Mar 26 at 9:04











  • even if I remove the if statement it won't work.

    – Abnit Chauhan
    Mar 26 at 9:22

















  • I have no knowledge of the code but isn't that what the part inside this if is doing? if (country != undefined) {

    – Andreas
    Mar 26 at 9:04











  • even if I remove the if statement it won't work.

    – Abnit Chauhan
    Mar 26 at 9:22
















I have no knowledge of the code but isn't that what the part inside this if is doing? if (country != undefined) {

– Andreas
Mar 26 at 9:04





I have no knowledge of the code but isn't that what the part inside this if is doing? if (country != undefined) {

– Andreas
Mar 26 at 9:04













even if I remove the if statement it won't work.

– Abnit Chauhan
Mar 26 at 9:22





even if I remove the if statement it won't work.

– Abnit Chauhan
Mar 26 at 9:22












1 Answer
1






active

oldest

votes


















1














I am using this piece of code to display custom info:



onRegionTipShow: function(e, label, code)
//hovering disabled for disabled regions
if ( isCountryDisabled(code) )

e.preventDefault();
label.html( '<b>'+label.html()+' - test</b>');
return false;

var country = getCountryDetails(code);
if(country === undefined)
label.html( '<b>'+label.html()+'</b>');
else
label.html( '<b>'+label.html()+' - '+country.en+'</b>');




You can see that I have some function to check whether the country should display the custom label or not.I also have a function to get the details for country.



Basically you are calling onRegionLabelShow, I am using onRegionTipShow. But both should work. Probably you are passing some wrong data and there might be error. Try to create the label only with HTML (no variables), to see if you are able to modify it, once you are you can start playing with variables.






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55353120%2fshow-custom-region-label-on-world-jvectormap%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    I am using this piece of code to display custom info:



    onRegionTipShow: function(e, label, code)
    //hovering disabled for disabled regions
    if ( isCountryDisabled(code) )

    e.preventDefault();
    label.html( '<b>'+label.html()+' - test</b>');
    return false;

    var country = getCountryDetails(code);
    if(country === undefined)
    label.html( '<b>'+label.html()+'</b>');
    else
    label.html( '<b>'+label.html()+' - '+country.en+'</b>');




    You can see that I have some function to check whether the country should display the custom label or not.I also have a function to get the details for country.



    Basically you are calling onRegionLabelShow, I am using onRegionTipShow. But both should work. Probably you are passing some wrong data and there might be error. Try to create the label only with HTML (no variables), to see if you are able to modify it, once you are you can start playing with variables.






    share|improve this answer



























      1














      I am using this piece of code to display custom info:



      onRegionTipShow: function(e, label, code)
      //hovering disabled for disabled regions
      if ( isCountryDisabled(code) )

      e.preventDefault();
      label.html( '<b>'+label.html()+' - test</b>');
      return false;

      var country = getCountryDetails(code);
      if(country === undefined)
      label.html( '<b>'+label.html()+'</b>');
      else
      label.html( '<b>'+label.html()+' - '+country.en+'</b>');




      You can see that I have some function to check whether the country should display the custom label or not.I also have a function to get the details for country.



      Basically you are calling onRegionLabelShow, I am using onRegionTipShow. But both should work. Probably you are passing some wrong data and there might be error. Try to create the label only with HTML (no variables), to see if you are able to modify it, once you are you can start playing with variables.






      share|improve this answer

























        1












        1








        1







        I am using this piece of code to display custom info:



        onRegionTipShow: function(e, label, code)
        //hovering disabled for disabled regions
        if ( isCountryDisabled(code) )

        e.preventDefault();
        label.html( '<b>'+label.html()+' - test</b>');
        return false;

        var country = getCountryDetails(code);
        if(country === undefined)
        label.html( '<b>'+label.html()+'</b>');
        else
        label.html( '<b>'+label.html()+' - '+country.en+'</b>');




        You can see that I have some function to check whether the country should display the custom label or not.I also have a function to get the details for country.



        Basically you are calling onRegionLabelShow, I am using onRegionTipShow. But both should work. Probably you are passing some wrong data and there might be error. Try to create the label only with HTML (no variables), to see if you are able to modify it, once you are you can start playing with variables.






        share|improve this answer













        I am using this piece of code to display custom info:



        onRegionTipShow: function(e, label, code)
        //hovering disabled for disabled regions
        if ( isCountryDisabled(code) )

        e.preventDefault();
        label.html( '<b>'+label.html()+' - test</b>');
        return false;

        var country = getCountryDetails(code);
        if(country === undefined)
        label.html( '<b>'+label.html()+'</b>');
        else
        label.html( '<b>'+label.html()+' - '+country.en+'</b>');




        You can see that I have some function to check whether the country should display the custom label or not.I also have a function to get the details for country.



        Basically you are calling onRegionLabelShow, I am using onRegionTipShow. But both should work. Probably you are passing some wrong data and there might be error. Try to create the label only with HTML (no variables), to see if you are able to modify it, once you are you can start playing with variables.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 6 at 15:17









        Dominik FranekDominik Franek

        1011 silver badge4 bronze badges




        1011 silver badge4 bronze badges


















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55353120%2fshow-custom-region-label-on-world-jvectormap%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해