如何更改自定义标签功能?

how to change customize label function?

现在我正在使用Jvector Map。它运作良好。当我单击国家名称时,它默认显示国家名称。现在我想自定义标签并显示标签数据库值?

脚本代码:

 <script>
jQuery.noConflict();
jQuery(function(){
  var $ = jQuery;
  $('#focus-single').click(function(){
    $('#map1').vectorMap('set', 'focus', {region: 'AU', animate: true});
  });
  $('#focus-multiple').click(function(){
    $('#map1').vectorMap('set', 'focus', {regions: ['AU', 'JP'], animate: true});
  });
  $('#focus-coords').click(function(){
    $('#map1').vectorMap('set', 'focus', {scale: 7, lat: 35, lng: 33, animate: true});
  });
  $('#focus-init').click(function(){
    $('#map1').vectorMap('set', 'focus', {scale: 1, x: 0.5, y: 0.5, animate: true});
  });
  $('#map1').vectorMap({
    map: 'world_mill_en',
    panOnDrag: true,
    focusOn: {
      x: 0.5,
      y: 0.5,
      scale: 1,
      animate: true
    },
    series: {
      regions: [{
        scale: ['#688FA0'],
        normalizeFunction: 'polynomial',
        values: {

          //  "YE":0.3,
         // "UA": 136.56,
          // "QA":0.72,
          "GB": 2258.57,
          // "GA":4.6,
          "US": 14624.18,
           //"UG":4.3,
          //"UY": 40.71,
          // "UZ":0.72,
          "VU": 0.72,
          // "VE":5.77,
         // "VN": 101.99,
          // "ZW":8.4,
         //  "ZM":2.5,

        }
      }]
    },


 onRegionClick: function (event, code) {
     var map = $('#map1').vectorMap('get', 'mapObject');
     var name = map.getRegionName(code);
    $(document ).ready(function() {
$.ajax({
    type: "GET",
    url: 'database.php',

    data: {country: name},
    dataType: "text",
    success: function(data){
      alert(data);

    }
});
    });

},
      });
    })




  </script>


Its MY script code when i click country showing name country name default i want display from database . i have created database  its connected via ajax code above code i had mentioned.

这里附上我的 php 代码:

 <?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "mydatabase";

$_country = $_GET['country'];

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$sql = "SELECT countryId,country,pdogcoregion,ccl,category FROM countrydetails WHERE country='".$_country."'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
     while($row = $result->fetch_assoc()) {
        echo "category: " . $row["category"];
    }
}
 else {
    echo "No database";
}

$conn->close();
?>

我需要更改默认显示国家/地区名称的标签。 我要设置数据库显示标签?

您可以使用 onRegionTipShow 方法自定义工具提示。看看可用的示例 here.