如何在Zingchart地图中通过任意x和y坐标放置形状名称

时间:2018-11-15 07:50:58

标签: javascript zingchart

伙计们! 我正在网站上使用Zingchart地图。我在放置区域名称时遇到问题。如何通过任意x和y坐标放置区域名称? enter image description here

zingchart.loadModules('maps,maps-uzb',function(e){

      zingchart.render({
        id: 'uzbchart',

        data: {
          gui : {
            contextMenu : {
             empty : true
            }
          },
          backgroundColor:'none',
          shapes: [{
            type: 'zingchart.maps',
            options: {
              name: 'uzb',
              zooming: false,
              panning: false,
              scrolling: false,
              style: {
                items:
                    mapCon, // shape data
                  tooltip: {
                      text: '%long-text',
                      alpha: 0.5,
                      backgroundColor: 'white',
                      borderColor: 'white',
                      borderRadius: 3,
                      fontColor: 'black',
                      fontFamily: 'Georgia',
                      fontSize: 12,
                      textAlpha: 1,
                      cursor: "pointer"
                    },
                    controls: {
                      visible: false
                    }
              }
            }
          }],
        },
        height: 600,
        width: "100%"
     }); 

});

1 个答案:

答案 0 :(得分:0)

我自己解决了。我在标签中添加了x和y配置参数:

zingchart.loadModules('maps, maps-uzb', function(e) {

  zingchart.render({
    id: 'uzbchart',

    data: {
      shapes: [{
        type: 'zingchart.maps',
        options: {
          //...
          style: {
            items:
                {
                   TK: {
                        //....
                        lablel: {
                                 //..........
                                 // added following two line codes
                                 x: 650,
                                 y: 280
                                }
                        //...
                      }
                   },
              //...
          }
        }
      }],
    },
    height: 600,
    width: "100%"
 }); 
 });