[Bug] the tooltip of generated svg using renderToSVGString is not working.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- data-visualization, frontend
Hướng nghiên cứu
Bắt đầu bằng cách so sánh hành vi của playground với đầu ra từ renderToSVGString, sau đó truy vết SVG được tạo và việc xử lý sự kiện tooltip. Xác nhận liệu đầu ra SVG được mở trong trình duyệt có thể hỗ trợ tương tác tooltip như mong đợi hay không, và thêm một kiểm tra hồi quy cho trường hợp được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
5.2.2
Link to Minimal Reproduction
n.a.
Steps to Reproduce
use the same option (configure render to svg) in playground and renderToSVGString.
option = {
tooltip: { trigger: 'item' },
xAxis: {
type: 'category',
data: ['Apple', 'Banana', 'Orange', 'Melon', 'Grape']
},
yAxis: { type: 'value' },
series: [
{
name: 'Sales',
type: 'bar',
data: [120, 200, 150, 80, 70],
itemStyle: { color: '#5470c6' },
emphasis: { itemStyle: { color: 'Orange' } },
label: { show: true, position: 'top' }
}
]
};
Current Behavior
the svg in playground is highlight and tooltip enabled. But open the generated svg in browser, only highlight, the tooltip is not working as expected.
I did some research, the highlight works because the gnerated svg of renderToSVGString contains some embeded css styles. And the tooltip maybe need some embeded js which is missing now.
Here is an example svg embeded some js for tooltip demo.
svg source:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 200" width="400" height="200" style="background: #fafafa; border: 1px solid #ddd;">
<style>
.hover-target { cursor: help; fill-opacity: 0.8; }
.hover-target:hover { fill-opacity: 1; }
#tip-text {
font-family: sans-serif;
font-size: 14px;
fill: #333;
pointer-events: none; /* Prevents the tooltip from flickering when the mouse hits it */
font-weight: bold;
}
</style>
<circle class="hover-target" cx="80" cy="100" r="40" fill="#ff5722" data-tip="Orange Circle" />
<rect class="hover-target" x="160" y="60" width="80" height="80" fill="#2196f3" data-tip="Blue Square" />
<polygon class="hover-target" points="340,60 300,140 380,140" fill="#4caf50" data-tip="Green Triangle" />
<text id="tip-text" x="0" y="0" visibility="hidden">Tip Content</text>
<script type="text/javascript">
<![CDATA[
const svg = document.querySelector('svg');
const tooltip = document.getElementById('tip-text');
const targets = document.querySelectorAll('.hover-target');
function showTip(e) {
const msg = e.target.getAttribute('data-tip');
tooltip.textContent = msg;
tooltip.setAttribute('visibility', 'visible');
moveTip(e);
}
function moveTip(e) {
// Get mouse position relative to the SVG coordinate system
let CTM = svg.getScreenCTM();
let mouseX = (e.clientX - CTM.e) / CTM.a;
let mouseY = (e.clientY - CTM.f) / CTM.d;
// Position text 15px to the right and 5px above the cursor
tooltip.setAttribute('x', mouseX + 15);
tooltip.setAttribute('y', mouseY - 5);
}
function hideTip() {
tooltip.setAttribute('visibility', 'hidden');
}
targets.forEach(el => {
el.addEventListener('mouseover', showTip);
el.addEventListener('mousemove', moveTip);
el.addEventListener('mouseout', hideTip);
});
]]>
</script>
</svg>
Expected Behavior
the tooltip of generated svg using renderToSVGString is working like the normal usage. Maybe need to embed some js to svg.
Environment
- OS: windows
- Browser: edge, chrome
- Framework:
Any additional comments?
No response
- Ngôn ngữ chính
- TypeScript
- Star
- 67.7k
- 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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/echarts
-
[Bug] String formatter templates only replace the first occurrence of `{a}`/`{b}`/`{c}`Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởen pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
-
[Bug] Inverse axis collapses the grid with outerBoundsContain when a tick is near the axis edgeCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởen pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
[Bug] The zoom cursor in the toolbox area is incorrectCó thể đã có người làm @waterWang đã nhận 98 ngày trước. Đang mởbug en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Tất cả issue của apache/echarts
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
pollen-robotics/reachy-mini-desktop-app#341 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
mike-north/AgentMonitors#648 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Position: a popup placed again from between two layout steps lands a fraction of a pixel offĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
vercel-labs/ui#700 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày