This repository was archived by the owner on Feb 19, 2022. It is now read-only.
This tag adds shared methods to VictoryUtil to reduce code repetition in all of the chart ecosystem components (VictoryChart, VictoryBar, VictoryAxis, VictoryLine, VictoryScatter)
Public methods added:
Scale
Scale.getBaseScale(props, axis)Scale.getScaleType(props, axis)Scale.getScaleFromProps(props, axis)Scale.getScaleTypeFromData(props, axis)
This collection of methods:
- replaces the
getScalemethods that were used in the chart ecosystem repos - adds scale type checking via duck typing d3 scale methods
- adds support for passing in the scale type as a string i.e.
"linear"instead ofd3Scale.linear()
Domain
Domain.getDomain(props, axis)Domain.getDomainFromProps(props, axis)Domain.getDomainFromData(dataset, axis)Domain.padDomain(domain, props, axis)
This collection of methods:
- replaces the
getDomainmethod in single data series components (VictoryScatter, VictoryLine) - Adds domain helpers for the more complicated components
Data
Data.getData(props)Data.consolidateData(props)Data.createStringMap(props, axis)Data.getStringsFromCategories(props, axis)Data.getStringsFromAxes(props, axis)Data.getStringsFromData(props, axis)Data.getStringsFromXY(props, axis)
This collection of methods:
- replaces the
getDatamethod in single data series components (VictoryScatter, VictoryLine) - replaces the
consolidateDatamethod in multi-series data components (VictoryBar) - replaces the
createStringMapmethod for components - adds string helpers for creating a shared stringMap in VictoryChart
Chart
getPadding(props)getRange(props, axis)getStyles(props, defaultStyles)evaluateProp(prop, data)evaluateStyle(style, data)
This collection of methods:
- replaces
getRangeandgetPaddingmethods across all chart ecosystem components - replaces
getStylemethod in components that take style objects in the following form
style={{
parent: {...},
data: {...},
labels: {...}
}}
- replaces functional style and functional prop support methods
evaluatePropandevaluateStyleacross all chart components