{"action":"created","issue":{"url":"https://api.github.com/repos/DevExpress/devextreme-angular/issues/825","repository_url":"https://api.github.com/repos/DevExpress/devextreme-angular","labels_url":"https://api.github.com/repos/DevExpress/devextreme-angular/issues/825/labels{/name}","comments_url":"https://api.github.com/repos/DevExpress/devextreme-angular/issues/825/comments","events_url":"https://api.github.com/repos/DevExpress/devextreme-angular/issues/825/events","html_url":"https://github.com/DevExpress/devextreme-angular/issues/825","id":340679351,"node_id":"MDU6SXNzdWUzNDA2NzkzNTE=","number":825,"title":"dx-vector-map SVG elements don't get refreshed when new data is loaded","user":{"login":"eranga-atugoda","id":39328959,"node_id":"MDQ6VXNlcjM5MzI4OTU5","avatar_url":"https://avatars0.githubusercontent.com/u/39328959?v=4","gravatar_id":"","url":"https://api.github.com/users/eranga-atugoda","html_url":"https://github.com/eranga-atugoda","followers_url":"https://api.github.com/users/eranga-atugoda/followers","following_url":"https://api.github.com/users/eranga-atugoda/following{/other_user}","gists_url":"https://api.github.com/users/eranga-atugoda/gists{/gist_id}","starred_url":"https://api.github.com/users/eranga-atugoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eranga-atugoda/subscriptions","organizations_url":"https://api.github.com/users/eranga-atugoda/orgs","repos_url":"https://api.github.com/users/eranga-atugoda/repos","events_url":"https://api.github.com/users/eranga-atugoda/events{/privacy}","received_events_url":"https://api.github.com/users/eranga-atugoda/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-12T15:06:56Z","updated_at":"2018-07-24T18:31:07Z","closed_at":null,"author_association":"NONE","body":"devexteme version: 18.1.4\r\ndevextreme-angular version: 18.1.4\r\n[ x] bug Report \r\n[x ] support inquiry \r\n\r\nHi,\r\n I'm using Angular version of dxvectormaps and couldn't get the markers to redraw on vector maps when the data is changed. The new data is getting drawn along with previous data. When I look at the svg elements through browser developer options I see that there are bubble markers for both previous and new data. How to get the map to clear the old ones and re-draw new ones as per new data? Initially the map draws bubbles for the sum of all years. Then ideally based on user input it should show data for the selected year only, replacing the previous bubbles on the map. Following is the sample code\r\n\r\nAngular .ts component file: mapComponent.ts\r\n\r\n```\r\n\r\n        import {Component, OnInit, ViewChild} from '@angular/core';\r\n        import {Feature, FeatureCollection} from '../../../../models/util_classes.model';\r\n        import {MapData1Service} from '../../../../data/map-data1.service';\r\n        import * as maps from 'devextreme/dist/js/vectormap-data/world.js';\r\n        import {DxVectorMapComponent} from 'devextreme-angular';\r\n\r\nexport class mapComponent implements OnInit {\r\n  @ViewChild('myVectorMap') bubbleMap: DxVectorMapComponent;\r\n\r\n  public mapMarkerData: FeatureCollection;\r\n  public slicedData: FeatureCollection;\r\n\r\n  constructor(public mapDataService1: MapData1Service) {\r\n    this.getMapData();\r\n  }\r\n\r\n//Initially get the data from service \r\ngetMapData(){\r\n    this.mapDataService1.geoMarkersEmit.subscribe(\r\n      (mapData) => this.extractGeoMarkers(mapData));\r\n  }\r\n\r\n//This is invoked when a user clicks a button to get a slice of the data used above\r\n  getSlicedMapData(){\r\n    this.mapDataService1.timeDataSetEmit.subscribe(\r\n      (mapData) => this.extractMasterDataSet(mapData) );\r\n  }\r\n\r\n//Draws the bubbles in the map initially\r\n  extractGeoMarkers(mData: any){\r\n    this.mapMarkerData = mData;\r\n    this.bubbleMap.instance.option('layers[1].dataSource', this.mapMarkerData);\r\n    this.bubbleMap.instance.option('layers[1].color', '#0f74a8');\r\n  }\r\n\r\n//When user clicks a button slice of the data is loaded into a new FeatureCollection object and assigns\r\n// it to the dataSource of the datalayer. But this draws both bubbles from previous dataset as well as the \r\n// newly assigned dataset \r\nslicedGeoMarkers(mData: any){\r\n    let markerLayer = this.bubbleMap.instance.getLayerByName('bubbles');\r\n\r\n    this.slicedData = null;\r\n    this.slicedData = mData;\r\n\r\n\r\n   //this is testing code \r\n   //this.bubbleMap.instance.getLayerByName('bubbles').getDataSource().dispose();\r\n\r\n    this.bubbleMap.instance.option('layers[1].dataSource', this.slicedData);\r\n    this.bubbleMap.instance.option('layers[1].color', '#ffd70b');\r\n\r\n    this.bubbleMap.instance.render();\r\n\r\n     //this is testing code \r\n    //this.bubbleMap.instance.getLayerByName('bubbles').getDataSource().load();\r\n    //this.bubbleMap.instance.getLayerByName('bubbles').getDataSource().reload();\r\n\r\n    \r\n    \r\n\r\n}\r\n```\r\n\r\n\r\nHTML component: mapComponent.html\r\n//here [dataSource] and [color] are not set in <dxi-layer #myDataLayer>  tags as it's set in the typescript code above. \r\n\r\n```\r\n<dx-vector-map\r\n  #myVectorMap\r\n  id=\"vector-map\"\r\n  size=\"{height:300, width:400}\"\r\n  [bounds]=\"[-144, 80, 170, -60]\"\r\n  [center]=\"{ lat: 40.749825, lng: -73.987963 }\">\r\n  <dxo-control-bar\r\n    [enabled]=\"true\"\r\n    [opacity]=\"0.01\"\r\n    [color]=\"'#D8BFD8'\"\r\n    [borderColor]=\"'#6d6b77'\">\r\n  </dxo-control-bar>\r\n  <dxo-tooltip\r\n    [enabled]=\"true\"\r\n    [customizeTooltip]=\"customizeTooltip\">\r\n  </dxo-tooltip>\r\n  <dxo-background\r\n    [borderColor]=\"'#ffffff'\">\r\n  </dxo-background>\r\n  <dxi-layer\r\n    [dataSource]=\"worldMap\"\r\n    [hoverEnabled]=\"true\"\r\n    name=\"areas\"\r\n    [color]=\"'#d3dfd4'\">\r\n    <dxo-label\r\n      [enabled]=\"true\"\r\n      dataField=\"name\"\r\n      [visible]=\"true\">32\r\n    </dxo-label>\r\n  </dxi-layer>\r\n  <dxi-layer #myDataLayer\r\n    [minSize]=\"2\"\r\n    [maxSize]=\"20\"\r\n    [sizeGroups]=\"[0, 999, 99999, 99999999, 999999999999]\"\r\n    name=\"bubbles\"\r\n    elementType=\"bubble\"\r\n    [hoveredColor]=\"'rgba(255, 194, 21, 0.8)'\"\r\n    [hoveredBorderColor]=\"'#341453'\"\r\n    dataField=\"value\">\r\n  </dxi-layer>\r\n  <dxi-legend markerShape=\"circle\" [customizeText]=\"customizeText\" verticalAlignment=\"top\" size=\"10\">\r\n    <dxo-source layer=\"bubbles\" grouping=\"size\"></dxo-source>\r\n  </dxi-legend>\r\n</dx-vector-map>\r\n```\r\n\r\n\r\n\r\nPlease help me how to get the map to show the new bubbles when the dataset is getting changed. Please answer in Angular5 Typescript as I'm not familiar with JS or JQurey.\r\n\r\nMany thanks\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/DevExpress/devextreme-angular/issues/comments/407507340","html_url":"https://github.com/DevExpress/devextreme-angular/issues/825#issuecomment-407507340","issue_url":"https://api.github.com/repos/DevExpress/devextreme-angular/issues/825","id":407507340,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzUwNzM0MA==","user":{"login":"hakimio","id":768105,"node_id":"MDQ6VXNlcjc2ODEwNQ==","avatar_url":"https://avatars1.githubusercontent.com/u/768105?v=4","gravatar_id":"","url":"https://api.github.com/users/hakimio","html_url":"https://github.com/hakimio","followers_url":"https://api.github.com/users/hakimio/followers","following_url":"https://api.github.com/users/hakimio/following{/other_user}","gists_url":"https://api.github.com/users/hakimio/gists{/gist_id}","starred_url":"https://api.github.com/users/hakimio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hakimio/subscriptions","organizations_url":"https://api.github.com/users/hakimio/orgs","repos_url":"https://api.github.com/users/hakimio/repos","events_url":"https://api.github.com/users/hakimio/events{/privacy}","received_events_url":"https://api.github.com/users/hakimio/received_events","type":"User","site_admin":false},"created_at":"2018-07-24T18:31:07Z","updated_at":"2018-07-24T18:31:07Z","author_association":"NONE","body":"Try to bind second layer dataSource to a variable defined in your component.ts. And when data changes make sure dataSource instance changes as well."}}
{"actor":{"display_login":"hakimio"}}