This repository has been archived by the owner on Feb 19, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@boygirl Sorry this is coming in late – I had an epiphany as I went to start this PR on Friday and wanted to get in some changes.
Purpose
This PR contains initial work for new primitive components to be introduced into
victory-core
–Box
andWhisker
. These components support the addition ofVictoryBoxPlot
invictory-chart
(see the PR invictory-chart
). These primitives are functional but by no means complete. More work needs to be done to ensure that they conform to the standards of othervictory-core
primitives. Tests also need to be written for these primitives. This branch should not be merged in its current state.Component Structure
These primitives correspond specifically to different portions of the
VictoryBoxPlot
component.Box
The
Box
component is intended to render arect
component for the first and third quartiles ofVictoryBoxPlot
(q1
andq3
). It accepts simple positioning and layoutprops
(x
,y
,width
,height
) in addition toCommonProps
and agroupComponent
prop. This is intended to make the component as flexible as possible, especially for reuse in a potential future library addition.Whisker
The
Whisker
component is intended to render a "crosshair" representing the minimum and maximum values for each datum passed toVictoryBoxPlot
(min
andmax
). It acceptsmajorWhisker
andminorWhisker
objects as props, withmajorWhisker
referring to the line drawn fromq1
-min
orq3
-max
andminorWhisker
referring to the line drawn atmin
ormax
. These objects containx1
,x2
,y1
,y2
,stroke
, andstrokeWidth
props.stroke
andstrokeWidth
correspond to the value ofwhiskerStyle
passed byVictoryBoxPlot
(this allows users to configurewhisker
styling directly via thoseprops
rather than viastyle
).Suggested Enhancements and Future Work
This component still requires several enhancements. These include:
shouldComponentUpdate
to reduce unnecessary re-renders.datum
prop. This would beq1
orq3
forBox
andmin
ormax
forWhisker
when used withVictoryBoxPlot
.style
prop with evaluation usingHelpers.evaluateStyle
.victory-native
support.VictoryBoxPlot
applieseventKeys
to the entire data structure{ _min, _max, _q1, _q3, _med }
, meaning that individual box plot components do not currently have their owneventKeys
.