Skip to content

How to remove legend text strike on hide? #11694

Answered by dmityabondar
pbelskiy asked this question in Q&A
Discussion options

You must be logged in to vote

@pbelskiy Hello! Yep, the documentation on this is not entirely clear. But you can disable the standard legend and write a custom one.

I found this solution here: https://www.youtube.com/watch?v=DWb-WSKFGic&ab_channel=ChartJS

Simple example:

<div>
  <div id="chart-legend"></div>
  <canvas id="chart"></canvas>
</div>
<script>
  const colors = ['#68B64E', '#fe6600'];

  const config = {
    type: 'line',
    data: {
      ...other_params, // Here your setting
      datasets: [
        {
          data: data1,
          borderColor: colors[0],
          label: "Label 1"
        },
        {
          data: data2,
          borderColor: colors[1],
          label: "Label 2"
        }
      ]…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pbelskiy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants