Skip to content

Commit

Permalink
Consolidate time graph tooltip information
Browse files Browse the repository at this point in the history
Use the same method to fill tooltip data on hovering and selection.

Use the middle time of the time graph state to fetch tooltip data.

Signed-off-by: Patrick Tasse <patrick.tasse@ericsson.com>
  • Loading branch information
PatrickTasse committed Mar 25, 2021
1 parent 9866a80 commit 87235a2
Showing 1 changed file with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent<Timegr
}
start = start ? start : (elementRange.start + (offset ? offset : 0)).toString();
end = end ? end : (elementRange.end + (offset ? offset : 0)).toString();
const time = Math.round(elementRange.start + (offset ? offset : 0));
// use middle of state for fetching tooltip since hover time is not available
const time = Math.round(elementRange.start + (elementRange.end - elementRange.start) / 2 + (offset ? offset : 0));
const tooltipResponse = await this.props.tspClient.fetchTimeGraphToolTip(
this.props.traceId, this.props.outputDescriptor.id, time, element.row.model.id.toString());
return {
Expand Down Expand Up @@ -282,23 +283,11 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent<Timegr
}

private async onElementSelected(element: TimeGraphRowElement | undefined) {
let tooltipObject = undefined;
if (element && this.props.viewRange) {
const elementRange = element.model.range;
const offset = this.props.viewRange.getOffset();
const time = Math.round((elementRange.start + ((elementRange.end - elementRange.start) / 2)) + (offset ? offset : 0));
const tooltipResponse = await this.props.tspClient.fetchTimeGraphToolTip(this.props.traceId, this.props.outputDescriptor.id, time, element.row.model.id.toString());
const responseModel = tooltipResponse.getModel();
if (responseModel) {
const tooltipObject = {
'Label': element.model.label,
'Start time': (elementRange.start + (offset ? offset : 0)).toString(),
'End time': (elementRange.end + (offset ? offset : 0)).toString(),
...responseModel.model,
'Row': element.row.model.name
};
signalManager().fireTooltipSignal(tooltipObject);
}
tooltipObject = await this.fetchTooltip(element);
}
signalManager().fireTooltipSignal(tooltipObject);
}

private async fetchTimegraphData(range: TimelineChart.TimeGraphRange, resolution: number) {
Expand Down

0 comments on commit 87235a2

Please sign in to comment.