Comments (6)
The desired effect is that clicking on a point on the chart will attach it to the nearest point on the x-axis of the line, and display the corresponding values on the y-axis and x-axis.
[中文:想要实现的效果是:点击图表上的点会吸附到折线上最近的x轴上的点,并显示对应y轴和x轴的值。]
from echarts.
This is the effect achieved now:
The existing code implementation is as follows, which cannot display the corresponding y-axis value, only the y-axis value of the clicked point can be implemented.
[中文:现有的代码实现如下,无法实现显示对应y轴的值,只能实现点击的点的y轴的值。]
code:
tooltip: {
// 选中数据显示标签
trigger: 'axis', // 坐标轴提示
axisPointer: {
type: 'cross', // 直线指示
axis: 'x',
snap: true,
},
formatter(params) {
console.log('formatter');
},
},
from echarts.
The reason why tooltip cross does not 'snap' to Y-axis is that Y-axis type is 'value', not 'category' (like X-axis).
A workaround with markLine is possible solution - Demo. You could also adapt it to a click event.
from echarts.
The reason why tooltip cross does not 'snap' to Y-axis is that Y-axis type is 'value', not 'category' (like X-axis). A workaround with markLine is possible solution - Demo. You could also adapt it to a click event.
May I ask how to manually adjust the division of the y-axis, as my original division had a markLine, which may conflict with your demo
[中文:请问这个y轴的划分是如何手动调节呢,因为我原有的划分是有markLine,导致会和你的demo冲突]
from echarts.
"division of the y-axis" ?
If you mean the labels (0,50,100,..), then see interval.
from echarts.
"division of the y-axis" ?
If you mean the labels (0,50,100,..), then see interval.
This is evenly distributed, and I want to implement the logic of dividing specified values
[中文:这个是均分的,想实现指定值划分的逻辑]
from echarts.
Related Issues (20)
- [Feature] 添加自定义组件中,基于富文本格式的文字超长截断和换行功能 HOT 6
- When the yAxis value of the markline exceeds the yAxis range, the markline will not be displayed
- [Bug] 绘制3万个左右散点的图形时,鼠标悬浮在部分散点上时鼠标的样式未变化,部分是正常变化的;同时点击散点无法触发点击事件 HOT 4
- [Feature] legend.formatter函数,接收的参数可不可以像tooltip.formatter一样 HOT 3
- [Bug] geo3D中 无法监听到 georoam事件 HOT 2
- [Feature] echats3D地图type: "map3D"如何关闭hover区域高亮 HOT 2
- [Feature] Add an item to graph but exclude from pie HOT 2
- [Bug] How to implement an interval chart HOT 2
- [Bug] 柱状图series 标签和坐标轴标签重叠 HOT 3
- It does not position the label correctly on waterfall chart when it crosses the X axis HOT 2
- [Bug] map**地图 右下角南海诸岛与**最新地图展示有不同的地方 HOT 5
- [Bug] In SVG rendering mode, ECharts does not support gradient colors for axis line styling. HOT 2
- [Feature] Natural(browser-native) horizontal scroll (move).
- [Bug] small shifts in scatter scatter
- [Bug] itemStyle does not work in sunburst when there is visual Map but it works in tree map
- [Bug] The issue of occupying space in the non displayed part of a semicircle pie chart HOT 1
- [Feature] echarts多个柱状图如何只显示单个markLine HOT 4
- [Feature] Implement mobile dataZoom-Inside to horizontally scale only the xAxis with gestures and vertically scale only the yAxis with gestures.
- [Bug] 散点图覆盖地图时,使用dataset指定更新散点图数据失效 HOT 6
- [Feature] 为树状图添加x轴,y轴和极坐标轴支持,使图表可以同时反应分支关系和节点属性 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from echarts.