Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

267
Visualizações
how to change the color of line graph border on hover chartjs?

I am trying to change the color of the border line on the hover. when the line is hovered then gray the other dataset color and just show the color of the highlighted dataset border

1- this when the first dataset 1 is hovering other line graph is gray

enter image description here

2- this is when dataset 2 is hovering other line graph is gray

enter image description here

import {
    Chart as ChartJS,
    CategoryScale,
    LinearScale,
    PointElement,
    LineElement,
    Title,
    Tooltip,
    Legend,
} from 'chart.js';
import { Line } from 'react-chartjs-2';
import faker from 'faker';

export const options = {
    responsive: true,
    interaction: {
        mode: 'dataset',
    },

    plugins: {
        legend: {
            position: 'top',
        },
        title: {
            display: true,
            text: 'Chart.js Line Chart',
        },
    },
};
const labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
console.log(labels.map(() => faker.datatype.number({ min: -1000, max: 1000 })));
export const data = {
    labels,
    datasets: [
        {
            label: 'Dataset 1',
            data: [100, -87, 200, 120, 150, 134, 43],
            borderColor: 'rgba(145,147,148,0.7)',
            backgroundColor: 'rgba(255, 99, 132, 0.5)',
            pointHoverBackgroundColor: 'red',
            hoverBorderColor: "red",
            hoverBackgroundColor: "#FC496BFF"
        },
        {
            label: 'Dataset 2',
            data: [20, -357, 5, 10, 131, 134, 43],
            borderColor: 'rgb(252,73,107)',
            hoverBorderColor: "blue",
            backgroundColor: 'rgba(255, 99, 132, 0.5)',
        },

        {
            label: 'Dataset 3',
            data: [30, -197, 25, 139, 96, 134, 43],
            borderColor: 'rgba(145,147,148,0.7)',
            hoverBorderColor: "blue",
            backgroundColor: 'rgba(53, 162, 235, 0.5)',
        },
    ],
};
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda