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

254
Vistas
Echarts: how to get x and y values during mouse events

I have the following chart:

const quotesChart = echarts.init(quotesContainer);
quotesChart.setOption({
  dataset: [
    { source: quotes }
  ],
  xAxis: [
    {
      type: 'category',
    },
  ],
  yAxis: [
    {
      position: 'left',
    }
  ],
  series: [
    {
      name: 'Quotes',
      type: 'line',
      datasetIndex: 0,
    }
  ]
})

quotesChart.getZr().on("mousemove", function(params){
  const pointInPixel = [params.offsetX, params.offsetY];
 
  // how do I get x and y values for current mouse position?

  // I see some examples using convertFromPixel but I don't know how to use these coordinates to get x and y values
  const pointInGrid = quotesChart.convertFromPixel('grid', pointInPixel);
})

The quotes dataset source looks like: [{period: '20/01/2021', value: 15.59}, {period: '21/01/2021', value: 15.99}]

I need to get values from axis x and y (ex: 20/01/2021 and 15.59) but I don't know how, I only have the grid coordinates.

Thanks.

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

0

It was simpler than I thought, it turns out pointInGrid[0] is the position of the series array, so I did: quotes[pointInGrid[0]] to get the series item I needed.

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