chart.js issue.. plz nn

feyhchoi

FE-yhchoi

Posted on February 16, 2023

chart.js issue.. plz nn
formatter: function (value, context) {
              var result = value
                .toString()
                .replace(/\B(?=(\d{3})+(?!\d))/g, ",");

              var index = context.dataIndex;
              var fontWeight = index === 0 ? 700 : 500;
              return {
                value: result,
                font: {
                  weight: fontWeight,
                },
              };

              return result;
            },
Enter fullscreen mode Exit fullscreen mode

Chart.js (2.9.4) + Chartjs-datalabels plugin (0.7.0) in use.
Currently, I want to change the label font-weight value of the 0th index to bold.
Label values are output as [object object] values due to the lower return result.

Can I get some advice?

💖 💪 🙅 🚩
feyhchoi
FE-yhchoi

Posted on February 16, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

chart.js issue.. plz nn
chart chart.js issue.. plz nn

February 16, 2023