-
Notifications
You must be signed in to change notification settings - Fork 6
Added functionality to get time series graph for Assets reading [FOGL-1524] #323
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix series vs other names like readings/ average. And also need to check do we want a link text button to open time series graph? and where to place it in gui!
<span class="tag is-light"> Min </span> | ||
<span class="tag is-info" [ngStyle]="{'background-color': '#85C1E9'}">{{roundTo(reading.min, 5)}}</span> | ||
| ||
<span class="tag is-light"> Max </span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don;t think we need avg,min max here
public assetReadingSummary = []; | ||
public graphRefreshInterval = POLLING_INTERVAL; | ||
public optedGroup = 'seconds'; | ||
public readKeyColorLabel = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these all variables required?
constructor(private assetService: AssetsService, private alertService: AlertService, | ||
private ping: PingService) { | ||
this.assetChartType = 'line'; | ||
this.assetReadingValues = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assetReadings?
} | ||
this.assetCode = assetCode; | ||
if (autoRefresh === false) { | ||
this.plotReadingsGraph(assetCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plotReadingsGraph?
this.statsAssetSeriesGraph(assetTimeLabels, assetReading); | ||
} | ||
|
||
getColorCode(readKey, cnt, fill) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks it will be util function
src/app/services/assets.service.ts
Outdated
public getAssetAverage(assetObject: any) { | ||
// TODO: time based readings average; | ||
return this.http.get(this.GET_ASSET + '/' + encodeURIComponent(assetObject.assetCode) + '/' + assetObject.reading + '/series').pipe( | ||
public getAssetAverage(assetCode: string, reading: string, group) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
average?
In case of empty value in time field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see default set to 10 minutes. and no loading indicator on first time load of an asset/sensor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERROR: /foglamp-gui/src/app/components/core/asset-readings/series-graph/series-graph.component.ts[2, 1]: All imports on this line are unused.
Lint errors found in the listed file.
}); | ||
} | ||
|
||
public getAssetReadingsSummary(assetCode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getAssetReadingsSummary? or Series?
} | ||
|
||
public getAssetReadingsSummary(assetCode) { | ||
this.assetService.getAllAssetSummary(assetCode).subscribe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getAllAssetSummary => getAllAssetSeries ?
public getAssetReadingsSummary(assetCode) { | ||
this.assetService.getAllAssetSummary(assetCode).subscribe( | ||
(data: any) => { | ||
this.assetReadingSummary = data.map(o => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change summary by series
value: [o[k]] | ||
}; | ||
}); | ||
this.assetReadingSummary = orderBy(this.assetReadingSummary, ['name'], ['asc']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above
Still seeing this issue
throwing error 400 Time must be a positive integer |
@billehunt This PR is ready for final review. You can test it with FogLAMP |
<circle class="path" cx="50%" cy="50%" r="10" fill="none" stroke-width="2" stroke-miterlimit="10" /> | ||
</svg> | ||
</div> | ||
<div *ngIf='!showSpinner && showGraph' class="columns is-mobile"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should remove showGraph
from here?
As this is being set on ReadingsValidator.validate(data);
so if data for grpah is not numeric, allow user to select asset/sensor to fetch series for newly selected item
@@ -80,6 +80,25 @@ export default class Utils { | |||
return totalSec < 0 || totalSec >= 86400; | |||
} | |||
|
|||
public static getColorCode(readKey, cnt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as we have it in Utils, can we remove the copy for readings graph and use this itself.
@billehunt Please check the below screenshot to see how asset average graph is rendering on asset click |
I'm afraid this functionality is not useful. Users don't need a graph of min/max/average over time. Please don't add any graphs without having me in the loop. |
Closing as not required! |
Actually, I think I jumped the gun with my last comment. My assumption was that this was for the ongoing min, max and average (as the graph above in this PR shows). But now that I'm running the code, I see you're actually looking at min/max/avg for each of the time slices displayed. Which is really good, in fact, way better than what I was thinking (just an avg for each data point). Please re-open and let's discuss next steps with this. I think you're on a good path. Maybe we shouldn't be showing 3 lines, but rather something like this: https://www.researchgate.net/profile/Ian_C_Dunican/publication/311517204/figure/fig4/AS:667673046294537@1536197067559/Between-conditions-comparison-of-max-distance-m-run-displaying-the-group-average.png Sorry about that. |
No description provided.