Giter Club home page Giter Club logo

Comments (6)

iscmd avatar iscmd commented on June 15, 2024

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轴的值。]

0ba8410d12de67029475dd856e45f0e

from echarts.

iscmd avatar iscmd commented on June 15, 2024

This is the effect achieved now:
image

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.

helgasoft avatar helgasoft commented on June 15, 2024

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.

iscmd avatar iscmd commented on June 15, 2024

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.

image

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.

helgasoft avatar helgasoft commented on June 15, 2024

"division of the y-axis" ?

If you mean the labels (0,50,100,..), then see interval.

from echarts.

iscmd avatar iscmd commented on June 15, 2024

"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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.