[Bug] Graph on cartesian2d is misplaced after setOption from a graph on the default (view) coordinate system

Abierto Apto para principiantes
#21,857 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
66/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
javascript, typescript

Línea de trabajo

La causa está indicada en GraphView.render: la transformación del sistema de coordenadas View se aplica a mainGroup solo cuando la serie tiene su propio sistema de coordenadas View, por lo que una View reutilizada conserva la transformación anterior. Empieza leyendo esa rama y cómo se restablece el grupo entre renderizados. Está terminado cuando el gráfico cartesian2d, tras setOption con notMerge: true, se alinea con los ejes igual que un gráfico creado directamente con la opción cartesian.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

en pending
Version

6.1.0 (also current master 34f4d927e)

Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?code=lZIxb8IwEIV3fsVtASkqSboFUQl1QB2qDnSrGExyEKuJHewLxEX8956TBmilVuoQS867e_ru-TKtLMFB4nFpRF3AHE4jAItGok3hzV8AyNWYQrDzFUEIpXC6If6htEK-W1dtdLmSH1yURGHXkgsSvh-UqHxvzXVtClEIjk84h3CR9r0UR1Gvxiyve5dSqvcOA6xuTDYYkTA79AD7gEu5ko_zbNTPkglDaKVQtwO1i1ay0WkYJROEO20cm210o3Jh3FLUKWxFaTEc6APBerDxRxasGZqd3A-ngygbZAyv_S-2TGuTS8UkK2cJqw7riz3J_8415qju-UuiX5Nidcgp7vMelPiqJLf56ZqkVpzYZR1mo-kUFltCwx6WiY6SsgJIAxV4TRq6Ee_giSwonaOFXKuAPBRCUwN3cRN3iJbjGVmkV1khhzEeT2D-AJV7LNjrjoWXjmH8_RG7ZdH0jAydApkG4TwJu42ZzD4B&enc=deflate

const viewGraph = {
  series: [{
    type: 'graph', layout: 'none', symbolSize: 20,
    data: [{ name: 'p', x: 0, y: 0 }, { name: 'q', x: 1000, y: 10 }],
    links: [{ source: 'p', target: 'q' }]
  }]
};
const cartesianGraph = {
  xAxis: { type: 'category', boundaryGap: false, data: ['a', 'b', 'c'] },
  yAxis: { type: 'value' },
  series: [{
    type: 'graph', layout: 'none', coordinateSystem: 'cartesian2d', symbolSize: 20,
    data: [10, 30, 20],
    links: [{ source: 0, target: 1 }, { source: 1, target: 2 }]
  }]
};
option = viewGraph;
// After 1 s, switch to the cartesian graph. Its nodes don't line up with the axes:
setTimeout(() => myChart.setOption(cartesianGraph, { notMerge: true }), 1000);
Steps to Reproduce
  1. Render a graph series on its default view coordinate system (layout: 'none' with x/y).
  2. setOption an option whose graph series is on cartesian2d (with notMerge: true here; with roam: true or false alike).
Current Behavior

The nodes and edges of the cartesian graph are scaled and translated by the transform of the previous view graph, so they do not
line up with the axes.

Expected Behavior

The graph is placed on the grid exactly as in a chart created directly with the cartesian option.

Environment
  • OS: any (also reproduced with the SVG renderer in Node.js SSR)
  • Browser: any
  • Framework: none
Any additional comments?

Cause: GraphView.render applies the view coordinate system's transform to its main group only when the series has its own View
coordinate system (if (ownCoordSys) applyViewCoordSysTransToElement(mainGroup, ...)). When the reused view later renders a graph on
an external coordinate system, the old transform is never reset. I can send a PR.

Lenguaje dominante
TypeScript
Estrellas
67.8k
Forks
19.9k
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/echarts

Todos los issues de apache/echarts

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.