Allow user components to define information to be shown on mouse hover
A new diagram profile allows user components to specify data that is shown on the diagram when the mouse is hovered on top of the diagram element.
The information that is shown is provided by a function in an SCL module named Actions
at the root of the component type.
hoverContribution :: Variable -> <ReadGraph> [(String, String, String)]
The values returned are a label (left-aligned), a value (right-aligned) and a unit.
Example:
hoverContribution :: Variable -> <ReadGraph> [(String, String, String)]
hoverContribution var = [("Consumer \(nameOf var)", "", ""),
("S-T", doubleValue "temperatureSupply", "C"),
("R-T", doubleValue "temperatureReturn", "C"),
("DT", diffValue "temperatureSupply" "temperatureReturn", "C"),
("S-P", doubleValue "pressureSupply", "bar"),
("R-P", doubleValue "pressureReturn", "bar"),
("DP", doubleValue "pressureDifference", "bar"),
("QN", doubleValue "nominalHeatPower", "kW"),
("Q", doubleValue "heatConsumption", "kW"),
("X", take 10 $ stringValue "x", "deg"),
("Y", take 10 $ stringValue "y", "deg"),
("Z", doubleValue "elevation", "m")] where
doubleValue prop = format "%.3f" (propertyValue var prop :: Double)
diffValue prop1 prop2 = format "%.3f" (propertyValue var prop1 - propertyValue var prop2 :: Double)
stringValue prop = propertyValue var prop :: String