question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request: show each item count in legend

See original GitHub issue

Hello, nice chart!

What about showing the total count for each section in the legend? Or even in a tooltip while hovering each slice?

My service is returning an array of objects, each contains it’s value… so let’s say there are 3 sections, first with value = 3, second = 3, third = 6, with this formula I’ve converted these values into percentages:

series_data.map(s => ({ 
    "label": s.label, 
    "value": s.value / data.total * 100, 
    color: s.color 
}))

Total is the sum of all the values. Yeah I know…it’s easy but I think that would be nice to have it implemented as an option, in order to avoid this conversion every time. 😃

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gebvcommented, Jul 27, 2020

I also want to control the legends Maybe add slot for every items of legend? Follow the concept code

<vc-donut hasLegend legendPlacement="bottom" total="100" size="150" :thickness="45" :sections="sections">
<template v-slot:legendItem="props">
  {{props.color}} <!--from donut sections-->
  {{props.value}} <!--from donut sections-->
  {{props.percent}} <!--virtual field = value/total*100%-->
  {{props.label}} <!--from donut sections-->
</template>
</vc-donut>
0reactions
funder7commented, Jul 23, 2020

Vue_donut_proposal

Sorry for the misaligned text, it’s done with an image editor.

I would:

  • Let the user decide how to print the total: number or percentage?
  • Show or not each item amount in the legend, on the side. I’ve put it in the colored box, but it can be placed on the right as well.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Display item count in legend using ArcGIS Online web maps
We would like to be able to display an item count in the legend while using ArcGIS Online Web maps. If you change...
Read more >
Percentage of total for each legend item
I am using a line visualization with multiple legend values. I want to show legends as a percentage of the total per month....
Read more >
Display feature count in legend by map extent using mask and ...
I would like to have the count of requests by district in order to display it in my legend. Unfortunately, this returns the...
Read more >
Show feature count in composer legend · Issue #15545 - GitHub
A new tool button which can switch on/off feature counts in composer legend for selected vector layer was added in Composer > (Legend)...
Read more >
Microsoft Chart Controls Legend Item Ordering - Stack Overflow
Or you can create some collection first and fill it by referencing existing legend items in desired order, then clearing LegendItems and inserting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found