Modifying legend text / label
See original GitHub issueI need to be able to update the legend text in order to add some formatting features for readability. Is this currently possible to do in a bar / pie chart?
Something like:
legends={[
{
dataFrom: 'indexes',
anchor: 'top-right',
direction: 'column',
justify: false,
translateX: 450,
translateY: 0,
itemsSpacing: 12,
itemWidth: 380,
itemHeight: 20,
itemDirection: 'left-to-right',
itemOpacity: 1,
symbolSize: 16,
legendFormat: d => d.value + d.id, // attempting to format here
symbolShape: ({ x, y, size, fill, borderWidth, borderColor }: LegendProps) => (
<LegendSymbol x={x} y={y} size={size} fill={fill} borderWidth={borderWidth} borderColor={borderColor} />
)
}
]}
However legendFormat
seems to have no effect.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:15 (1 by maintainers)
Top Results From Across the Web
Editing legend (text) labels in ggplot - Stack Overflow
When using ggplot I can't get the right text in the legend, even though it's in my dataframe. I have tried scale_colour_manual , ......
Read more >GGPlot Legend Title, Position and Labels - Datanovia
Change the legend title and text labels · Modify the legend position. · Reverse legend order. · Remove a ggplot legend · Change...
Read more >10.8 Changing the Labels in a Legend - R Graphics Cookbook
You want to change the text of labels in a legend. ... Modified legend label order and manually specified labels (note that the...
Read more >How to Change Legend Labels in ggplot2 (With Examples)
You can use the following syntax to change the legend labels in ggplot2: p + scale_fill_discrete(labels=c('label1', 'label2', 'label3', .
Read more >Legends (ggplot2) - Cookbook for R
There are two ways of changing the legend title and labels. The first way is to tell the scale to use have a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You would set the
data
property on the object in the legend. There you set alabel
property and that is what is used.It is typed as the following shape, but I guess
label
needs to be added there.This is not legend formatting but setting a label on a data. It’s really not the same and just make another point that this lib is not mature for good chart solution