-
Notifications
You must be signed in to change notification settings - Fork 3
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
Visual treatment for small numbers #532
Conversation
Pull Request Test Coverage Report for Build 2447408917
💛 - Coveralls |
Great to be working with you again too! :)
We should also update the copy that appears below each chart. Instead of saying:
We should say:
|
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.
Hey, nice to connect with you nasaownsky. I'm new to this codebase but I will be getting familiar with it as time goes on. So far I just have a couple comments:
export function useCreateHatchDefs( | ||
data: CategoricalChartRecord[], | ||
highlighted: ItemToHighlight | undefined, | ||
type?: "rate" |
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.
What is type
used for?
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.
Hey! Nice to connect with you too!
This is redundant part, I changed the approach here. Now fixed
Is there some sort of legend or explanation as to what the diagonal lines mean? |
While testing this branch, I noticed that a bar with diagonal lines don't have an animation transition from faded to not faded when the mouse is no longer hovering over it? |
spotlight-client/src/charts/utils.ts
Outdated
@@ -23,6 +23,11 @@ import { isItemToHighlight, ItemToHighlight } from "./types"; | |||
|
|||
const FADE_AMOUNT = 0.45; | |||
|
|||
export function generateHatchFill(id: string): string { | |||
const cleanId = id.replace(/[^\w\d]/g, ""); | |||
return `url(#${cleanId})`; |
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'm new to this, what does url(#...)
do?
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's pointing to defs with pattern by id
@hobuobi So I made a lot of changes here, now it's working as expected I suppose. @terryttsai Yeah, now there is an explanation in notes. As for the animations - I spent a lot of time trying to figure out why they aren't working, but so far has no success in it. The hatched bars do not animate when hovering over them. What do you think about that @hobuobi? |
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.
All looks good! Two things that we should follow-up on at a later date:
- Reimplementing the faded transitions for the hashed treatment
- Adding a visual legend for the hashed treatment, rather than the caption
|
||
const FADE_AMOUNT = 0.45; | ||
|
||
export function isSmallData(data: CommonDataPoint[]): boolean { |
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.
Checking out your latest changes, I'm no longer seeing any special treatment for small numbers. Looks like the issue is this sumBy here, we're now summing up all the values in a set of data, rather than doing what we were doing before which is comparing a single point of data's value with d.value < STATISTIC_THRESHOLD
.
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 pulled up all latest changes and the hashed treatment still working. At least in demo mode. I merged changes, try it now, please.
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 the hashed treatment working for me, where should I expect to see it? Here's a video of what I'm seeing: https://www.loom.com/share/04848c562c3849f9a523d86d1888e991
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 expect in us-nd/narratives/prison to see hashed treatment for numbers under 100
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.
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.
Oh, this was in Humphrey comment from 12 Apr:
This was clear to me after looking at your implementation, but it would probably make more sense to apply the visual treatment to the entire visualization. For example, if the total number of events, people, etc. is less than our threshold, we would apply the treatment to all circles, bars, etc. in that visualization.
So, in order to see the treatment you should for example in us-nd/narratives/prison/2
select Bismark Transition Center
filter instead of All Facilities
.
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.
Got it, thanks for clarifying! I missed that comment, I was relying on what was written in the PR description, could you update it? 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.
Had an issue trying to see hashed treatment for small numbers with your latest changes.
…into nasaownsky/480-small-numbers
{smallData && ( | ||
<TooltipTrigger maxWidth={232} contents={tenant?.smallDataDisclaimer}> | ||
<Icon kind={IconSVG.Info} width={16} height={16} /> | ||
</TooltipTrigger> | ||
)} |
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.
Hey, @macfarlandian! Is there any way to style the Tooltip when using TooltipTrigger from design-system?
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.
not the tooltip itself, no, only the contents ... it is a known issue that unfortunately the design of tooltip contents in Spotlight does not really work with the tooltip from the design system. Hasn't been much of an issue in Spotlight thus far because there were no tooltips outside of the charts, but if we are adding that use case here, maybe it's better to add this feature to the design system than to reimplement the component. I know @terryttsai has looked into this recently so curious what he thinks
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.
cc @terryttsai
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 remember that the public dashboard's tooltip is designed differently than the one in design-system. Originally I had a story to move our tooltip to the one in design-system but ran into the issue in that I couldn't style it to match our design. Might make sure to modify the design-system's tooltip so that it can be styled properly. Either that or continue to use our own tooltip in this codebase...
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.
@terryttsai @macfarlandian I think it would be nice if we can properly style the Tooltip from the design-system. Could you create an Issue for that?
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.
…into nasaownsky/480-small-numbers
Description of the change
Hi, @hobuobi! Glad to work with you again.
I implemented some of the expected behavior orienting on mocks, and it looks like this:
What do you think?
Also, I seen in the mocks such styling for line rate charts, but I don't quite understand how to filter values in them. In above examples we has values, that we can simply compare with threshold level, but line rate charts contains something like
101 of 246 (31%)
. I assume that I should use upper bound for comparing with threshold? Anyway, if you could give me more information, I would appreciate that.Type of change
Related issues
Closes #480
Checklists
Development
These boxes should be checked by the submitter prior to merging:
Code review
These boxes should be checked by reviewers prior to merging: