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(charts): add remaining variables #1863

Merged
merged 18 commits into from
Jun 21, 2019

Conversation

christiemolloy
Copy link
Member

@christiemolloy christiemolloy commented May 28, 2019

closes #1723

This Pull Request is for the remaining variables for Charts. I spoke to @dlabrecq and these vars should be specific to the chart variations which I followed here . @gdoyle1 could you review to check that I properly covered the variables here ?

@patternfly-build
Copy link

patternfly-build commented May 28, 2019

Deploy preview for pf-next ready!

Built with commit 1951dbb

https://deploy-preview-1863--pf-next.netlify.com

@gdoyle1
Copy link

gdoyle1 commented May 28, 2019

Looks good! @christiemolloy

$pf-chart-chart--BorderWidth: 1px;

// Donut Chart
$pf-chart-donut-color-threshold-large: $pf-color-black-200;
Copy link
Member Author

Choose a reason for hiding this comment

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

@dlabrecq donut colors weren't on theme-victory.js do you want them included here?

$pf-chart-boxplot-box--Width: 20px;

// Bullet Chart
$pf-chart-bullet--comparative-measure-line-warning--BorderColor: $pf-color-orange-300;
Copy link
Member Author

Choose a reason for hiding this comment

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

@dlabrecq bullet chart colors and Borders weren't on theme-victory.js do you want them included here?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, please.

We will have a separate theme files for bullet chart, donut, and the new donut utilization charts below. However, we still need the vars to use with the components.

The props for the donut chart can be found here:
https://github.com/patternfly/patternfly-react/blob/master/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/theme-donut.js

The props for the donut utilization chart are here:
https://github.com/patternfly/patternfly-react/blob/master/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/theme-donut-utilization.js

The props for the new donut utilization chart with static thresholds are here:
https://github.com/patternfly/patternfly-react/blob/master/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/theme-donut-threshold.js

Copy link
Member Author

@christiemolloy christiemolloy May 30, 2019

Choose a reason for hiding this comment

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

@dlabrecq
Updated based on these files. Some questions.

  • In pie chart, what is padAngle?

  • Those font sizes should be 14 and 24 instead of 16 and 26, so they relate to the global font sizes

  • Do you need a variable for: orientation: vertical?

  • inside of the donut key value pairs, is "pie". Do those variables relate to pie or donut? I've seen the same height/width of 230 be used under pie but in the pie variation and in the pie inside of donut.

Copy link
Member

Choose a reason for hiding this comment

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

padAngle is the space between the pie (i.e., dount) chart segments. This is an example with padAngle=1, which looks like 3 pixels in the design.

Screen Shot 2019-05-30 at 11 48 36 AM

Copy link
Member

Choose a reason for hiding this comment

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

pie and donut are separate components, but Victory only supports pie charts. When creating a donut theme, we merge the donut properties on top of the pie properties. That gives us the look of the donut, but it's actually a pie chart.

Copy link
Member

Choose a reason for hiding this comment

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

The legend component has a default orientation, so probably not necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense about pie and donut, and since only colors are defined for donut it keeps the properties of the pie separate.

Also I see in the material.js theme that the legend has an orientation of 'vertical' which is different to the victory file where the legend has an orientation of 'horizontal', so i think ill keep it in there for now?

$pf-chart-bar--Width: 10px;

// Box Plot Chart
$pf-chart-boxplot-max--Padding: $pf-global--spacer--sm;
Copy link
Member Author

Choose a reason for hiding this comment

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

@mcoker I repeat alot of variables that have the same value here, just want to be cautious in case they change what are your thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

I'll defer to @mcoker, but if we have separate vars for each component, then devs can override properties for just that one chart component. That is, without changing properties for all charts.

Copy link
Contributor

Choose a reason for hiding this comment

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

@dlabrecq agreed.

src/patternfly/patternfly-charts.scss Outdated Show resolved Hide resolved
src/patternfly/patternfly-charts.scss Outdated Show resolved Hide resolved


// typography
$pf-chart-global--FontSize: $pf-global--FontSize--sm;
Copy link
Member Author

Choose a reason for hiding this comment

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

@mcoker do I need to pull in the Red Hat Font to these style sheet?

Copy link
Member Author

Choose a reason for hiding this comment

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

@mcoker not sure if you missed this comment :)


// Area Chart
$pf-chart-area--Opacity: .4;
$pf-chart-area-stroke--Width: 2px;
Copy link
Member Author

Choose a reason for hiding this comment

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

@mcoker im not sure whether to break stroke width into two words or not

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine, though I think we should follow the same general formula we do for other global vars and use $pf-chart-area--stroke--Width. Though what is the "stroke" width? Is that the same as a border?

Copy link
Member Author

@christiemolloy christiemolloy May 30, 2019

Choose a reason for hiding this comment

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

Thats the thing I was debating. @dlabrecq do you know if stroke width is different from border width, if so @mcoker I thought it was more of a concept rather than a property.

Copy link
Member Author

Choose a reason for hiding this comment

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

i.e. here there is a stroke width and a border width?

Screen Shot 2019-05-30 at 11 27 41 AM

Copy link
Member

Choose a reason for hiding this comment

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

Yes, they are different.

$pf-chart-candelstick-data-stroke--Width: 1px;

// Chart
$pf-chart-chart--BorderWidth: 1px;
Copy link
Member Author

Choose a reason for hiding this comment

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

Should the "chart" variation of charts be defined globally? or is it actually a variation @dlabrecq

Copy link
Member

Choose a reason for hiding this comment

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

Chart is a separate component. Basically it's a container which can be used with any chart to provide default functionality like a border, x and y axes, etc.

Copy link
Member

Choose a reason for hiding this comment

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

FYI, the border is currently border: 1px solid. Do we have solid defined anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

@dlabrecq when we usually define vars we wouldn't do one for solid, but this makes sense since its the only css defined for use in the victory charts

Copy link
Member

Choose a reason for hiding this comment

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

They could also be separate vars and we concatinate them in the Victory theme?

Copy link
Member Author

@christiemolloy christiemolloy May 30, 2019

Choose a reason for hiding this comment

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

@mcoker what do you think? borders by default are solid right. Across the system I see alot of border widths without the 'solid'. I'm not sure if the solid is necessary.

Copy link
Member

Choose a reason for hiding this comment

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

The only border I see in the Victory themes is for the Chart component -- not including borderWidth props. Keep in mind that these are SVGs, not CSS props.


// Donut Chart
$pf-chart-donut-color-threshold-large: $pf-color-black-200;
$pf-chart-donut-color-threshold-medium: $pf-color-black-300;
Copy link
Member Author

Choose a reason for hiding this comment

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

@gdoyle1 does small/med/large work here for naming?

Copy link

Choose a reason for hiding this comment

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

first/second/third thresholds



// typography
$pf-chart-global--FontSize: $pf-global--FontSize--sm;
Copy link

@gdoyle1 gdoyle1 May 28, 2019

Choose a reason for hiding this comment

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

axis labels and scale values should be 12px

Copy link

Choose a reason for hiding this comment

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

for donut charts with the a single label in the middle representing data value, should be 24px

Copy link

Choose a reason for hiding this comment

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

legend should be using 14px text

Copy link
Member

@dlabrecq dlabrecq left a comment

Choose a reason for hiding this comment

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

This is a good start. We need a few more props, tho.

Note that we cannot consume rem props, like the global spacers -- must be in pixels.

Likewise, we cannot consume props defined with px strings. For example, 100px must be 100.

If we must define vars as 100px, we will need to discuss how the charts will consume that.

src/patternfly/patternfly-charts.scss Outdated Show resolved Hide resolved
// typography
$pf-chart-global--FontSize--xs: $pf-global--FontSize--xs; // Axis Labels
$pf-chart-global--FontSize--sm: $pf-global--FontSize--sm; // For Legend
$pf-chart-global--FontSize--2xl: $pf-global--FontSize--2xl; // For Large Numbers
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to have a var for the chart font family? This is currently hard coded as global_FontFamily_sans_serif.value

Copy link
Member Author

Choose a reason for hiding this comment

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

I tagged @mcoker about this as I'm not sure the best way to import the new font family

Copy link
Contributor

Choose a reason for hiding this comment

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

I think so. Seems like we would want the chart theme to only use $pf-chart vars? Then it allows us the flexibility in the future to deviate from core by simply updating the variable value, instead of also needing to update the react chart theme code.

$pf-chart-boxplot-box--Width: 20px;

// Bullet Chart
$pf-chart-bullet--comparative-measure-line-warning--BorderColor: $pf-color-orange-300;
Copy link
Member

Choose a reason for hiding this comment

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

Yes, please.

We will have a separate theme files for bullet chart, donut, and the new donut utilization charts below. However, we still need the vars to use with the components.

The props for the donut chart can be found here:
https://github.com/patternfly/patternfly-react/blob/master/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/theme-donut.js

The props for the donut utilization chart are here:
https://github.com/patternfly/patternfly-react/blob/master/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/theme-donut-utilization.js

The props for the new donut utilization chart with static thresholds are here:
https://github.com/patternfly/patternfly-react/blob/master/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/theme-donut-threshold.js

$pf-chart-candelstick-data-stroke--Width: 1px;

// Chart
$pf-chart-chart--BorderWidth: 1px;
Copy link
Member

Choose a reason for hiding this comment

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

Chart is a separate component. Basically it's a container which can be used with any chart to provide default functionality like a border, x and y axes, etc.

$pf-chart-candelstick-data-stroke--Width: 1px;

// Chart
$pf-chart-chart--BorderWidth: 1px;
Copy link
Member

Choose a reason for hiding this comment

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

FYI, the border is currently border: 1px solid. Do we have solid defined anywhere?


// Line Chart
$pf-chart-line-stroke--Width: 2px;

Copy link
Member

Choose a reason for hiding this comment

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

I noticed that there are some properties that are not defined in victory-theme.js. Apparently, we're getting some defaults by relying on the Victory grayscale theme. However, we probably want to add our own vars. For example, line chart can have these props:

Screen Shot 2019-05-29 at 11 32 42 AM

Victory has a grayscale.js theme, which shows the other available props. For example, line can have fill, stroke, strokeWidth, etc.
https://github.com/FormidableLabs/victory/blob/master/packages/victory-core/src/victory-theme/grayscale.js

Victory also has a material.js theme which uses some props that are not listed in grayscale.js. For example, this theme defines an opacity for line chart.
https://github.com/FormidableLabs/victory/blob/master/packages/victory-core/src/victory-theme/material.js
https://github.com/FormidableLabs/victory/blob/master/packages/victory-core/src/victory-theme/material.js

Copy link
Member Author

Choose a reason for hiding this comment

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

Added in the remaining properties from both of those files


// Pie Chart
$pf-chart-pie--Padding: $pf-global--spacer--sm;
$pf-chart-pie-data-Padding: $pf-global--spacer--sm;
Copy link
Member

Choose a reason for hiding this comment

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

I don't believe we can use rem values here. This must be pixels. For example, the donut relies on this being 8px.

$pf-chart-pie--Width: 230px;

// Scatter Chart
$pf-chart-stack-data-stroke--Width: 1px;
Copy link
Member

Choose a reason for hiding this comment

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

The scatter chart currently has strokeWidth set to 0 and stroke as transparent

// Tooltip
$pf-chart-tooltip-pointer--Height: 10px; // this is equivalent to length
$pf-chart-tooltip-pointer--Width: 20px;
$pf-chart-tooltip--Padding: $pf-global--spacer--md;
Copy link
Member

Choose a reason for hiding this comment

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

The tooltip has a bunch of important props that effect the styling. For example, cornerRadius, strokeWidth, padding, etc.

Screen Shot 2019-05-29 at 11 47 37 AM


// Voronoi Chart
$pf-chart-voronoi-label--Padding: $pf-global--spacer--sm;
$pf-chart-voronoi-flyout-stroke--Width: 1px;
Copy link
Member

Choose a reason for hiding this comment

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

Missing a few important props here. For example, padding, strokeWdith, etc., which are different than the flyout tooltip styles

Screen Shot 2019-05-29 at 11 50 49 AM

$pf-chart-area-stroke--Width: 2px;

// Axis Chart
$pf-chart-axis-axis-stroke--Width: 1px;
Copy link
Contributor

Choose a reason for hiding this comment

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

why is axis in the var name twice?

Copy link
Member Author

Choose a reason for hiding this comment

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

It refers to the axis within the axis variation of the chart, it was for consistency:
Screen Shot 2019-05-30 at 3 17 40 PM


// Box Plot Chart
$pf-chart-boxplot-max--Padding: $pf-global--spacer--sm;
$pf-chart-boxplot-max-stroke--Width: 1px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to my other comment https://github.com/patternfly/patternfly-next/pull/1863/files#r288707836

I think the prefix should be $pf-chart-global or $pf-chart-boxplot followed by --concept (or thing you're styling) followed by --modifier (if applicable), followed by --PropertyCamelCase

So this would become

$pf-chart-boxplot--max--stroke--Width
$pf-chart-boxplot--median--stroke--Width
$pf-chart-boxplot--min--stroke--Width
etc...

Copy link
Member Author

Choose a reason for hiding this comment

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

Tried to follow this throughout the doc, but it would be great if you could double check the changes

$pf-chart-boxplot-min--Padding: $pf-global--spacer--sm;
$pf-chart-boxplot-min-stroke--Width: 1px;
$pf-chart-boxplot-q1--Padding: $pf-global--spacer--sm;
$pf-chart-boxplot-q3--Padding: $pf-global--spacer--sm;
Copy link
Contributor

Choose a reason for hiding this comment

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

what do q1 and q3 represent?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

These are Victory BoxPlot component properties. You can read about them here: https://formidable.com/open-source/victory/docs/victory-box-plot#q1


// Bullet Chart
$pf-chart-bullet--comparative-measure-line-warning--BorderColor: $pf-color-orange-300;
$pf-chart-bullet--comparative-measure-line-warning--BorderWidth: 1px;
Copy link
Contributor

Choose a reason for hiding this comment

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

in this line and the ones below "warning" and "error" are states, so there should be 2 hyphens before that text.

$pf-chart-bullet--negative-primary-measure--BorderWidth: 2px;

// Candlestick
$pf-chart-candelstick-data-stroke--Width: 1px;
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be $pf-chart-candelstick--data--stroke--Width?

$pf-chart-chart--BorderWidth: 1px;

// Donut Chart
$pf-chart-donut-color-threshold-first: $pf-color-black-200;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be $pf-chart-donut--threshold--first--Color?

$pf-chart-tooltip--pointerLength: 10; // grayscale theme
$pf-chart-tooltip--flyoutStyle--cornerRadius: 0;
$pf-chart-tooltip--flyoutStyle--stroke--Width: 0; // this is 1 in grayscale theme
$pf-chart-tooltip--flyoutStyle--pointerEvents: "none";
Copy link
Contributor

Choose a reason for hiding this comment

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

pointer-events is a property name, so you could call this PointerEvents

// Tooltip
$pf-chart-tooltip--cornerRadius: 0; // this is 5 in grayscale theme
$pf-chart-tooltip--pointerLength: 10; // grayscale theme
$pf-chart-tooltip--flyoutStyle--cornerRadius: 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we just hyphenate names that aren't CSS properties? so this would be corner-radius. Also could we use BorderRadius here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated all names that aren't CSS properties to have hyphens.

@dlabrecq do you know if corner radius and border radius are the same things?

Copy link
Member

Choose a reason for hiding this comment

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

corner radius is different than border. For example, we want the cornerRadius=0 so our tooltip boxes look be square.

$pf-chart-tooltip--pointer--Height: 10; // this is equivalent to length
$pf-chart-tooltip--pointer--Width: 20;
$pf-chart-tooltip--Padding: 16;
$pf-chart-tooltip--pointerEvents: "none";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$pf-chart-tooltip--pointerEvents: "none";
$pf-chart-tooltip--PointerEvents: "none";

$pf-chart-tooltip--Padding: 16;
$pf-chart-tooltip--pointerEvents: "none";
$pf-chart-tooltip--labels--Padding: 5; // grayscale theme
$pf-chart-tooltip--labels--pointerEvents: "none"; // grayscale theme
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$pf-chart-tooltip--labels--pointerEvents: "none"; // grayscale theme
$pf-chart-tooltip--labels--PointerEvents: "none"; // grayscale theme

$pf-chart-voronoi--data--stroke--Color: transparent;
$pf-chart-voronoi--data--stroke--Width: 0;
$pf-chart-voronoi--labels--Padding: 8; // this is 5 in grayscale theme
$pf-chart-voronoi--labels--pointerEvents: "none";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$pf-chart-voronoi--labels--pointerEvents: "none";
$pf-chart-voronoi--labels--PointerEvents: "none";

$pf-chart-voronoi--labels--Padding: 8; // this is 5 in grayscale theme
$pf-chart-voronoi--labels--pointerEvents: "none";
$pf-chart-voronoi--flyout--stroke--Width: 1;
$pf-chart-voronoi--flyout--pointerEvents: "none";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$pf-chart-voronoi--flyout--pointerEvents: "none";
$pf-chart-voronoi--flyout--PointerEvents: "none";

$pf-chart-voronoi--flyout--pointerEvents: "none";
$pf-chart-voronoi--flyout--stroke--Color: "charcoal";
$pf-chart-voronoi--flyout--stroke--BackgroundColor: #f0f0f0;
$pf-chart-voronoi--flyout--pointerEvents: "none";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$pf-chart-voronoi--flyout--pointerEvents: "none";
$pf-chart-voronoi--flyout--PointerEvents: "none";

$pf-chart-axis--grid--BackgroundColor: transparent; // is transparent ok for none?
$pf-chart-axis--grid--stroke--Color: "blueGrey50"; // material theme
$pf-chart-axis--grid--BorderColor: transparent;
$pf-chart-axis--grid--pointerEvents: "painted";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$pf-chart-axis--grid--pointerEvents: "painted";
$pf-chart-axis--grid--PointerEvents: "painted";

@christiemolloy
Copy link
Member Author

@gdoyle1 there are two themes , one called grayscale and one called material. Right now we are relying on them so we want to use the same props that they include. Could you take a look at: https://github.com/FormidableLabs/victory/blob/master/packages/victory-core/src/victory-theme/grayscale.js and when you see the assignments at the top of the file could you take a look at these colors and let me know what they "should" represent in our color system.

  • there are 7 colors in the 'color' array --> what should these represent, the grey chart family?
  • what should 'charcoal' represent?
  • what should 'grey' represent?

I believe we will also need a conversion for the Material.js theme :) https://github.com/FormidableLabs/victory/blob/master/packages/victory-core/src/victory-theme/material.js

$pf-chart-boxplot--min--Padding: 8;
$pf-chart-boxplot--min--stroke--Width: 1;
$pf-chart-boxplot--min--stroke--Color: "charcoal"; // grayscale theme
$pf-chart-boxplot--q1--Padding: 8;
Copy link
Contributor

Choose a reason for hiding this comment

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

Lost the previous comment. @dlabrecq you pointed me here but I'm still not sure what q1 is :) I'm just curious if we can give a more accessible name/description for that var instead of something that's victory specific.

Copy link
Member Author

Choose a reason for hiding this comment

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

q1 means Lower Quartile and q3 means Upper Quartile, basically the beginning and end of the median.

@gdoyle1
Copy link

gdoyle1 commented May 31, 2019

@christiemolloy Regarding the material color replacements, see here!
colors
#F5C12E should be #F0AB00

@mcoker
Copy link
Contributor

mcoker commented Jun 17, 2019

@dlabrecq I'd like to review it again. I'll do that after lunch today.

@@ -30,7 +30,7 @@ import docs from '../docs/code.md';

export const Docs = docs;

export default (props) => {
export default props => {
Copy link
Contributor

@mcoker mcoker Jun 17, 2019

Choose a reason for hiding this comment

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

did you mean to commit this?

@redallen do you know if the parentheses are necessary? Looks like every component/layout has them except for

marvin:patternfly-next cmichael$ grep -ri 'export default' src/ | grep props | grep -v '(props)'
src//patternfly/components/Alert/examples/index.js:export default props => {
src//patternfly/components/AppLauncher/examples/index.js:export default props => {
src//patternfly/components/NotificationBadge/examples/index.js:export default props => {
src//patternfly/components/AlertGroup/examples/index.js:export default props => {

@mcoker
Copy link
Contributor

mcoker commented Jun 17, 2019

  • we use danger and error in the var names, and values for each in the other's namespace - should we normalize and use one or the other or do they represent different things?

  • should we have vars for stroke/border width? (1 & 2 mostly it seems)

  • should we have vars for padding/gutter (or just spacer like core)? (1, 8, 10, 16, 20, maybe 50?)

    • I don't want to get us into a situation where if we introduce a new var, it messes up the naming. For example, if $spacer-1: 1; $spacer-2: 8; and we add a new one as "6", what var do we call it? Do we have the concept of a "spacer system" here?
  • we use "230" for pie height/width in multiple spots - should that be a var?

  • does $pf-chart-global--layout--Height and $pf-chart-global--layout--Width need to be a var since we don't define height/width anywhere else (except maybe pie above)? Or should we create a var for all of the chart width/heights if they apply?

  • in this block below, we don't normally name the concept var by the color var it represents. That kinda defeats the purpose - if we change one of the "fill" vars to a different color, we wouldn't want to have to rename the fill var. Do we have a fill (looks like this is also used for stroke) color system, where we would have Fill--Color--100, Fill--Color--200, etc, similar to how we have other vars defined like that (ie, $pf-chart-global--warning--Color--100, $pf-chart-global--warning--Color--200, etc)

$pf-chart-global--Fill--Color--900: $pf-color-black-900;
$pf-chart-global--Fill--Color--700: $pf-color-black-700;
$pf-chart-global--Fill--Color--500: $pf-color-black-500;
$pf-chart-global--Fill--Color--400: $pf-color-black-400;
$pf-chart-global--Fill--Color--300: $pf-color-black-300;
$pf-chart-global--Fill--Color--200: $pf-color-black-200;
$pf-chart-global--Fill--Color--white: $pf-color-white;

@christiemolloy
Copy link
Member Author

@dlabrecq could you provide some insight here. The layout vars are used in alot of charts right so they should stay global? or could it be moved to under the globals like the legend/axis? I think what @mcoker is saying is that we declare it at the top of the file but its not used in each chart type

does $pf-chart-global--layout--Height and $pf-chart-global--layout--Width need to be a var since we don't define height/width anywhere else (except maybe pie above)? Or should we create a var for all of the chart width/heights if they apply?

@christiemolloy
Copy link
Member Author

@mcoker I hadn't done that yet because I wasn't sure how extensive the system will get. @gdoyle1 @dlabrecq do you know if we expect to add more colors to these fill colors or is this set ?

in this block below, we don't normally name the concept var by the color var it represents. That kinda defeats the purpose - if we change one of the "fill" vars to a different color, we wouldn't want to have to rename the fill var. Do we have a fill (looks like this is also used for stroke) color system, where we would have Fill--Color--100, Fill--Color--200, etc, similar to how we have other vars defined like that (ie, $pf-chart-global--warning--Color--100, $pf-chart-global--warning--Color--200, etc)

$pf-chart-global--Fill--Color--900: $pf-color-black-900;
$pf-chart-global--Fill--Color--700: $pf-color-black-700;
$pf-chart-global--Fill--Color--500: $pf-color-black-500;
$pf-chart-global--Fill--Color--400: $pf-color-black-400;
$pf-chart-global--Fill--Color--300: $pf-color-black-300;
$pf-chart-global--Fill--Color--200: $pf-color-black-200;
$pf-chart-global--Fill--Color--white: $pf-color-white;

@christiemolloy
Copy link
Member Author

@mcoker I don't think 230 should be a variable because pies/donuts overlap anyway so that seems clear .

@christiemolloy
Copy link
Member Author

@dlabrecq @gdoyle1 what do you think about using a spacer system here for padding? The values in the charts seem very much component specific, I can't see the use of a global spacer system here really. IMO I see a spacer system using a value set that has a pattern to how it increments.

should we have vars for padding/gutter (or just spacer like core)? (1, 8, 10, 16, 20, maybe 50?)

I don't want to get us into a situation where if we introduce a new var, it messes up the naming. For example, if $spacer-1: 1; $spacer-2: 8; and we add a new one as "6", what var do we call it? Do we have the concept of a "spacer system" here?

@christiemolloy
Copy link
Member Author

@gdoyle1 @dlabrecq do you know if error and danger are the same thing?

@mcoker
Copy link
Contributor

mcoker commented Jun 17, 2019

The layout vars are used in alot of charts right so they should stay global?

Ah ok that makes sense.

I don't think 230 should be a variable because pies/donuts overlap anyway so that seems clear .

I just mean that the width/height 230 pair is defined in 4 spots, so seems easier to maintain if that's a common var instead of hardcoded in each place, as long as we want those to display consistently.

For example, this...

$pf-chart-donut--pie--Height: 230;
$pf-chart-donut--pie--Width: 230;
$pf-chart-donut--threshold--static--pie--Height: 230;
$pf-chart-donut--threshold--static--pie--Width: 230;
$pf-chart-donut--utilization--dynamic--pie--Height: 230;
$pf-chart-donut--utilization--dynamic--pie--Width: 230;
$pf-chart-pie--Height: 230;
$pf-chart-pie--Width: 230;

could become....

$pf-chart-donut--pie--Height: 230;
$pf-chart-donut--pie--Width: 230;
$pf-chart-donut--threshold--static--pie--Height: $pf-chart-donut--pie--Height;
$pf-chart-donut--threshold--static--pie--Width: $pf-chart-donut--pie--Width;
$pf-chart-donut--utilization--dynamic--pie--Height: $pf-chart-donut--pie--Height
$pf-chart-donut--utilization--dynamic--pie--Width: $pf-chart-donut--pie--Width;
$pf-chart-pie--Height: $pf-chart-donut--pie--Height;
$pf-chart-pie--Width: $pf-chart-donut--pie--Width;

@gdoyle1
Copy link

gdoyle1 commented Jun 17, 2019

@christiemolloy Danger and error are the same, yes - I think more products are using "error" now instead of danger. I think a spacer system would be a good thing to look into making for charts. @mceledonia did you picture using the same number system as we have for our other spacers or a different incremental order? I'm not 100% sure about the colors thing although I don't see more colors being added to the chart colors. @mceledonia would you agree?

@mceledonia
Copy link

@gdoyle1 yeah I think we can use the same spacer system. I used it when designing the charts, but I have a feeling it will really only come into play for padding of things like axis labels and such. Whether or not it makes sense on the dev side to do that, I'm not confident enough to give an answer there..

@dlabrecq
Copy link
Member

dlabrecq commented Jun 18, 2019

The 230px value is common to donut and donut utilization and donut threshold. However, they are separate components. I don't know that they should share a global variable simply because there is a similar value? Ideally, all components should have their own vars, but will defer to @mcoker.

@dlabrecq
Copy link
Member

dlabrecq commented Jun 18, 2019

It's my understanding that the layout vars (font, family, etc.) are global because they are expected to remain consistent for all. Although, they're not necessarily used by all components; for example, legend, pie, tooltip -- maybe deeper in the style props? It's your call as to whether these particular vars are global.

I don't feel strongly about the layout props, but padding may be specific to each component. In that case, we could override.

I don't know if using a global spacer system here is best for charts. Although, perhaps we can speak more about what that means?

We have specific 50px padding for the chart axis, while bar width is 10px. The legend also has a gutter of 20px, which probably should be 10px, IMO. Other than that, we have a few places where we use a padding of 8px (label margin) and 16px (legend margin). Forcing all that to fit in our spacer system may not be ideal?

I'd be leery of changing any properties unless we see what it looks like in the charts, first. Due to the scale of the SVG, you may not get an exact pixel match (e.g., padAngle=1 looks a lot wider when rendered).

@dlabrecq
Copy link
Member

dlabrecq commented Jun 18, 2019

$pf-chart-global--layout--Height and $pf-chart-global--layout--Width apply to all charts as a default height and width. However, donuts don't need to be that large, so we override that.

I would like to continue with separate vars for padding/gutter and stroke/border width. Although they may share a similar value, these properties have very different effects on charts -- they are not the same.

@christiemolloy
Copy link
Member Author

  • If error and danger are the same do I need to make a new global variable for error?
  • I added vars for stroke and border width but kept them separate
  • I agree with @dlabrecq when he said that we shouldn't change the spacers until he tests it in React

@mcoker what do you think

@mcoker
Copy link
Contributor

mcoker commented Jun 19, 2019

If error and danger are the same do I need to make a new global variable for error?

I think what you have now is fine. We use danger in the global color var names, which matches core. And I'm assuming the use of danger and error in the chart specific vars matches the theme properties.

I added vars for stroke and border width but kept them separate

Did you push those changes up? I don't see them.

I agree with @dlabrecq when he said that we shouldn't change the spacers until he tests it in React

👍

@christiemolloy
Copy link
Member Author

@mcoker here is the change: 9ee4958 I must not have pushed it up

@mcoker
Copy link
Contributor

mcoker commented Jun 20, 2019

@christiemolloy lgtm!

Looks like you missed one:

$pf-chart-area--stroke--Width: 2;

And I'm not sure what this is - would it apply as a stroke/border, too? Or is it something else?

$pf-chart-bullet--threshold-error--Width: 2;

@christiemolloy
Copy link
Member Author

Updated! $pf-chart-bullet--threshold-error--Width: 2; is just a width not a stroke or border.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Great work on this!!! 🎉

@christiemolloy
Copy link
Member Author

@dlabrecq and @mcoker can you re-approve this PR, I just added the files from _chart-globals.scss to patternfly-charts.scss

--pf-chart-line--data--Fill: #{$pf-chart-line--data--Fill};
--pf-chart-line--data--Opacity: #{$pf-chart-line--data--Opacity};
--pf-chart-line--data--stroke--Width: #{$pf-chart-line--data--stroke--Width};
--pf-chart-line--data--stroke--Color: #{$pf-chart-global--Fill--Color--900};
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--pf-chart-line--data--stroke--Color: #{$pf-chart-global--Fill--Color--900};
--pf-chart-line--data--stroke--Color: #{$pf-chart-line--data--stroke--Color};

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

👍

@mcoker mcoker merged commit b2e003d into patternfly:master Jun 21, 2019
@patternfly-build
Copy link

🎉 This PR is included in version 2.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

7 participants