[Feature] Public API to get the laid-out rectangle of a grid
@adityamukesh ya está trabajando en esto.
Desde el 7/10/2026.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 70/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- data-visualization
Línea de trabajo
Start in src/core/echarts.ts at the implementations of containPixel and convertToPixel, which already resolve a finder object like { gridIndex } to a component. Follow that path to the grid coordinate system's getRect() and expose it as a documented public method returning chart pixels or null before layout. Done means the new API is typed, documented alongside convertToPixel/containPixel, and covered by a test in test/ that checks containLabel and outerBoundsMode shrinking the returned rectangle.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What problem does this feature solve?
The pixel rectangle of a grid (the plot, where the axes are drawn) is known only after ECharts has laid the chart out, and there is no public way to read it. Apps that draw HTML or SVG over a chart (hover labels, a crosshair line, markers, annotations) need it to put the overlay exactly on the plot.
This has been asked before (#16898, #16480) and answered with the private chart.getModel().getComponent('grid').coordinateSystem.getRect(); #16479 says getModel is private and may change. Everything public falls short:
chart.getOption().grid[0]holds the configured values (left,right,outerBoundsMode, ...), not the result of the layout, so it is wrong as soon ascontainLabelorouterBoundsMode: 'auto'shrink the plot.chart.convertToPixel({ xAxisIndex: 0 }, extreme)needs the axis extent. After a dataZoom, or withscale/ automatic ranges, only the model knows it (#17919);getOption().xAxis[0].min/maxstill holds the configured values after a zoom.chart.containPixel('grid', [x, y])can find the edges by probing, but that is aboutlog2(size)calls per edge on every layout change.chart.getOption()deep-clones the whole option, data included, on every call, so it cannot be used on every mouse move.
Our case: a pointer drawn in HTML over several synced charts with a few thousand points each (labels at the points nearest to the mouse, a line across the plot and the time under it). It needs the plot's rectangle on every mouse move, so the read has to be cheap, and today it depends on a private method.
What does the proposed API look like?
A getter that mirrors the finders of containPixel and convertToPixel:
chart.getRect({ gridIndex: 0 });
// -> { x: 70, y: 32, width: 460, height: 204 } in chart pixels, or null when the chart has no such grid or is not laid out yet
Or chart.getGridRect(gridIndex?); the name is open. What matters is that it is documented and stable, and that it gives the result of the layout (including outerBoundsMode and containLabel), which is what getRect() of the grid coordinate system holds today.
- Lenguaje dominante
- TypeScript
- Estrellas
- 67.7k
- Forks
- 19.9k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/echarts
-
[Bug] String formatter templates only replace the first occurrence of `{a}`/`{b}`/`{c}`Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoen pending
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
-
[Bug] Inverse axis collapses the grid with outerBoundsContain when a tick is near the axis edgePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoen pending
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
en pending
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
en pending
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
[Bug] The zoom cursor in the toolbox area is incorrectPosiblemente ocupada @waterWang la tomó hace 98 días. Abiertobug en pending
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Todos los issues de apache/echarts
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
pollen-robotics/reachy-mini-desktop-app#341 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
mike-north/AgentMonitors#648 ·
Los mantenedores suelen responder en 1 día
-
Position: a popup placed again from between two layout steps lands a fraction of a pixel offAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
vercel-labs/ui#700 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 2 días