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

オープン 初心者向け
#21,857 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
66/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, typescript

調査の方向性

原因は GraphView.render にあります。ビュー座標系の変換は、系列が独自の View 座標系を持つ場合にのみ mainGroup へ適用されるため、再利用されたビューでは古い変換が残ってしまいます。まずそのブランチと、描画の間でグループがどのようにリセットされるかを読んでください。notMerge: true 付きの setOption の後で cartesian2d のグラフが、cartesian オプションで直接作成したチャートと同じように軸に揃っていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
67.8k
フォーク
19.9k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/echarts のほかの issue

apache/echarts の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。