-
Notifications
You must be signed in to change notification settings - Fork 88
Support for a wickStrokeWidth style prop #554
Conversation
@kale-stew based on your gist, I was expecting |
@@ -17,11 +17,13 @@ export default { | |||
const x = scale.x(datum._x1 !== undefined ? datum._x1 : datum._x); | |||
const y1 = scale.y(datum._high); | |||
const y2 = scale.y(datum._low); | |||
const highWick = scale.y(datum._close); |
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.
You can correct the issue you were seeing with wicks being rendered through candles if you change these to something like highWick = scale.y(Math.max(datum._open, datum._close))
@@ -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; |
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.
Unnecessary variable.
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, |
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.
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.
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.
Approved pending small change. This PR should not be merged until the corresponding victory-core
PR is merged and released.
const initialChildProps = { parent: { | ||
domain, scale, width, height, data, standalone, theme, polar, origin, | ||
style: style.parent, padding | ||
style: style.parent, padding, wickStrokeWidth |
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.
wickStrokeWidth
is not needed as a prop on parent
Merge after |
Overview
Supply a
wickStrokeWidth
value to see a difference between the candle's stroke width and the wick's stroke width.When supplied a
wickStrokeWidth
without a separatestrokeWidth
assignment, the candlestick will fallback to thewickStrokeWidth
for the candle'sstrokeWidth
.Prerequisite PR in victory-core here.
Example
renders this chart:
Original Issue:
Victory Issue #886