chartjs-chart-sankey icon indicating copy to clipboard operation
chartjs-chart-sankey copied to clipboard

Values and Units of Measurement

Open OverSamu opened this issue 2 years ago • 3 comments

Added showValues and unitOfMeasure options: datasets: [ { data: [{ from: 'TEST1', to: 'TEST2', flow: 15}, {from: 'TEST3', to: 'TEST2', flow: 20}, {from: 'TEST4', to: 'TEST2', flow: 25}, {from: 'TEST2', to: 'TEST6', flow: 60}, {from: 'TEST5', to: 'TEST6', flow: 10}], showValues: true, unitOfMeasure: "kW", colorFrom: (c) => getColor(c.dataset.data[c.dataIndex].from), colorTo: (c) => getColor(c.dataset.data[c.dataIndex].to), borderWidth: 0, borderColor: 'black', } ],

values_unitsOfMeasurement

OverSamu avatar Aug 04 '21 12:08 OverSamu

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarcloud[bot] avatar Aug 04 '21 12:08 sonarcloud[bot]

Sorry for late comment, been away and/or busy.

I think it could be better to make a overridable callback to generates the label (similar to tooltip). That way it would suit almost any use case.

kurkle avatar Sep 01 '21 19:09 kurkle

I'm sorry, I didn't understand what you mean. Searching through the examples uploaded to the repository I found this one, which perhaps could come close to what you wrote in the last comment to this PR. However, trying to change that callback, it doesn't seem to update in the chart. Would that be what you meant?

OverSamu avatar Jan 06 '22 09:01 OverSamu

Closing this, I will document the tooltip behavior when I have time to add docs.

kurkle avatar Sep 24 '22 09:09 kurkle