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

v2.1.0

Latest

Choose a tag to compare

@boygirl boygirl released this 15 Jan 21:39
· 28 commits to master since this release

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 getScale methods 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 of d3Scale.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 getDomain method 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 getData method in single data series components (VictoryScatter, VictoryLine)
  • replaces the consolidateData method in multi-series data components (VictoryBar)
  • replaces the createStringMap method 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 getRange and getPadding methods across all chart ecosystem components
  • replaces getStyle method in components that take style objects in the following form
style={{
  parent: {...},
  data: {...},
  labels: {...}
}}
  • replaces functional style and functional prop support methods evaluateProp and evaluateStyle across all chart components