question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to make axisLabel clickable

See original GitHub issue

问题简述 (One-line summary)

In echarts 2 there was an option to make axisLabels clickable. This option seems to be gone in version 3.

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version): 3.1.3
  • 浏览器类型和版本 (Browser version): Google Chrome 49.0.2623.110
  • 操作系统类型和版本 (OS Version): Windows 8

期望结果 (Expected behaviour)

It would be great if xAxis: [{ axisLabel: { clickable: true } }] made the label clickable (as in version 2), so that I could capture clicks using chart.on('click').

可能哪里有问题 (What went wrong)

Unfortunately xAxis: [{ axisLabel: { clickable: true } }] has no effect in version 3 of the library.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
tmtroncommented, Jul 1, 2020

In version 4.1.0 I had to set triggerEvent = true

3reactions
pissangcommented, Apr 19, 2016

Hi @fmal , axisLabel has been added in commit https://github.com/ecomfe/echarts/commit/a6f51b166d63987aa1148cd22af38f5d933c4c75

The usage is changed. axisLabel.clickable is replaced with xAxis.silent and the params of event is a bit different.

For example

option: {
  xAxis: {
    // Enable mouse event
    silent: false
  }
}

chart.on('click', function (params) {
  // Make sure event from target axis
  if (params.componentType === 'xAxis' && params.xAxisIndex === 0) {
    // params.value is the axis label before formatted
    console.log(params.value);
  } 
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Option to make axisLabel clickable · Issue #2943 - GitHub
In echarts 2 there was an option to make axisLabels clickable. This option seems to be gone in version 3. 版本及环境 (Version &...
Read more >
Change axis labels in a chart - Microsoft Support
Right-click the category axis labels you want to format, and click Font. On the Font tab, choose the formatting options you want.
Read more >
Making the horizontal axis labels clickable - Stack Overflow
On the various axis charts (Line, Column, etc.) the targetID of the axis labels look something like this: hAxis#0#label#1 .
Read more >
How to Create Clickable X Scales with Links in Chart JS
We will create in Chart.js clickable scale labels with link by building our own function. For this we do need to understand how...
Read more >
How to Create Clickable Y Axis With Links in Chart JS
First we need to make sure the canvas can read our click. ... on the matching label we need to open the matching...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found