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

178
Vistas
Show tooltip in ECharts given all input values null

I got an issue with showing hover tooltips with ECharts line graph when all input values of the graph are null.

The use case is a graph that might have some null/undefined values at certain points in time. For normal values, the graph would show the tooltip as usual. Whenever the value of the graph is null or undefined, I want the graph still show the hover tooltip but with custom format, for instance, 'N/A'.

The example code snippet is a simple EChart configuration that I took from EChart line graph examples and change the input data to null.

const container = document.getElementById("main");
const chart = echarts.init(container);

const options = {
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "shadow",
      label: {
        show: true,
        overflow: "break"
      }
    }
  },
  xAxis: {
    type: "category",
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: [
    {
      type: "value",
    },
  ],
  series: [
    {
      type: "line",
      data: [null, null, null, null, null, null, null],
    }
  ]
};

chart.setOption(options, true);
#main {
  width: 600px;
  height: 200px;
}
<html>
  <body>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.2.0/echarts.min.js"></script>
    <div id="main"></div>
  </body>
</html>

Unfortunately, ECharts does not show any tooltip when all input values are null (or undefined). It will show only when at least one of the input is not null nor undefined.

How can I force ECharts to show the tooltip regardless so that I can show the custom format hover?

MWE with all null values: https://codepen.io/htr3n/pen/bGRvyJJ

MWE with at least one non-null value: https://codepen.io/htr3n/pen/JjJLQYr

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This is actually a bug in ECharts 5.2 and previous versions. I opened a ticket with the ECharts team and they will fix and release the fix in v5.3.0.

Relevant bug ticket:

  • https://github.com/apache/echarts/issues/15821
about 4 years ago · Juan Pablo Isaza Denunciar
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