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.

labelFormat or labelBy to access (value, id, data) similar to colorBy

See original GitHub issue

In a bar chart, I can colour the bars using my own calculation with colorBy. Works great (need in heatmap!)

But I constantly find I need the same power with labels https://github.com/plouc/nivo/issues/64 https://github.com/plouc/nivo/issues/146

Currently all we can access is the value: labelFormat: value => Math.round(value) <-- I can make 5.234235 show as 5 labelFormat: value => moment.duration(value).format('HH:mm:ss', { trim: false }) <-- 10000 becomes 00:00:10

But I cannot do this (where value=150): labelFormat: (value, id, data) => data[id+'Color'] === 'red' ? value : '' // hidden if red labelFormat: (value, id, data) => data[id+'MyStep'] + value // Step 2A: 150 labelFormat: (value, id, data) => data[id+'AltValue'] // a label unrelated to value for calculating bar

@plouc Could a labelBy method be added to handle this (and other labels such as tooltip, axis…) I tried to change the source code but so far have not succeeded.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
sjandrocommented, May 9, 2020

Here is my implementation of total value label on top of nivo’s stacked bars:

https://codesandbox.io/s/nivo-basic-demo-t1z56?file=/src/index.js

5reactions
Larkenxcommented, Oct 25, 2019

Any progress on this? I have a pretty good use case where I have a stacked bar graph that shows the number of total “sessions” created, but some are of one type and some are another. I’d like to show the # of each type, but also show the combined total at the top of each stacked bar! This feature would allow us to do that

Read more comments on GitHub >

github_iconTop Results From Across the Web

valueAxis.labels - API Reference - Kendo UI Chart
In this article you can see how to configure the valueAxis.labels property of the Kendo UI Chart. ... Example - set the value...
Read more >
Using aria-labelledby to provide a name for user interface ...
This techniques uses the aria-labelledby attribute to associate a user interface control, such as a form field, with text on the page that...
Read more >
Loftware Label Manager User Guide
Extract label data from different sources, including ODBC 32 compliant databases ... Enter Loftware Label Manager Design Mode and open your label format....
Read more >
Bar chart | nivo
Key to use to index the data. keys string[]optionaldefault:[ 'value' ].
Read more >
easylabel - Tharo Systems
Enter the path of the directory where the label format backup files will be stored. ... Different values will allow for printing at...
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