iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🚦

Creating Traffic Light-Style Status Indicators in SORACOM Lagoon

に公開

Objective

When visualizing data with SORACOM Lagoon, I want to create a dashboard where the status can be checked using lamp displays—showing green for normal and red for abnormal, like a traffic light.
Something like this:
alt text
or
alt text

Preparation

1. Store data in SORACOM Harvest Data

https://users.soracom.io/en-us/docs/harvest/send-data/

*Note: This is not mandatory as you can use demo data if you don't have your own data yet.

2. Start using SORACOM Lagoon 3

https://users.soracom.io/en-us/docs/lagoon-v3/getting-started/

Method 1: Using Soracom Image Panel

1. Create a Folder

From the Browse tab in Dashboards, click New.

alt text

Select New Folder.

alt text

Enter an appropriate folder name and click Create.

alt text

2. Create a Dashboard and a Time Series Panel

Click + Create Dashboard from the screen you were redirected to.

alt text

Select Add a new panel.

alt text

Select Demo for Resource Type.

alt text

Select Device-1 for Resources and battery for Properties. In that state,

click the duplicate icon twice and change the Resources for Query B and C to Device-2 and Device-3.

alt text

Return to the Dashboard, click the Panel Title, and click Duplicate from More....

alt text

You now have two Time Series Panels.
alt text

3. Creating a traffic-light-like lamp display panel

Click Edit from the dropdown menu that appears when you click the Panel Title.
alt text

Select Soracom Image Panel under Visualization.
alt text

Click + Add Image three times.
alt text

Configure Image0, Image1, and Image2 as follows.
alt text

Image0 Image1 Image2
Name A-Device-1 battery B-Device-2 battery C-Device-3 battery
Threshold 0.3 / 0.7 0.3 / 0.7 0.3 / 0.7
X/Y Positions 30 / 50 50 / 50 70 / 50

Click Save to save, and a dashboard like the one below will be created.
alt text

This shows the display when the battery value of Device-1 is 0.32, Device-2 is 1, and Device-3 is 0.
This works, but since it's hard to tell which icon corresponds to which device/sensor, another option is to separate the panels for each icon.
alt text

Method 2: Using Canvas

The steps up to Method 1-1 and Method 1-2 are the same.

Click Edit from the dropdown menu that appears when you click the Panel Title.
alt text

Select Canvas under Visualization.
alt text

Delete Element1, which is included by default under Elements in Layer.
alt text

Click + Add Element under Elements in Layer and select Icon.
alt text
Add three of these.

It should look like this:
alt text

Clicking Element1 will bring up a field called Selected element (Element1).
alt text

Click SVG path, select your preferred icon, then click Select.
alt text

Select Fill color and then choose Device-1 battery.

Set the Thresholds. Enter 0.3 and 0.7.
alt text

Configure Elements2 and Elements3 in the same way.
At this time, set the left in Layout to 100 and 200 to position each icon.
It's fine if it looks like this. Click Apply to save.
alt text

Adjust the panel size,
alt text

and it becomes easier to understand if you add a text Element and display Sensor-1, Sensor-2, and Sensor-3 there.

Configuration screen
alt text

Result
alt text

Although Canvas is more tedious to set up, it is convenient because it offers flexibility in layout settings and allows you to decide icons and colors relatively freely.

That's all. Great job!

GitHubで編集を提案

Discussion