Skip to content
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

Merged
merged 1 commit into from
May 22, 2024
Merged

Website | Gallery: Range plot #390

merged 1 commit into from
May 22, 2024

Conversation

lee00678
Copy link
Collaborator

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.

range-plot
range-plot-dark

@lee00678 lee00678 requested a review from reb-dev May 17, 2024 20:51
Copy link
Contributor

@rokotyan rokotyan left a 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 }
Copy link
Contributor

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 }
Copy link
Contributor

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 = {
Copy link
Contributor

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} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

@lee00678 lee00678 force-pushed the qian/lollipop-gallery branch from 709adac to 5eaef69 Compare May 20, 2024 23:41
Copy link
Collaborator

@reb-dev reb-dev left a 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.

Copy link
Collaborator

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 }
Copy link
Collaborator

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

@lee00678 lee00678 force-pushed the qian/lollipop-gallery branch from 5eaef69 to cb158d3 Compare May 21, 2024 19:15
@lee00678
Copy link
Collaborator Author

Thanks for the reviews!

@lee00678 lee00678 merged commit 3575025 into main May 22, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants