-
Notifications
You must be signed in to change notification settings - Fork 11
feat: drilldown selection feature added to cartesian chart #1149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1149 +/- ##
==========================================
- Coverage 84.53% 84.47% -0.07%
==========================================
Files 843 847 +4
Lines 17932 18032 +100
Branches 2357 2369 +12
==========================================
+ Hits 15159 15232 +73
- Misses 2662 2687 +25
- Partials 111 113 +2
Continue to review full report at Codecov.
|
|
@anandtiwary @itssharmasandeep please review this |
projects/observability/src/shared/components/cartesian/cartesian-chart.component.ts
Outdated
Show resolved
Hide resolved
projects/observability/src/shared/components/cartesian/cartesian-chart.component.ts
Outdated
Show resolved
Hide resolved
projects/observability/src/shared/components/cartesian/d3/chart/cartesian-chart.ts
Outdated
Show resolved
Hide resolved
projects/observability/src/shared/components/cartesian/d3/chart/cartesian-chart.ts
Outdated
Show resolved
Hide resolved
projects/observability/src/shared/components/cartesian/d3/chart/cartesian-chart.ts
Outdated
Show resolved
Hide resolved
.../src/shared/dashboard/widgets/charts/cartesian-widget/cartesian-widget-renderer.component.ts
Outdated
Show resolved
Hide resolved
.../widgets/charts/cartesian-widget/interactions/cartesian-explorer-navigation-handler.model.ts
Outdated
Show resolved
Hide resolved
| @ModelInject(NavigationService) | ||
| private readonly navigationService!: NavigationService; | ||
|
|
||
| public execute(dateRange: any): Observable<void> { |
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.
this can be typed
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.
@anandtiwary I have made changes except for typed. . please review.
.../widgets/charts/cartesian-widget/interactions/cartesian-explorer-navigation-handler.model.ts
Outdated
Show resolved
Hide resolved
8380710 to
32182d4
Compare
|
@aaron-steinfeld @anandtiwary please review |
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.
A bit confused, but should probably have one of the UI folks look at it (I rarely work in the UI code any more)
| private readonly navigationService!: NavigationService; | ||
|
|
||
| // tslint:disable-next-line | ||
| public execute(selectionData: any): Observable<void> { |
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.
please remove disable and fix type
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.
changed
|
|
||
| // tslint:disable-next-line | ||
| public execute(selectionData: any): Observable<void> { | ||
| const startPoint = selectionData[0]; |
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.
Do we have a guarantee we'll get two data points here?
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.
changed to timerange
| import { TimeRange } from '@hypertrace/common'; | ||
| import { ContainerElement, mouse, select } from 'd3-selection'; | ||
| import { brush, BrushBehavior, D3BrushEvent } from 'd3-brush'; | ||
| // tslint:disable-next-line: no-restricted-globals weird tslint error. Rename event so we can type it and not mistake it for other events |
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.
do we need to lead with the underscore here?
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.
removed
| const startPoint = selectionData[0]; | ||
| const endPoint = selectionData[1]; | ||
|
|
||
| // When there is only one point in selected area, start timestamp and end timestamp is same. This causes timerange exception |
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.
Hmm - this kind of makes me wonder what the expected result of the selection actually is. In many products, a selection on the time series is independent of the data entirely (e.g. if I select from 9 am -> 11 am, that becomes my time range even if the data points are at 10am and 1030am).
Would it be better to represent a selection object something like:
interface Selection {
selectedRange: TimeRange; // I actually can't recall, are all of our cartesians time based or do they support any range type?
selectedData: Map<Series, Data[]>;
}
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.
done
| const endPoint = selectionData[1]; | ||
|
|
||
| // When there is only one point in selected area, start timestamp and end timestamp is same. This causes timerange exception | ||
| const startTime = new Date(startPoint.dataPoint.timestamp).getTime() - 6000; |
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.
This is assuming the time part I Was asking about above, but capturing this in the selection object would prevent the need for this work around (and give a more accurate selection not limited by the current data).
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.
done
| path: ['/explorer'], | ||
| queryParams: params, | ||
| queryParamsHandling: 'merge', | ||
| replaceCurrentHistory: true |
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.
- it goes to explorer with no filter? That seems very unintuitive. I guess it's a completely different set of functionality, but I'd expect a range selection to apply a time range. Also unclear on the merge params. The params from the source page may not apply to the explorer.
- Why would this replace history? Should have default history support.
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.
uses custom time range to filter data between the selected time ranges
projects/observability/src/shared/components/cartesian/cartesian-chart.component.ts
Outdated
Show resolved
Hide resolved
projects/observability/src/shared/components/cartesian/cartesian-chart.module.ts
Outdated
Show resolved
Hide resolved
projects/observability/src/shared/components/cartesian/d3/chart/cartesian-chart.ts
Outdated
Show resolved
Hide resolved
...et/interactions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.ts
Outdated
Show resolved
Hide resolved
ef0d6ba to
60de5f0
Compare
.../src/shared/dashboard/widgets/charts/cartesian-widget/cartesian-widget-renderer.component.ts
Outdated
Show resolved
Hide resolved
| </div> | ||
| ` | ||
| }) | ||
| export class CartesianExplorerContextMenuComponent { |
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.
Just use this component inside interaction handler. No need to make this a generic component as of now.
|
@jyothishjose6190 when can we incorporate the remaining review comments? |
I will incorporate them today. |
e040b48 to
c694b6b
Compare
| ); | ||
| ) | ||
| .withEventListener(ChartEvent.Select, selectedData => { | ||
| this.selectionChange.emit(selectedData as CartesianSelectedData<TData>); |
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.
Is this cast required? Can we type it so that selectedData come as CartesianSelectedData<TData> ?
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.
may be we can do if(data instanceOf CartesianSelectedData<TData>) ?
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.
@jyothishjose6190 looks like you missed this
@jyothishjose6190 is making some changes, once he's done, I will take a look. |
|
@jyothishjose6190 Where do we stand on this? |
|
LGTM |
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.
apart from few minor outstanding issues, this is good to go. @aaron-steinfeld @itssharmasandeep your thoughts?
My thoughts haven't changed since the beginning - I don't think this is the right UX for the use case. A brush selection on the cartesian should change the time range only, like it does in most products. If we want to support drilling into explorer, that's independent of a brush selection. As I read this PR, a brush selection on a cartesian brings up a context menu that has one option. That option, "Explore" changes time range and navigates to explorer, but it doesn't maintain the context of the actual metrics on the chart in any way (and can't because many of the charts being displayed are not current exposed via explorer, at least not directly). Trying to change the time range itself without navigating to drill into the data in context is a significantly more common use case. If we had built that without a context menu (e.g. how grafana works), then it would still take the same number of clicks to get to the trace screen with the time range - one drag to set the time range, and one click to switch to explorer. I do recognize that this has been open for months at this point, but I've probably brought this up a half dozen times in various contexts. I think the hard part is done here - the brush selection - but I'd like to see us streamline the UX still, or at a minimum offer the option to just set the time range. |
|
@aaron-steinfeld I agree with the concern here, but this ux had been discussed in the past with various stakeholders and we decided to go ahead with this approach for hypertrace. We will surely iterate over this |
Discussed this with @anandtiwary and came to a good compromise. For context, my concern is for Hypertrace in that I don't think in its current form we solve either ticket (if there's any others that I missed, please clarify) :
As a compromise that both maintains the existing work and helps better align to the use cases with minimal extra effort, my proposal is to add a "Set Time Range" option to the context menu as the first option before "Explore", whose affect is to just set the time range without navigating. With that hypertrace/hypertrace#220 is solved I believe. As to hypertrace/hypertrace#208 , we can keep iterating on that in later PRs to bring more context with us when clicking Explore to accomplish the described use case. |
@anandtiwary @aaron-steinfeld made changes as discussed above. please review |
...et/interactions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.ts
Outdated
Show resolved
Hide resolved
ccad41f to
a6f6fad
Compare
...et/interactions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.ts
Outdated
Show resolved
Hide resolved
dc123d9 to
82ea0d2
Compare
...teractions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.test.ts
Outdated
Show resolved
Hide resolved
...teractions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.test.ts
Outdated
Show resolved
Hide resolved
...teractions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.test.ts
Outdated
Show resolved
Hide resolved
...teractions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.test.ts
Outdated
Show resolved
Hide resolved
...teractions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.test.ts
Outdated
Show resolved
Hide resolved
...teractions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.test.ts
Outdated
Show resolved
Hide resolved
...shared/dashboard/widgets/charts/cartesian-widget/cartesian-widget-renderer.component.test.ts
Outdated
Show resolved
Hide resolved
...et/interactions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.ts
Outdated
Show resolved
Hide resolved
...d/widgets/charts/cartesian-widget/interactions/cartesian-explorer-selection-handler.model.ts
Outdated
Show resolved
Hide resolved
...gets/charts/cartesian-widget/interactions/cartesian-explorer-selection-handler.model.test.ts
Outdated
Show resolved
Hide resolved
7ec0372 to
8f39e00
Compare
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.
Unresolved several comments that had been resolved but not addressed as well.
|
@aaron-steinfeld updated PR with your comments. Please check |
...teractions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.test.ts
Outdated
Show resolved
Hide resolved
projects/observability/src/shared/components/cartesian/d3/chart/cartesian-chart.ts
Outdated
Show resolved
Hide resolved
...shared/dashboard/widgets/charts/cartesian-widget/cartesian-widget-renderer.component.test.ts
Outdated
Show resolved
Hide resolved
.../src/shared/dashboard/widgets/charts/cartesian-widget/cartesian-widget-renderer.component.ts
Outdated
Show resolved
Hide resolved
...teractions/cartesian-explorer-context-menu/cartesian-explorer-context-menu.component.test.ts
Outdated
Show resolved
Hide resolved
...gets/charts/cartesian-widget/interactions/cartesian-explorer-selection-handler.model.test.ts
Outdated
Show resolved
Hide resolved
...d/widgets/charts/cartesian-widget/interactions/cartesian-explorer-selection-handler.model.ts
Outdated
Show resolved
Hide resolved
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.
lgtm, didn't have a chance to review the bursh and cartesian code though, so relying on @anandtiwary 's review of that - @anandtiwary did you want to take one more pass or good to go?
|
LGTM |
|
@jyothishjose6190 Could you please merge the latest main in this PR branch? |
4be3739 to
f25dc77
Compare
|
@aaron-steinfeld something went wrong here. This commit has all the changes. |
|
Looks like @jyothishjose6190 didn't merge main but instead force pushed main into his remote branch, overwriting all of the commits. Force pushing is very dangerous for this reason - I strongly discourage anyone from doing it unless you have a really strong understanding of git and are working solo such that rewriting history will not affect anyone else. Hopefully he still has the original commit on his local. |
|
@anandtiwary @aaron-steinfeld Sorry about this. I will keep this in mind |
|
It's your branch (looks like it still exists in the razorpay repo, so it's recoverable), you're welcome to do what you want with it - it's just riskier for the author to use force pushing in terms of data loss because it goes around version control and overwrites history each time. |
|
new PR created with all the changes #1394 |
brush added to cartesian chart
on a feature**: brush added to cartesian chart