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

feat(bullet-chart): Add the bullet-chart component #1061

Merged
merged 1 commit into from
May 30, 2018

Conversation

jeff-phillips-18
Copy link
Member

Adds the html/css implementation of
http://www.patternfly.org/pattern-library/data-visualization/bullet-chart/#design

Please not this was implemented to include patternfly/patternfly-design#662

Link to rawgit and/or image

https://rawgit.com/jeff-phillips-18/patternfly/bullet-chart-dist/dist/tests/bullet-charts.html

PR checklist (if relevant)

  • Cross browser: works in IE10
  • Cross browser: works in IE11
  • Cross browser: works in Edge
  • Cross browser: works in Chrome
  • Cross browser: works in Firefox
  • Cross browser: works in Safari
  • Cross browser: works in Opera
  • Responsive: works in extra small, small, medium and large view ports.
  • Preview the PR: An image or a URL for designer to preview this PR is provided.

@jeff-phillips-18
Copy link
Member Author

@serenamarie125

@jeff-phillips-18 jeff-phillips-18 requested a review from mcoker May 23, 2018 16:48
<div class="bullet-chart-pf-title-spacer"></div>
<div class="bullet-chart-pf-title-labels-container">
<div class="bullet-chart-pf-title">
Text Label</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a formatting thing, but the closing </div> could be moved to the next line to be consistent with the .bullet-chart-pf-title/.bullet-chart-pf-details block above. The above block and this one could also be changed so each <div>, the text and the closing </div> are on a single line to match the title/detail blocks below (or the title/detail blocks below could be expanded to 3 lines like this one and the block above)

@mcoker
Copy link
Contributor

mcoker commented May 23, 2018

I'm probably just out of the loop on this pattern, but why aren't the orange and red data lines included in the legend?

@jeff-phillips-18
Copy link
Member Author

I don't believe the thresholds are supposed to be represented in the legend. @serenamarie125 ?

Copy link
Member

@serenamarie125 serenamarie125 left a comment

Choose a reason for hiding this comment

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

@jeff-phillips-18 @michael-coker although the design documentation does show it in the legend by default, from a space perspective when utilizing a bullet chart, there won't be room for all of that in most situations. IMO, the default should just be to show the values & ranges in the legend. If people want to add the thresholds, they should be able to override.

@serenamarie125
Copy link
Member

@kybaker can you provide input on the legend spacing? I know there are conventions because we have legends in our charts, but can't seem to find any guidance on that

mcoker
mcoker previously approved these changes May 24, 2018
@jennyhaines
Copy link

@jeff-phillips-18 - I think everything about the design looks good, except the legend spacing (that @serenamarie125 mentioned.) Here are is the spacing that should be used:
chart_specs

  • The legend should be horizontally centered underneath the horizontal chart, and vertically centered to the right of vertical charts
  • There should not be strokes around each colored legend tile
  • There should be 7px of spacing between each corresponding tile and descriptor element within a pair
  • There should be 10px of spacing between each tile/descriptor pair
  • There should be 13px of spacing between the edge of the chart and the legend

@jeff-phillips-18
Copy link
Member Author

Updated to comments above. @jennyhaines please take another look.

@jennyhaines
Copy link

@jeff-phillips-18 - this looks perfect to me!

@jeff-phillips-18
Copy link
Member Author

@michael-coker @matthewcarleton Can you take another look now that the visuals are correct?

serenamarie125
serenamarie125 previously approved these changes May 25, 2018
Copy link
Member

@serenamarie125 serenamarie125 left a comment

Choose a reason for hiding this comment

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

LGTM!

@mcoker
Copy link
Contributor

mcoker commented May 25, 2018

@jeff-phillips-18 I'm assuming it's OK that the legend items wrap? And I see this...

.bullet-chart-pf-legend-item {
    display: inline-block;
    margin-right: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-wrap: normal;
}

But that item doesn't appear to overflow or show ellipses, it will just grow to match the content.

screen shot 2018-05-25 at 10 56 42 am

@jeff-phillips-18
Copy link
Member Author

Correct. We could add a max-width if we want to prevent it from getting too long. Thoughts?

@jeff-phillips-18
Copy link
Member Author

Checked with @serenamarie125 and @jennyhaines, will set a max-width of 150px.

@jeff-phillips-18
Copy link
Member Author

Updated, thanks!

@mcoker
Copy link
Contributor

mcoker commented May 25, 2018

The horizontal .bullet-chart-pf-legend is a block element with text-align: center; with <span> spacer elements set to display: none;, and the vertical layout is a flex column with spacers on either side that vertically center the .bullet-chart-pf-legend-item items.

What about making both the horizontal and vertical versions display: flex;, remove the spacers and use justify-content: center; to center the .bullet-chart-pf-legend-item items, and set the horizontal version to flex-wrap: wrap;?

serenamarie125
serenamarie125 previously approved these changes May 29, 2018
Copy link
Member

@serenamarie125 serenamarie125 left a comment

Choose a reason for hiding this comment

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

border-style: solid;
border-width: 10px;
height: 20px;
margin-left: -10px;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use transform: translateX(-50%); here just to avoid fixed units whenever possible. And change margin-left: 0; on the vertical CSS below to transform: translateX(0);

}

.bullet-chart-pf-value-dot {
border-radius: 10px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Use border-radius: 50%; to avoid fixed units whenever possible.

.bullet-chart-pf-value-dot {
border-radius: 10px;
border-style: solid;
border-width: 10px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason you're using border properties instead of background-color to define the dot color?

.bullet-chart-pf {
display: flex;
flex-direction: column;
width: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks unnecessary, the element should grow to fill the available space by default.

height: 20px;
margin: 20px 0;
position: relative;
width: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks unnecessary, the element should grow to fill the available space by default.

.bullet-chart-pf-legend {
margin-top: 7px;
text-align: center;
width: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

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

This (and width: initial; on the vertical version below) look unnecessary.

padding-right: 0;
text-align: center;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

To center this text relative to the chart (and not the axis below itchange this .bullet-chart-pf-title-labels-container block to this. Basically just create 25px of space at the bottom of the container to match the height of the axis row.

.bullet-chart-pf-title-labels-container {
    margin: 0 10px 25px 0;
    text-align: right;
    .bullet-chart-pf-vertical & {
        text-align: center;
        margin: 10px 0;
    }
}

<div class="bullet-chart-pf-details">Measure Details</div>
</div>
<!-- add this div to vertically center the titles -->
<div class="bullet-chart-pf-axis"></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this if you apply the CSS changes previously mentioned

<div class="bullet-chart-pf-details">Measure Details</div>
</div>
<!-- add this div to vertically center the titles -->
<div class="bullet-chart-pf-axis"></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

you can also remove this

@jeff-phillips-18
Copy link
Member Author

Updated. Thanks for the simplifications @michael-coker !

mcoker
mcoker previously approved these changes May 30, 2018
serenamarie125
serenamarie125 previously approved these changes May 30, 2018
@mcoker mcoker merged commit 4c69eb5 into patternfly:master May 30, 2018
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.

4 participants