-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Agency Dashboard] DataVizStore implementation #186
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.
This is really cool!
If Publisher and Agency Dashboard's charts continue to diverge, we could break up the entire DatapointsView component (which renders the chart, metric title, legend, insights, dropdowns, select metrics button) to its Publisher version and Agency Dashboard version.
I agree that we should keep these together for now! We should push back against too much divergence here. Anytime the designs or functionality spec differs significantly between the two, we should call it out and discuss with Humphrey and Juan and see if there's a way to keep things more similar. (If you feel like things are already diverging a lot, it might be helpful to start keeping track of a list of things that are different?)
This is probably a very naive question, but I'm curious how this new store works when you switch metrics. Does the selected time range, disaggregation, etc. reset? Or does it persist?
common/components/DataViz/utils.ts
Outdated
} | ||
return filterNullDatapoints(filterByTimeRange(datapoints, monthsAgo)); | ||
}; | ||
|
||
// get insights from 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.
super nit, should this comment be moved above transformDataForMetricInsights
now?
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.
Renamed comment to be more clear that these are calculations from already transformed data
if (datapoints.length === 0) { | ||
return datapoints; | ||
} | ||
return filterNullDatapoints(filterByTimeRange(datapoints, monthsAgo)); |
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 probably a bit of a nit, but both of these helper functions (transform for bar and transform for metric insights) do the same null filtering and time range filtering. Is that redundant work? Is there a way to just do that once and then share it?
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.
The bar chart has the extra step of transforming for percent view but i'll share logic between them so thanks for pointing that out!
The key parts that are different are the addition of the Select Metrics button and showing the Metric Insights in a separate component in the Agency Dashboard, and rendering the metric title in Publisher (which I think should probably be separated out from the DatapointsView component) |
It was difficult to figure out how to place the metric insights with the datapoints view so trying out putting it in the left panel made sense at the time |
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 good to me, Terry! Awesome to see how you're breaking this out and thinking about it.
@terryttsai naive question but I'm curious how this new store works when you switch metrics. Does the selected time range, disaggregation, etc. reset? Or does it persist? |
Oh sorry I missed answering your question earlier—the behavior stays the same as before, since we're relying on react useEffects on the data viz component to reset these fields |
Ah thanks, makes sense!! |
Description of the change
Creation of DataVizStore to share data viz state across multiple different components, namely to use with the existing DatapointsView component and the MetricInsights component which I'm rendering on the left panel of the agency dashboard.
If Publisher and Agency Dashboard's charts continue to diverge, we could break up the entire DatapointsView component (which renders the chart, metric title, legend, insights, dropdowns, select metrics button) to its Publisher version and Agency Dashboard version. Right now it's one big component that conditionally renders some of the components depending on how its configured. But for now I'm going to leave this alone.
Type of change
Related issues
Closes #XXXX
Checklists
Development
This box MUST be checked by the submitter prior to merging:
These boxes should be checked by the submitter prior to merging:
Code review
These boxes should be checked by reviewers prior to merging: