Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve viewing of sensor data #227

Closed
paul121 opened this issue Jan 6, 2020 · 4 comments
Closed

Improve viewing of sensor data #227

paul121 opened this issue Jan 6, 2020 · 4 comments

Comments

@paul121
Copy link
Member

paul121 commented Jan 6, 2020

Wanted to start working on improving the viewing of sensor listener data. I thought the first place to start would be with adding a date range to the farm_sensor_data view. And then work on passing this set of data to the graph.

I was able to add the Date filters to to the view via the Views UI admin page:
sensor_data_views_ui

I can verify that the Start date and End date filters are working correctly, but because the forms action is a POST to /farm/assets/sensors/%d/data, submitting the filters takes me off of the /farm/sensors/**sensor_name** page where the graph is displayed:
sensor_filter

@mstenta am I taking the right approach for this? I see the farm_sensor_data view is added to the sensor page in a bit of a "custom" way: https://github.com/farmOS/farmOS/blob/7.x-1.x/modules/farm/farm_sensor/farm_sensor_listener/farm_sensor_listener.module#L642

I also just came across your reply here where you mention creating a custom view plugin for displaying graphs. After playing with Views UI I think I have a better understanding for what you mean... Theoretically a "Graph" view plugin could be used for quantity data and sensor data, correct?

@mstenta
Copy link
Member

mstenta commented Jan 8, 2020

Chatted with @paul121 about this today and we landed on the best approach: create a custom Views style plugin that displays graph(s), and add that as an Attachment display to the sensor data View.

@paul121
Copy link
Member Author

paul121 commented Feb 24, 2020

I played with this a little bit this weekend. I found the Drupal Charts that basically does what we were describing - it adds a Views plugin for graphs! And has support for D7 and D8, although D7 has fewer options for the graphing libraries. Here's what I found:

  • From the Views UI, add a "chart" view with a line graph of Farm Asset Sensor data, add this to the Master view 👍
  • Graph multiple sensor values ("names") with separate series of data
    • There's a bug.. if the different values don't have data at the same timestamp, the graph displays them as if they were the same timestamp. In the screenshot, the last two values in the table should not be graphed at the same date. This is an issue with the labels the graph is using. If a series had null values for the values it was missing I think this would work fine
  • The sensor value is sortable. When displaying only one value type, the graph works as expected.
  • In general the xaxis does not show timeseries data is a great way. (I'm not sure I have this configured correctly though - the module API has more options than the Views UI)
  • Unsure if it is possible to display a graph for each sensor value from the Views UI. I know this would be possible from the Charts API though.

Multiple series:

Screenshot-2020-2-24 Test Sensor data farmos-chart

One sensor value:

Screenshot-2020-2-24 Test Sensor farmos-chart

Views UI config:

Screenshot-2020-2-24 Farm Sensor Data (Farm asset) farmos-chart

The graphing library displayed here is google charts. This is the only library available with Charts D7, but D8 has more options. It's also possible to integrate additional libraries.. which might be worth exploring! The "display" issues are mostly related to the JS library, not Charts module. Might make it fairly easy to get something working with D7.

@mstenta
Copy link
Member

mstenta commented May 25, 2021

@paul121 I wonder if we can close this, and/or create new specific issues in the drupal.org issue queue?

@mstenta
Copy link
Member

mstenta commented Apr 6, 2023

Closing old/stale issues. There's been some renewed discussion in chat about charting modules in farmOS v2. Let's start a new issue or pull request when a specific pathway is clear.

@mstenta mstenta closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants