Regarding the measurement labels appearing in Web UI graphs. I have implemented a GenericMeasurement Java class that accepts "unit" and "quantity" as constructor arguments. Unit works fine up to graphing. I was expecting to see "quantity" as graph label, but instead I see "GENERIC MEASUREMENT". Is the graph label simply extracted from the class, or can I set an attribute to define the label, hence avoiding to create a specific class for each measurement type I want to visualize ?
Asked
Active
Viewed 87 times
1 Answers
0
The labels in UI are automatically taken from the JSON of the measurement. Let's say you have a JSON like this:
{
"GenericMeasurementFragment": {
"GenericMeasurementSeries": {
"value": 25,
"unit": "km/h" }
},
"time":"2013-06-22T17:03:14.000+02:00",
"source": { "id":"10200" },
"type": "GenericMeasurement"
}
The label for graph directly is taken from GenericMeasurementSeries. If you are in devicemanagement the headline for the whole graph is taken from GenericMeasurementFragment. The UI will automatically use spaces if camel case is used.
So it is not the class name in Java that defines the series but rather the JSON produced from it. You can take a look at the class TemperatureMeasurement in device-capability model. It uses an annotation to force the series to be named "T".

TyrManuZ
- 2,039
- 1
- 14
- 23
-
Ok, got that. Perhaps my definition of "label" was not clear enough, I was trying to change the all capitals graph label placed on the top left hand corner – Hannu_H Jan 18 '17 at 11:56
-
This is taken from the fragment. It depends a bit how it looks in your code. You have your measurement and then you use set() to add your GenericMeasurement. There is a set which takes Object,String and one with Object,Class. If you use the later on the String is generate from the full package + class name of the class (replacing dots with underscore). In Both cases the resulting String is the "GenericMeasurementFragment" – TyrManuZ Jan 18 '17 at 16:21