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

156
Visualizações
How can I show my string value on y-axis?

I have 'mode' column on my database and I want to show mode on my chart but my chart doesn't show. I want to show date-mode on chart. I changed my code's type like type: 'category' from 'linear' and my chart showed me battery and date value on y-axis. How can I solve that problem?

This is my chart's JavaScript code:

const config = {
  type: 'line',
  data: {
    datasets: [{
      data: <%=lineData%>,
      borderColor: 'rgb(244, 208, 63)',
      label: "battery voltage",
      yAxisID: 'yl',
    }, {
      data: <%=lineData2%>,
      borderColor: 'rgb(118, 215, 196)',
      label: "battery capacity",
      yAxisID: 'yr',
    }, {
      data: <%=lineData3%>,
      borderColor: 'rgb(231, 76, 60)',
      label: "pv_input_voltage",
      yAxisID: 'yr2',
    }, {
      data: <%=lineData4%>,
      borderColor: 'rgb(100, 149, 237)',
      label: "temperature",
      yAxisID: 'yr3',
    }, {
      data: <%=lineData5%>,
      borderColor: 'rgb(0, 255, 0)',
      label: "humidity",
      yAxisID: 'yr4',
    }, {
      data: <%=lineData6%>,
      borderColor: 'rgb(255, 0, 255)',
      label: "mode",
      yAxisID: 'yr5',
    }]
  },
  options: {
    responsive: true,
    interaction: {
      mode: 'index',
      intersect: false,
    },
    stacked: false,
    plugins: {
      title: {
        display: true
      }
    },
    scales: {
      yl: {
        type: 'linear',
        display: true,
        position: 'left',
      },
      yr: {
        type: 'linear',
        display: true,
        position: 'right',
      },
      yr2: {
        type: 'linear',
        display: true,
        position: 'right',
      },
      yr3: {
        type: 'linear',
        display: true,
        position: 'right',
      },
      yr4: {
        type: 'linear',
        display: true,
        position: 'right',
      },
      yr5: {
        type: 'category',
        display: true,
        position: 'right',
      },
    }
  },
};

this is my chart this is my debugged data

about 4 years ago · Santiago Trujillo
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