Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Support for a wickStrokeWidth style prop #554

Merged
merged 8 commits into from
Feb 5, 2018
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/components/victory-candlestick/helper-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export default {
props = Helpers.modifyProps(props, fallbackProps, "candlestick");
const calculatedValues = this.getCalculatedValues(props);
const { data, style, scale, domain, origin } = calculatedValues;
const { groupComponent, width, height, padding, standalone, theme, polar } = props;
const { groupComponent, width, height, padding, standalone, theme, polar, wickStrokeWidth } = props;
const initialChildProps = { parent: {
domain, scale, width, height, data, standalone, theme, polar, origin,
style: style.parent, padding
style: style.parent, padding, wickStrokeWidth
Copy link
Contributor

Choose a reason for hiding this comment

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

wickStrokeWidth is not needed as a prop on parent

} };

return data.reduce((childProps, datum, index) => {
Expand All @@ -19,10 +19,12 @@ export default {
const y2 = scale.y(datum._low);
const candleHeight = Math.abs(scale.y(datum._open) - scale.y(datum._close));
const y = scale.y(Math.max(datum._open, datum._close));
const highWick = y;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary variable.

const lowWick = scale.y(Math.min(datum._open, datum._close));
const dataStyle = this.getDataStyles(datum, style.data, props);
const dataProps = {
x, y, y1, y2, candleHeight, scale, data, datum, groupComponent,
index, style: dataStyle, padding, width, polar, origin
x, y, y1, y2, candleHeight, scale, data, datum, groupComponent, highWick, lowWick,
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at this now, and thinking about how you'll actually be using these props, I think it would be nice to refactor the props that get supplied to Candle. Rather than x, y, y1, y2, I think it makes sense to call these variables x high, low, open, close. I think they will be easier to work with that way, and make more sense to users who want to write custom candle components.

index, style: dataStyle, padding, width, polar, origin, wickStrokeWidth
};

childProps[eventKey] = {
Expand Down