一到六个读数以大数字显示,旁边以文字标明区间,配合刻度盘、条形、油箱或电池形状,远处清晰可见。可填满屏幕,居中显示,角落方形或单行显示,或沿边缘作为条带运行。可设置一到六个读数及其刻度、命名区间和可选目标,选择径向、半圆、速度表、线性、子弹、油箱或电池形状,选择是否显示区间,选择数字或区间主导单个读数,选择始终显示或仅在警告、危险或缺失时显示。
直播卡片
类别:运营。标签:图表与仪表,数字与指标,办公室与工作场所,工厂与仓库。
布局
此核心卡适用于所有布局:全屏、居中、宽屏、角落、芯片、条带或任何自由矩形。
布局:全屏,居中,宽屏,角落,芯片,条带。表单:横向,纵向,方形,条带。
数据与隐私
此卡使用其配置的属性和实时卡数据。
属性
有关主题、背景、强调色和位置,请参见通用属性。
创建卡片时,在卡片的params中设置静态属性。其数据文档仅包含动态属性。嵌套行描述其父属性的内容。
静态属性
| 名称 | 类型 | 默认 | 数值和限制 | 描述 |
|---|---|---|---|---|
title | string | "" | maxLength:40 | 仪表上方的标题。 |
style | string | "radial" | "radial", "semicircle", "speedometer", "linear", "bullet", "tank", "battery" | radial:270度刻度盘。semicircle:半圆刻度盘。speedometer:指针指示彩色刻度带。linear:条形。bullet:条形后面的刻度带带有目标缺口。tank:框架内的扁平垂直条。battery:带端子的框架内扁平条。 |
showBands | boolean | true | 绘制每个读数的定性带(表盘内的环)。 | |
intervalSeconds | integer | 6 | 最小值:3;最大值:60 | 每个角落和筹码显示每个读数的时间,直到下一个读数。 |
hero | string | "value" | "value", "band" | 单个读数的主导内容:数值(数字及其下方的区间名称)或区间(文字及其下方的数字)。 |
presence | string | "always" | "always", "attention" | 始终:卡片始终显示。注意:仅在读数处于警告或危险区间,或尚无数值时显示;角落和芯片轮流显示这些读数。 |
backgroundColor | 字符串,空值 | null | 模式:"^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$" | 用纯色 CSS 顺序覆盖卡片背景和底板。#RRGGBBAA 提供透明度。背景无则优先。 |
textColor | 字符串,空值 | null | 模式:"^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$" | 覆盖主文本和次要文本颜色。强调色和语义状态色保持原有功能。 |
动态属性
| 名称 | 类型 | 默认 | 数值和限制 | 描述 |
|---|---|---|---|---|
metrics | array | [{"label":"Living room","value":21.5,"unit":"°C","min":10,"max":30,"decimals":1,"target":22,"bands":[{"to":18,"tone":"cool","label":"Cool"},{"to":24,"tone":"success","label":"Comfortable"},{"to":30,"tone":"warning","label":"Warm"}],"icon":"thermometer"},{"label":"Humidity","value":58,"unit":"%","min":0,"max":100,"bands":[{"to":30,"tone":"warning","label":"Dry"},{"to":60,"tone":"success","label":"Comfortable"},{"to":100,"tone":"cool","label":"Humid"}],"icon":"humidity"},{"label":"Air quality","value":780,"unit":"ppm","min":400,"max":2000,"bands":[{"to":800,"tone":"success","label":"Fresh"},{"to":1200,"tone":"warning","label":"Stuffy"},{"to":2000,"tone":"danger","label":"Poor"}],"icon":"air-vent"}] | minItems:0;maxItems:6 | 一到六个读数。每个读数有刻度(最小值、最大值)、定性区间(终点:区间上限;色调:成功、警告、危险、强调、冷色、暖色或静音;标签:名称)和可选目标。 |
metrics[].label | string | maxLength:40;必填 | ||
metrics[].value | 数字,空值 | 无数值时,仪表以幽灵状态绘制其区间并显示等待中。 | ||
metrics[].unit | string | "" | maxLength:8 | |
metrics[].prefix | string | "" | maxLength:4 | |
metrics[].min | number | 0 | ||
metrics[].max | number | 100 | ||
metrics[].decimals | integer | 0 | 最小值:0;最大值:3 | |
metrics[].target | 数字,空值 | null | ||
metrics[].bands | array | [] | maxItems:6 | |
metrics[].bands[].to | number | 必填 | ||
metrics[].bands[].tone | string | "accent" | "success", "warning", "danger", "accent", "cool", "warm", "muted" | |
metrics[].bands[].label | string | "" | maxLength:16 | |
metrics[].charging | boolean | false | 电池显示充电闪电符号。 | |
metrics[].icon | 空值,字符串 | null | null, "activity-01", "air-vent", "airplane-01", "alert-01", "alert-02", "american-football", "analytics-up", "apple", "arrow-down-01", "arrow-down-right-01", "arrow-up-01", "arrow-up-right-01", "award-01", "baseball", "basketball-01", "battery-full", "bell-ring", "bicycle", "birthday-cake", "bitcoin", "bus-01", "calendar-03", "calendar-04", "calendar-add-01", "calendar-check", "call-02", "camera-01", "cancel-circle", "car-01", "champion", "chart-decrease", "chart-increase", "checkmark-circle-02", "clock-01", "clock-02", "cloud", "cloud-angled-rain", "cloud-angled-zap", "cloud-big-rain", "cloud-drizzle", "cloud-fog", "cloud-hailstone", "cloud-snow", "coffee-01", "coffee-02", "contact-01", "container-truck-01", "cricket-bat", "crown", "delivery-truck-01", "dices", "discord", "discount-tag-01", "dollar-02", "door-closed-locked", "door-open", "drink", "droplet", "ethereum", "euro", "exchange-01", "facebook-01", "factory", "fast-wind", "favourite", "ferry-boat", "fire", "fire-02", "first-aid-kit", "flag-01", "flag-02", "flash", "flower-01", "football", "gauge", "gift", "git-branch", "globe-02", "google", "hand-prayer", "heart", "help-circle", "home-01", "hourglass", "humidity", "ice-hockey", "information-circle", "instagram", "lamp-01", "lantern", "leaf-01", "leaf-02", "lightbulb", "link-01", "linkedin-01", "litecoin", "location-01", "location-04", "mail-01", "medal-first-place", "medical-mask", "meeting-room", "megaphone-01", "message-01", "money-exchange-02", "moon-02", "moon-cloud", "moon-star", "music-note-01", "navigation-03", "new-releases", "new-twitter", "news", "news-01", "noodles", "package-delivered", "parking-area-square", "party", "party-popper", "pause-circle", "percent-circle", "pinterest", "pizza-01", "play-circle", "play-store", "podium", "pound", "pumpkin", "qr-code", "qr-code-01", "queue-01", "quote-down", "quote-up", "ranking", "restaurant-01", "rocket-01", "rss", "running-shoes", "sale-tag-01", "security-check", "shop-sign", "shopping-bag-01", "siren", "smart-phone-01", "snapchat", "snowflake", "sparkles", "spotify", "star", "star-half", "star-off", "stop-circle", "store-01", "sun-03", "sun-cloud-02", "sunrise", "sunset", "swimming", "tag-01", "target-02", "temperature", "tennis-ball", "thermometer", "thermometer-cold", "thermometer-warm", "threads", "ticket-01", "tiktok", "time-quarter-pass", "timer-01", "tornado-02", "train-01", "tram", "trophy", "tropical-storm", "tsunami", "user-02", "user-group", "user-love-01", "vegetarian-food", "volleyball", "volume-high", "vote", "walking", "warehouse", "waves", "whatsapp", "wheat-off", "wifi-01", "wifi-full-signal", "wifi-lock", "wrench-01", "yen", "youtube" | |
metrics[].previous | 数字,空值 | null | 变更前的读数为changedAt;指针或填充从该值扫动至当前值。 | |
metrics[].changedAt | 字符串,空值 | null | 读数变化的 ISO 8601 时间点。几秒内仪表从 previous 扫描到新值。 | |
updatedAt | 字符串,空值 | null | 读数的 ISO 8601 时间。 |
画布示例
将静态属性保存为 params.json 并创建卡片。结果中包含它的 crd_ ID。
{
"theme": "neomustard"
}
screenrig card create --type gauge --major 1 --file params.json
将此项目添加到播放列表页面的primitives中,并用该 ID 替换示例中的 ID。发布播放列表并分配屏幕。
{
"id": "gauge",
"primitive": "card",
"card": "crd_01EXAMPLECARD000000000",
"layout": "full",
"content_fit": "fill"
}
写入实时数据
创建卡片后向其写入文档,之后替换该文档即可更新屏幕,无需重新发布。卡片会按其动态属性检查每次写入,并拒绝它不接受的文档。请使用与播放列表相同的项目。
将文档保存为card-data.json。CLI直接读取文档,无需包装:
{
"metrics": [
{
"label": "Living room",
"value": 21.5,
"unit": "°C",
"min": 10,
"max": 30,
"decimals": 1,
"target": 22,
"bands": [
{
"to": 18,
"tone": "cool",
"label": "Cool"
},
{
"to": 24,
"tone": "success",
"label": "Comfortable"
},
{
"to": 30,
"tone": "warning",
"label": "Warm"
}
],
"icon": "thermometer"
},
{
"label": "Humidity",
"value": 58,
"unit": "%",
"min": 0,
"max": 100,
"bands": [
{
"to": 30,
"tone": "warning",
"label": "Dry"
},
{
"to": 60,
"tone": "success",
"label": "Comfortable"
},
{
"to": 100,
"tone": "cool",
"label": "Humid"
}
],
"icon": "humidity"
},
{
"label": "Air quality",
"value": 780,
"unit": "ppm",
"min": 400,
"max": 2000,
"bands": [
{
"to": 800,
"tone": "success",
"label": "Fresh"
},
{
"to": 1200,
"tone": "warning",
"label": "Stuffy"
},
{
"to": 2000,
"tone": "danger",
"label": "Poor"
}
],
"icon": "air-vent"
}
],
"updatedAt": null
}
screenrig card data put crd_01EXAMPLECARD000000000 --file card-data.json
或直接调用 API。API 将相同文档包装在 document 字段中。智能体令牌已指定其项目,因此不发送项目头;若发送 ScreenRig-Project,必须与令牌项目匹配。通过环境提供 API 授权;详见 API 认证。
curl --request PUT "https://api.screenrig.ai/api/cards/crd_01EXAMPLECARD000000000/data" \
--header "Authorization: Bearer $SCREENRIG_TOKEN" \
--header "Content-Type: application/json" \
--data '{"document":{"metrics":[{"label":"Living room","value":21.5,"unit":"°C","min":10,"max":30,"decimals":1,"target":22,"bands":[{"to":18,"tone":"cool","label":"Cool"},{"to":24,"tone":"success","label":"Comfortable"},{"to":30,"tone":"warning","label":"Warm"}],"icon":"thermometer"},{"label":"Humidity","value":58,"unit":"%","min":0,"max":100,"bands":[{"to":30,"tone":"warning","label":"Dry"},{"to":60,"tone":"success","label":"Comfortable"},{"to":100,"tone":"cool","label":"Humid"}],"icon":"humidity"},{"label":"Air quality","value":780,"unit":"ppm","min":400,"max":2000,"bands":[{"to":800,"tone":"success","label":"Fresh"},{"to":1200,"tone":"warning","label":"Stuffy"},{"to":2000,"tone":"danger","label":"Poor"}],"icon":"air-vent"}],"updatedAt":null}}'