Cumulocity SCADA组件能否使用经计算转换的测量值适配SVG图形?
Absolutely! You can definitely use computed or transformed measurements in Cumulocity's SCADA components, and there are two straightforward approaches to achieve your temperature range conversion (-20 to 100 → -90 to 90) for SVG graphics.
Option 1: Precompute the transformed value using Cumulocity's Calculated Measurements
This is ideal if you need the converted value across multiple components or want to store the transformed data for historical purposes:
- Navigate to Data Management > Measurements > Calculations in your Cumulocity tenant
- Click Add calculation to create a new rule
- Select your target device and the original temperature measurement series (e.g.,
c8y_Temperature) - Enter the conversion formula in the calculation editor. For your range, the formula simplifies to:
Let me break that down: Your original range spans 120 units (-20 to 100), and the target spans 180 units (-90 to 90). The scaling factor is 180/120 = 1.5. Adjusting for the offset gives us1.5 * value - 60(value + 20) * 1.5 - 90, which simplifies to the formula above. - Name the new measurement series (e.g.,
c8y_TransformedTemperature) and save the calculation - Now, when configuring your SCADA SVG component, simply select this precomputed measurement series as your data source
Option 2: Apply on-the-fly conversion directly in the SCADA component
If you only need the converted value for a single SVG component, skip precomputing and handle the conversion directly in the component's configuration:
- Open the SCADA editor and load your SVG graphic
- Bind your original temperature measurement to the SVG element you want to control (e.g., a gauge needle or progress bar)
- Look for an Advanced data binding or Expression field (location varies slightly by component type)
- Input the same conversion formula here:
1.5 * value - 60 - Preview the component to verify: when the source temperature is -20, the converted value should be -90; when it's 100, it should hit 90. Intermediate values will scale linearly.
Quick Validation Check
Let’s test a few values to confirm the formula works:
- Original temp = -20 →
1.5*(-20) -60 = -30 -60 = -90✔️ - Original temp = 0 →
1.5*0 -60 = -60(which is 1/6 of the target range, matching the original position) ✔️ - Original temp = 100 →
1.5*100 -60 = 150 -60 = 90✔️
A Few Notes
- Use Option 1 if you need the transformed value in multiple places (avoids redundant calculations)
- Option 2 is faster for one-off component setups
- If your SCADA component supports JavaScript expressions, you can also write the formula as
((value + 20) / 120) * 180 - 90for more readability—both versions produce the same result
内容的提问来源于stack exchange,提问作者Bitwalk
相关产品推荐
相关产品推荐

