简体   繁体   中英

Chart.js label value

I have a question, anyone have an idea, how to change Chart.js label value format?

Screenshot: 在此处输入图片说明

How to change it, so it would show not "ACW (sec): 10" but "ACW: 10sec"

Code looks like:

var doughnutDataAcw = [
                {
                    value: <?php echo gmdate("s", $singleacw); ?>,
                    color: "#35df6b",
                    highlight: "#06cc45",
                    label: "ACW (sec)"
                }

You can use the tooltipTemplate option:

    tooltipTemplate: "ACW: <%=value%>sec"

If you need the ACW part to come from the label:

    tooltipTemplate: "<%=label%>: <%=value%>sec"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM