Skip to content
This repository has been archived by the owner on Mar 23, 2020. It is now read-only.

Added functionality to get time series graph for Assets reading [FOGL-1524] #323

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

MonikaSharma06
Copy link
Contributor

No description provided.

Copy link
Contributor

@praveen-garg praveen-garg left a 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>
&nbsp;
<span class="tag is-light"> Max </span>
Copy link
Contributor

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 = [];
Copy link
Contributor

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 = [];
Copy link
Contributor

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);
Copy link
Contributor

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) {
Copy link
Contributor

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

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

average?

@mshariq-nerd
Copy link
Contributor

In case of empty value in time field. foglamp/asset/system%2FcpuUsage%2Fall/%iowait/series?group=seconds&seconds=null throwing error 400 Time must be a positive integer

Copy link
Contributor

@praveen-garg praveen-garg left a 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

Copy link
Contributor

@mshariq-nerd mshariq-nerd left a 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) {
Copy link
Contributor

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(
Copy link
Contributor

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 => {
Copy link
Contributor

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']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above

@mshariq-nerd
Copy link
Contributor

Still seeing this issue
for blank value in input field

foglamp/asset/system%2FcpuUsage%2Fall/%iowait/series?group=seconds&seconds=null

throwing error 400 Time must be a positive integer

mshariq-nerd
mshariq-nerd previously approved these changes Oct 11, 2018
@mshariq-nerd
Copy link
Contributor

@billehunt This PR is ready for final review. You can test it with FogLAMP develop branch

<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">
Copy link
Contributor

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) {
Copy link
Contributor

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.

@mshariq-nerd
Copy link
Contributor

@billehunt Please check the below screenshot to see how asset average graph is rendering on asset click
asset-page

sinusoid-series-graph

@billehunt
Copy link
Contributor

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.

@praveen-garg
Copy link
Contributor

Closing as not required!

@billehunt
Copy link
Contributor

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.

@praveen-garg praveen-garg reopened this Oct 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants