markmarkoh / datamaps

Customizable SVG map visualizations for the web in a single Javascript file using D3.js
http://datamaps.github.io
MIT License
3.78k stars 1.01k forks source link

In Edge states stay highlighted after you hover over them #435

Open johnwpowell opened 6 years ago

maximdresvyankin commented 6 years ago

https://github.com/markmarkoh/datamaps/pull/367 - More than year ago but still as unmerged request.

MarVybCZ commented 6 years ago

if you have just one basic and one highlight color then it is possible to make it via styles and remove events from map objects

<style>
  path.datamaps-subunit {
    fill: lightgray;
    stroke-width: 0;
  }

  path.datamaps-subunit:hover {
    fill: gray;
    stroke-width: 1;
  }
</style>
var map = new Datamap({...})

map.svg.selectAll('.datamaps-subunit')
    .on('mouseover', '').on('mouseout', '');
  map.svg.selectAll('.datamaps-subunit').style.fill = '';
  map.svg.selectAll('.datamaps-subunit').style.strokeWidth = '';