alexandrainst / alexandra-trackmap-panel

Grafana map plugin to visualise coordinates as markers, hexbin, ant path, or heatmap.
MIT License
78 stars 26 forks source link

[WIP] Add multiple track support #51

Closed eh-steve closed 2 years ago

eh-steve commented 3 years ago

Addresses https://github.com/alexandrainst/alexandra-trackmap-panel/issues/13

This is a bit of a major refactor to support multiple time series being returned. It also adds support for:

@Alkarex I would appreciate opinions on whether this is a direction worth pursuing?

This is an example of what you can do with the new configuration options using custom tile layers and custom marker overrides using time series label values image

Alkarex commented 3 years ago

@eh-steve That looks very good already 👍🏻 Go ahead! Could you please write if you can think of any back-compatibility issue?

JorundMartinsen commented 3 years ago

Very good with the new options, especially the custom tileserver url.

Could you update the documentation to include the new and updated options?

ZhongyuWang commented 3 years ago

Dear @eh-steve

Could you please guide me how to test the pull request. The markers disappear in your version but works fine in the original version. I have also tried to change the "Default marker HTML" option with no luck. The first image is the original version and the second is the new version with exactly the same settings.

origin pr51

Best regards, Zhongyu

DmitrySidorow commented 3 years ago

Hello! Thank you for that great update! But I have same problem as @ZhongyuWang. My markers are disappears. My datasource is Portgres 12 + timescaledb 2.2.1. Grafana 7.5.3

eh-steve commented 3 years ago

Have you tried formatting as time series rather than table?

DmitrySidorow commented 3 years ago

Have you tried formatting as time series rather than table?

Table and time series does not work

eh-steve commented 3 years ago

Hmmm... I just set up a dummy postgres/timescaleDB table with this data: image and set up the panel with defaults (except I enabled Map center to first position, and formatted the results as time series) and it seems to work:

image

Can you post a table schema and data which reproduces the problem?

DmitrySidorow commented 3 years ago

Hmmm... I just set up a dummy postgres/timescaleDB table with this data: image and set up the panel with defaults (except I enabled Map center to first position, and formatted the results as time series) and it seems to work:

image

Can you post a table schema and data which reproduces the problem?

It worked for me when I put a number in the tooltip, not a string. Is it possible to make support formatting as a table?

xkilian commented 3 years ago

@eh-steve Does the plugin support mapping the tooltip to string (value mapping). If it doesn't would it be possible to add it in, it will increase the flexibility and reduce the amount of questions/support. 👍🏼

eh-steve commented 3 years ago

@eh-steve Does the plugin support mapping the tooltip to string (value mapping). If it doesn't would it be possible to add it in, it will increase the flexibility and reduce the amount of questions/support. 👍🏼

I think it should as long as the the field name of popup or text or desc is used for popups, and tooltip for tooltips (though I haven't tested these).

eh-steve commented 3 years ago

Is it possible to make support formatting as a table?

Supporting both table and timeseries for multiple tracks would require duplicating a bit of functionality as the data is structured differently. Is there a particular use case you had which can't be addressed via timeseries?

DmitrySidorow commented 3 years ago

Is it possible to make support formatting as a table?

Supporting both table and timeseries for multiple tracks would require duplicating a bit of functionality as the data is structured differently. Is there a particular use case you had which can't be addressed via timeseries?

Try to change value column to string type and show it on tooltip

smilingface7117 commented 3 years ago

Tried this plugin with influxDB as data source and grafana 7.5.9. Cannot see any Markers on the map. Will lat and long be good enough to show marker on the map or this is the compatibility issue with InfluxDB?

[Query] "FORMAT AS Time series" SELECT mean("latitude") AS "lat", mean("longitude") AS "lon" FROM "autogen"."influxmqtt_consumer" WHERE ("topic" = 'kpi-data') AND time >= now() - 5m GROUP BY time(200ms) fill(none)

[Table] image

DmitrySidorow commented 3 years ago

@eh-steve Hey, how is the progress going? I can't wait for the update :)

oliver0513 commented 3 years ago

Hi,

plugin work great with Grafana 7.5.10 but i can't use "Custom SVG Markers for different timeseries" by label value option. My Query is from MySQL DB. How do you override label ?

thx

ZhongyuWang commented 3 years ago

Hi @eh-steve ,

It seems the pull request works in grafana 7 (tried on 7.5.10) but not in grafana 8. The marker does not show as I posted earlier in this thread. Do you happen to have a fix for it?

j-or commented 2 years ago

Multi-query support would be a great addition! I've done some work on this refactor, mainly focusing on multi-track support. I've re-added some functionality that was removed/overwritten and fixed some things that seemed to no longer work, like heatmaps. Using html for icons is now a toggle in case someone wants to use the original version with pngs. Custom tile server has already been added via another PR. I haven't had time to look into the live-track functionality, so that is currently commented out. I might add an issue for this if I don't get it done. The "discard zero or null" feature no longer works after support for multi-track, so that needs works too.

It would be great if someone could test the newest version - @eh-steve @oliver0513 @DmitrySidorow @JorundMartinsen @xkilian @smilingface7117 ? Note that currently, the tracks must either be timeseries or table, not a mix (though this could probably be added in a future update).

DmitrySidorow commented 2 years ago

Multi-query support would be a great addition! I've done some work on this refactor, mainly focusing on multi-track support. I've re-added some functionality that was removed/overwritten and fixed some things that seemed to no longer work, like heatmaps. Using html for icons is now a toggle in case someone wants to use the original version with pngs. Custom tile server has already been added via another PR. I haven't had time to look into the live-track functionality, so that is currently commented out. I might add an issue for this if I don't get it done. The "discard zero or null" feature no longer works after support for multi-track, so that needs works too.

It would be great if someone could test the newest version - @eh-steve @oliver0513 @DmitrySidorow @JorundMartinsen @xkilian @smilingface7117 ? Note that currently, the tracks must either be timeseries or table, not a mix (though this could probably be added in a future update).

thank you! now it works with timeseries. But tooltip has wrong position. image

oliver0513 commented 2 years ago

Hi all,

@j-or tested on grafana 8.1.1 windows OS with mutiple query from sql database, it work fine now except for html markers but I think it is rather me who made a configuration error. Can you provide a sample ?

thx

image image

DmitrySidorow commented 2 years ago

image I think we need option to manually adjust the icon or tooltip position. In my case, the coordinate point should be in the center of the icon

j-or commented 2 years ago

I haven't been able to get labels to show up in my timeseries data (examples/tutorials would be great), but I tried the HTML overrides and the antpath colours with hardcoded labels and both worked. I've added examples in the readme. I've also added options to offset the icons, popups and tooltips. I hope to merge this soon and then add an issue for the "live tracking" which is still unfinished.

A few examples that might be useful to someone - using two timeseries queries: