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

Đang mở Phù hợp với người mới
#21,857 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
66/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, typescript
Lĩnh vực
data-visualization

Hướng nghiên cứu

Nguyên nhân được nêu trong GraphView.render: phép biến đổi của hệ tọa độ View chỉ được áp dụng cho mainGroup khi series có hệ tọa độ View riêng, nên một View được tái sử dụng sẽ giữ lại phép biến đổi cũ. Hãy bắt đầu bằng cách đọc nhánh đó và cách nhóm được đặt lại giữa các lần render. Hoàn thành khi biểu đồ cartesian2d sau setOption với notMerge: true thẳng hàng với các trục giống như biểu đồ được tạo trực tiếp với tùy chọn cartesian.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
67.8k
Fork
19.9k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/echarts

Tất cả issue của apache/echarts

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.