VolkovLabs / business-charts

The Business Charts panel allows you to integrate charts and graphs created by the Apache ECharts library into your Grafana dashboard.
https://docs.volkovlabs.io
Apache License 2.0
139 stars 17 forks source link

how to get new lat/lng after user move a node in geo or gmap? #185

Closed alpglide closed 1 year ago

alpglide commented 1 year ago

I read the example in volkovlabs.io. if we allow users to move the scatter nodes, how can we get new lat/lng of moved nodes?

mikhail-vl commented 1 year ago

Never mind. I figured it out.

Let us know if there is anything else.

alpglide commented 1 year ago

I was wrong, I thought params in echartsInstance.on('dblclick', function (params) {...}) has lat/lng, but it's old values, not new values. :(

mikhail-vl commented 1 year ago

@alpglide You should be able to see all values in the params.

What do you see if you do?

console.error(params)
mikhail-vl commented 1 year ago

Here are the Event concept, may give you an idea to where to look: https://apache.github.io/echarts-handbook/en/concepts/event/

alpglide commented 1 year ago

console.error(params), params stores all values of a node, include lat/lng, before a user move the node. What I want is the new lat/lng after a user moved the node. thanks again.

mikhail-vl commented 1 year ago

@alpglide Check other events like mousemove for new coordinates.

alpglide commented 1 year ago

I will check mousemove. I ask this because when I use echart graph with lots of nodes. after a user moves nodes, I use the following code to find new x,y of each node:

echartsInstance.getModel().getSeriesByIndex(0).getGraph().eachNode(function (node, id) { var layout = node.getLayout(); if (layout) { conloe.log("new x=", layout[0], "new y=",layout[1]);
} }); I just wonder if I can use similar method for nodes on geo map. thanks

mikhail-vl commented 1 year ago

@alpglide That's an option I was thinking about, but one of the events should give you the same information.

Let me know if you find it.

mikhail-vl commented 1 year ago

@alpglide Let us know if there is anything else.