Statistics
This interface depends on cloud capabilities and requires authorization configuration in the Mini Program Developer Platform
Development Settings-Cloud Capabilities. 📢Note: To use statistical capabilities, you need to submit a work order to enable product data statistics. Please submit a quick work order before use.
Interface Capabilities
For smart metering capabilities, we provide the following interface capabilities, which developers can directly call using the API to complete related business development.
Note that the following APIs require the use of @ray-js/ray^1.2.12.
Chart Component
Installation
Component Props
Display yearly temperature statistics
Calculate device energy consumption data
Explanation of the "type" Parameter in Statistical Interfaces for Chart-related Requirements
Statistics Type Reference
The time interval below is currently written as
1 hour, but it can be replaced with1 dayor1 month, which are supported.
sum
Sum the data reported within 1 hour to get the total for that period. Use for cumulative values (e.g., energy consumption, water usage).
minux
Take the maximum value of data reported within 1 hour, subtract the maximum of data reported in the previous hour, to get the delta/usage for this period. Use for meter/counter-style period usage (e.g., electricity or water usage per period).
- Tip: If there is no data for the
previous hour, subtract the maximum reported data before that to obtain the data used forthis hour. - Tip: This type should have been named "minus," but due to a spelling mistake made initially (three years ago), it has been consistently used as
minux.
avg
Sum the data reported within 1 hour, then divide by the number of reports to get the average for that hour. Use for metrics where you need the average level (e.g., temperature, humidity).
min
The minimum value of data reported within 1 hour. Use for lowest temperature, lowest power, valley power, etc.
max
The maximum value of data reported within 1 hour. Use for peak temperature, peak power, peak load, etc.
count
The number of data reports within 1 hour. Use for switch count, report frequency, event count, etc.
recent
The data point closest to the hour boundary. This type only supports hourly statistics, not daily or monthly. Use for charts that need one sample per hour aligned to the hour (e.g., line chart with one point per hour).
Statistical Interval
Statistical by Hour
Simply put, it is to statistically analyze the data reported within 1 hour based on the statistical type and then aggregate it into one point.
Statistical by Day
Simply put, it is to statistically analyze the data reported within 1 day based on the statistical type and then aggregate it into one point.
Statistical by Month
Simply put, it is to statistically analyze the data reported within the month based on the statistical type and then aggregate it into one point.