Skip to main content
100%

dc-leaflet legend feature (creates a static legend based on range of the data)

✓ Published0🌍 Public
KKatiRG
Last edited Sep 23, 2015
Created on Sep 23, 2015

This example demonstrates how to add a static legend to a dc.leafletChoroplethChart, displaying color ranges based on the data’s domain. A Leaflet control is created and updated during the chart’s preRedraw event, calculating color grades from the chart’s colorDomain and color palette. The legend appears only after all six linked dc charts have been cycled, using the YlGn colorbrewer palette and a d3.extent calculation. The code shows the dc.js and Leaflet integration, including custom legend lifecycle methods.

AI-generated description

Similar vizzes