Dropdown selection for datapoint values
-
-
Ok, for a start, that's just a single number. It's not a javascript object so you can't use that dotted object notation.
Let's look at the raw data coming from the serials values, if it's anything like this:
[ {timestamp:1539247293,value:3}]
the approach will have to be changed.Fox
-
Yep, I think you need to look at changing your format. You need the timestamps as your values.
You also need to establish what your start and end times are per each serial. The timestamp by itself won't be enough unless you know you can comfortably add an additional hour for theto
attribute or subtract for thefrom
attribute...Fox
-
the timestamp would be from Serial number to Serial Number+1
-
Then what do you do when you use the latest serial number? Go from that timestamp to now?
-
@mattfox
yes you're correct -
@ronnyhinkel said in Dropdown selection for datapoint values:
ng-change="callOnChange()"
ng-change="callOnChange()"
Are you writing your own controller? -
@mattfox
no thats just a left over from trying, sorry about that -
Ok, I'm gonna be clever...
<md-select ng-model="serialID" ng-required="true" > <md-option ng-repeat="(index,serial) in serials" ng-value="index" > {{serial.value}} </md-option> </md-select> <div ng-if="serialID==(serials.length-1)"> <ma-now update-interval="15 MINUTES" output="time"></ma-now> <ma-point-values point-xid="DP_bf4e8b98-ff25-439c-a63e-4af21bc92902" point="point1" values="point1Values" from="serials[serialID].timestamp" to="time" ></ma-point-values> </div> <div ng-if="serialID<(serials.length-1)"> <ma-point-values point-xid="DP_bf4e8b98-ff25-439c-a63e-4af21bc92902" point="point1" values="point1Values" from="serials[serialID].timestamp" to="serials[(serialID+1)].timestamp" ></ma-point-values> </div>
Using Ng-if will create these elements provided one of the if statements are met. Using the index allows us to make this list grow wholly depending on the number of your serials. If you're on the last serial, it sees we're using the last index and thus uses a ma-now directive to give us the browser time from the serial creation time!
Fox
-
@mattfox
Perfect thats working for meThank you very much Mattfox
-
You're welcome, sorry for the lack of comments. Let me know if there's anything you don't understand after comparing it with the angularJS docs
Fox