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

Add map legend support #15

Closed markmarkoh closed 11 years ago

markmarkoh commented 11 years ago

Add a plugin to render a simple map legend based on your fill data.

markmarkoh commented 11 years ago

example usage:

var b = new Datamap({element: document.getElementById('map')});
b.legend();

//or
b.legend({defaultFillName: 'Undecided'});

//or
b.legend({legendTitle: 'Map Legend!'});

Also you can override the default styles of the legend by targeting datamaps-legend:

<style>
    .datamaps-legend dt, .datamaps-legend dd {
        float: none;
    }
    .datamaps-legend {
        right: -50px;
        top: 0;
    }
</style>
ugokoli commented 8 years ago

I am totally lost. I can't find anywhere on how to implement the datamaps legend to work for me. I don't even know where to locate and download the datamaps legend plugin files. @markmarkoh I need your help. Thank you.