100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Make marker colour ranges independent of order (#1015)
DonWillemsddcfd8ea43e0
diff --git a/ui/component/or-map/src/util.ts b/ui/component/or-map/src/util.tsindex 4b5e342f8..552c8d62e 100644--- a/ui/component/or-map/src/util.ts+++ b/ui/component/or-map/src/util.ts@@ -115,7 +115,7 @@ export function getMarkerIconAndColorFromAssetType(if (colourConfig.type === "range" && colourConfig.ranges && typeof attrVal === "number") {const ranges = colourConfig.ranges;// see in what range the attrVal fits and if not, what the setting for the highest range is- const colourFromRange = ranges.find(r => attrVal > r.min) || ranges.reduce((a, b) => (b.min > a.min) ? a : b);+ const colourFromRange = ranges.sort((a, b) => b.min - a.min).find(r => attrVal >= r.min) || ranges.reduce((a, b) => (b.min > a.min) ? a : b);colour = colourFromRange.colour || undefined;} else if (colourConfig.type === "boolean") {const value = !!attrVal + "";