0

I'm trying to Add a Bubble legend with Carto VL to my map but the Bubbles are rather showing as a block and not bubble. Is the "Bubble-legend" class deprecated or should I style it myself with CSS?

1
  • 1
    Hi, welcome to GIS SE. I highly recommend taking this tour. There you can find useful information about how this forum works. My two cents: next time try to add as much information as you can (snippets of code, for instance). In doing so, you will help others to replicate your issue. – ramiroaznar Aug 5 '20 at 13:14
0

As far as I know, CARTO VL has never released an out of the box bubble legend. The proper way to get the width ranges from your buckets using the getLegendData method:

layer.on("loaded", () => {
  const legendData = layer.viz.width.getLegendData();

  console.log(legendData);
});

Then, as you said, you can style the size of a bullet points list using the value and use the array of the key values as labels. Here you can find a basic working example to get the data object for your legend.

legend-data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.