Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda