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.

events defined by `chart.on(eventName, ...` are not triggered

See original GitHub issue

defined events are not triggered

(at least) finished and rendered events are not triggered/executed.

Version & Environment

  • ECharts version v4.2.0-rc2
  • Browser version chrome-70.0.3538.77
  • OS Version windows 7

Expected behaviour

the function defined should be triggered. in given example: having ‘finished loading’ in console

ECharts option

var myChart = echarts.init(document.getElementById('chart1'), null, {
	"devicePixelRatio": null,
	"renderer": "canvas",
	"width": null,
	"height": "600px"
});
myChart.setOption({
	"title": {
		"text": "test",
	},
	"grid": [
		{
			"top": "5%",
			"height": "60%",
			"width": "60%",
			"left": "5%",
			"containLabel": false,
			"borderColor": "transparent",
			"show": "1"
		}
	],
	"xAxis": [
		{
			"type": "time",
			"min": "dataMin",
			"max": "dataMax"
		}
	],
	"yAxis": [
		{
			"type": "value",
		}
	],
	"series": {"name": "insufficient_data", "type": "bar"},
});

myChart.on('finished', function (params){
	console.log('finished loading');
});

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
sxmpaschcommented, Nov 6, 2018

As intermediate solution, you could add an event listener to the parent div object in order to receive click-coordinates. They then can be transformed into real axis coordinates:

document.getElementById('chart-panel').addEventListener("click",function(e){
    console.log(e.zrX+"#"+e.zrY+'#'+myChart.convertFromPixel({xAxisIndex:0, yAxisIndex:0},[e.zrX,e.zrY]));
})

0reactions
mohitjain0824commented, Jul 20, 2022

In the axis option, you might have to add triggerEvent property.

myChart.setOption({ . . "xAxis": [ { triggerEvent: true, } ], "yAxis": [ { triggerEvent: true, } ], })

This worked for me. Hope it helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

events defined by `chart.on(eventName, ...` are not triggered
found the issue. there is a problem with triggering the events when the dataset is empty. if there is no data to be...
Read more >
[GitHub] arashdalir opened a new issue #9341: events defined by ...
arashdalir opened a new issue #9341: events defined by `chart.on(eventName, ...` are not triggered URL: ...
Read more >
Handling Events | Charts
Overview. Google charts can fire events that you can listen for. Events can be triggered by user actions, such as when a user...
Read more >
React google chart timeline handle event not working on ...
I have react google chart timeline with chartEvents. I want when clicked on define chart, display modal window. On first page load it...
Read more >
ECharts Document
Attention: Event triggered by user switching legend in ECharts 2.x is changed from ... could assign by name attribute when not defined dataIndex?:...
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