0

我想更改任何图表气泡图数据。当我更改气泡数据集时,添加新气泡。但不删除地图中的旧气泡。如何将新的气泡数据集设置到地图。这是我的代码示例。我想用旧气泡替换新气泡数据。

/*-------------------------------------------------------*/
        var dataSet = anychart.data.set([
            {
                name: "Colombo",
                lat: 6.7768798,
                long: 79.9562153,
                'size': 10,
                desc: "We can even have VERY GOOD waves but the main problem is the very low frequency...."
            },
            {
                name: "Kandy",
                lat: 7.302461,
                long: 80.6409725,
                'size': 4,
                desc: "Kandy Sales Updated."
            }
            
        ]);
    var dataSet2 = anychart.data.set([
        {
            name: "devndara",
            lat: 8.277899131156953,
            long: 80.57335996768477,
            "size": 10,
            desc: "New Location Added"
        }
    ]);
/*------------------------------------------------------------------*/
 

function changebbl() {
    map.bubble(dataSet2);

}
<div id="lkmapcontainer"></div>

4

1 回答 1

0

有几种方法可以做到这一点,这里显示了一种:https ://jsfiddle.net/prypezsk/

// create a data set    
var dataSet = anychart.data.set([
{'id': 'AU.NT', 'value': 15, 'size': 4},
]);

// prepare replacement data
var newData = [
{'id': 'AU.SA', 'value': 21, 'size': 15},
{'id': 'AU.VI', 'value': 5, 'size': 3},
{'id': 'AU.TS', 'value': 9, 'size': 1},
{'id': 'AU.WA', 'value': 23, 'size': 9},
];

// when needed - replace data in the data set
function changebbl() {
    dataSet.data(newData);
}
于 2017-08-26T06:11:10.683 回答