Chartjs-tsgauge
Chartjs-tsgauge copied to clipboard
add function formatDataValue in options
with this atributte u can modify the text display in the center of gauge. like this example:
var ctx = document.getElementById("chartjs-gauge").getContext("2d");
new Chart(ctx, {
type: "tsgauge",
data: {
datasets: [{
backgroundColor: ["#0fdc63", "#fd9704", "#ff7143"],
borderWidth: 0,
gaugeData: {
value: 32,
valueColor: "#ff7143"
},
gaugeLimits: [0, 50, 100, 150]
}]
},
options: {
events: [],
showMarkers: true,
markerFormatFn : n => n + 'm³/s',
formatDataValue : n => n + 'm³/s',
}
});
before the center text is 32. after the center text is 32m³/s
only add formatDataValue attribute (is a function) in options.
@kluverua @lukas-mertens