-
Notifications
You must be signed in to change notification settings - Fork 51
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
Website | Gallery: Range plot #390
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.
Thanks @lee00678! Agreed that it looks a little bit like a hack but it's still good to have an example of what's possible with Unovis.
Left you a few React-related comments
|
||
export default function RangePlot (): JSX.Element { | ||
const legendItems = [{ name: 'Women', color: '#FF6B7E' }, { name: 'Men', color: '#4D8CFD' }] | ||
const style: React.CSSProperties = { width: '100%', height: height } |
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.
Here
export default function RangePlot (): JSX.Element { | ||
const legendItems = [{ name: 'Women', color: '#FF6B7E' }, { name: 'Men', color: '#4D8CFD' }] | ||
const style: React.CSSProperties = { width: '100%', height: height } | ||
const styleAb: React.CSSProperties = { position: 'absolute', top: 0, left: 0, width: '100%', height: height } |
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.
Here
const legendItems = [{ name: 'Women', color: '#FF6B7E' }, { name: 'Men', color: '#4D8CFD' }] | ||
const style: React.CSSProperties = { width: '100%', height: height } | ||
const styleAb: React.CSSProperties = { position: 'absolute', top: 0, left: 0, width: '100%', height: height } | ||
const tooltipTriggers = { |
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.
Here
></VisScatter> | ||
|
||
<VisAxis type='x' numTicks={5} label={'Yearly Salary'} /> | ||
<VisAxis type='y' tickFormat={(_, i: number) => data[i].occupation} numTicks={data.length} gridLine={false} /> |
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.
And here
709adac
to
5eaef69
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.
I really like the look of this example!
My only qualm is in regard to the style declarations.
- The container width by default is 100%, I think we can just specify the height directly through the height property
- I don't think we need to make positions absolute or have additional stylings for the scatter components, they should look the same without them (please correct me if I'm mistaken or missing something)
Neither is a huge deal, but I feel like the less code we have in our examples, the better. So if we can get away with removing some excess variables that would be ideal.
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 file used anywhere?
const yScale = Scale.scalePoint([0, 800]).domain(data.map(d => d.occupation)) | ||
const lineData = processLineData(data) | ||
const legendItems = [{ name: 'Women', color: '#FF6B7E' }, { name: 'Men', color: '#4D8CFD' }] | ||
const style: React.CSSProperties = { width: '100%', height: height } |
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.
Same comment from the angular example above. I would remove in favor of template declaration
5eaef69
to
cb158d3
Compare
Thanks for the reviews! |
Added an example for range plot to the gallery as part of the composite chart section. I suppose this can be a separate component eventually. But since it can be done with the current components I figured it could be useful for people.
My approach was to use 2 scatter plots and a line chart. If there's a better approach I'm happy to update.