chartjs-chart-sankey
chartjs-chart-sankey copied to clipboard
Values and Units of Measurement
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', } ],
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.
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?
Closing this, I will document the tooltip behavior when I have time to add docs.