Adding new graphs to Dashboard

Hi,
I am working on Balena-Sense project. I want to add more graphs on the dashboard than what exists in default, How can I do this? A link to documentation or examples will be helpful. I know that there exist a return type from the server end to add more data pointers:

 return [
        {
            'measurement': 'balena-sense',
            'fields': {
                'temperature': float(current_temperature),
                'pressure': float(sensor.pressure),
                'humidity': float(current_humidity),
                'air_quality_score': float(air_quality_score)
            }
        }
    ]

Hey @hemanthsingh_in

There are two parts to adding additional graphs to the dashboard; firstly we need to capture the additional data and insert the values into the database. This is what the code you have highlighted in your post is doing, where you can add additional lines for each extra value you’d like to record. It’s hard to help any further on this without knowing exactly what sensors you’d like to use, but the basic idea would be to add to the Python code to read the sensor, and then once you have the value stored in a variable, add another line e.g. 'wind_speed': float(current_wind_speed) to store this in the database alongside the other measurements.

Secondly, you’ll then need to add the additional graphs to the Grafana dashboard. If you simply wanted to add some other graphs based from the existing sensor data you already have, you can skip to this step and start editing the dashboard within the Grafana web interface.

The Grafana dashboard is arranged into panels, so the first step is to add a new panel; make sure you are logged in first.
06

The next step is to tell Grafana what data to use for the new panel by clicking Add Query:

Once you have chosen balena-sense under select measurement, you’ll find that Grafana shows all the measurements you’ve inserted with Python, and you can select which one you’d like.

After you’ve chosen your data source, the next step is to choose how to visualise it. Feel free to play with all the options here! Grafana is really customisable.

On top of all this, you can easily edit the default graphs on the dashboard and make changes; hover over the panel and you’ll see a small dropdown arrow appears to the right of the panel title. Here you can find the facility to make changes to the panel via the edit option.

I hope this helps! Come back to us if you get stuck!

1 Like

Hi @chrisys,

Thanks for your comprehensive reply it works!