Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency victory to v36 #17

Merged
merged 3 commits into from
Mar 7, 2024

Conversation

mend-for-github-com[bot]
Copy link

This PR contains the following updates:

Package Type Update Change
victory (source) dependencies major ^0.25.6 -> ^36.0.0

By merging this PR, the below vulnerabilities will be automatically resolved:

Severity CVSS Score CVE
High High 7.5 WS-2022-0322

Release Notes

FormidableLabs/victory (victory)

v36.0.0

Compare Source

  • #​1940 - Refactor VictoryChart, VictoryGroup and VictoryStack to take advantage of React.memo.

v35.11.4

Compare Source

v35.11.3

Compare Source

v35.11.2

Compare Source

v35.11.0

Compare Source

  • #​1940 - Refactor VictoryChart, VictoryGroup and VictoryStack to take advantage of React.memo.

v35.10.1

Compare Source

  • #​1933 - Remove invalid this references
  • #​1926 - Use less verbose import / export syntax

v35.10.0

Compare Source

  • #​1910 & #​1920 - Upgrade to Webpack 5
  • #​1915 - Add React as a peerDependency for all Victory packages
  • #​1907 - Replace default exports with individual exports and namespaced imports
  • #​1913 - Add optional rx and ry types to the primitive props interface. Thanks @​Wesleyzxc!

v35.9.3

Compare Source

  • #​1912 - Adds a more thorough check before calculating barWidth for grouped / stacked charts. Thanks @​WaysToGo!

v35.9.2

Compare Source

  • #​1908 - Fixes a bug with barWidth calculation for stacked / grouped bar charts.

v35.9.1

Compare Source

v35.9.0

Compare Source

Adds a new disableInlineStyles prop to components and primitives to support users who want to style their components by class, or use a CSS in JS solution like styled-components

When the new disableInlineStyles prop is supplied to a component like VictoryBar no styles will be supplied to either data or label components that it renders:

const StyledBar = styled(Bar)`
  fill: purple;
`;
const StyledLabel = styled(VictoryLabel)`
  tspan {
    fill: magenta;
    font-family: Papyrus, fantasy;
  }
`;
function CustomStyledBarChart() {
  return (
    <VictoryChart>
      <VictoryBar
        disableInlineStyles
        labels={[1, 2, 3, 4]}
        dataComponent={<StyledBar />}
        labelComponent={<StyledLabel />}
      />
    </VictoryChart>
  );
}

The disableInlineStyles prop may also be supplied to primitive components for more granular control:

const StyledBar = styled(Bar)`
  fill: purple;
`;
function CustomStyledBarChart() {
  return (
    <VictoryChart>
      <VictoryBar
        labels={[1, 2, 3, 4]}
        dataComponent={<StyledBar disableInlineStyles />}
      />
    </VictoryChart>
  );
}

Related PRs

v35.8.6

Compare Source

  • #​1878 - Downgrade d3-array dependency to correct for babel issue

v35.8.5

Compare Source

v35.8.4

Compare Source

  • #​1871 - Fixes a bug impacting log scale charts using VictoryVoronoiContainer with voronoiDimension.

v35.8.3

Compare Source

  • #​1870 - Fixes a regression impacting offsetX and offsetY props for multi-quadrant charts

v35.8.2

Compare Source

v35.8.1

Compare Source

  • #​1863 - Fixes a regression impacting stacked bar charts with minDomain introduced in 35.6.0.

v35.8.0

Compare Source

updates how domainPadding is applied to charts when 1) the additional padding would not result new quadradants being added, or 2) the user has set singleQuadrantDomainPadding={false}. In these cases, domainPadding is applied by calculating a new, smaller range that takes the desired, pixel-based padding into account, and then adding domain padding such that the previous domain fits entirely within the new, smaller range. In most cases, this change will make it much easier to do things like create bar charts where the first bar starts cleanly at the edge of the chart, by setting domainPadding={{ x: myBarWidth / 2 }}
This may cause visual changes for charts that use very large values for domainPadding. The domainPadding prop may need to be adjusted

calculates a more exact defaultDomainPadding for grouped bar charts based on the offset, number of bars, and the width of each bar (either from the barWidth prop or from a default barWidth based on the number of bars and the range). Previously, defaultDomainPadding was approximated based only on offset and number of bars.

v35.7.2

Compare Source

  • #​1852 - Fixes a bug related to zooming axes when tickFormat is given as an array. Thanks @​jhumbug!

v35.7.1

Compare Source

v35.7.0

Compare Source

  • #​1835 - This PR makes VictoryAxis responsible for calculating its own default xOffset, yOffset, orientation, and crossAxis values rather than relying on VictoryChart to determine these values. This change corrects several bugs related to how axes update on charts that use VictoryZoomContainer. We don't anticipate breaking changes with this update, but axis positioning will update differently (more correctly) when zooming. Thanks @​jhumbug!

v35.6.4

Compare Source

  • #​1850 - Update VictoryTheme type definition to allow adding an optional style prop to VictoryGroup via theme. Thanks @​hknowlton!

v35.6.3

Compare Source

  • #​1844 - Export missing VictoryAccessibleGroup from the main victory package
  • Security updates

v35.6.2

Compare Source

  • #​1840 - Improve cursor coordinate type definitions.
  • #​1837 - Fix a regression introduced in v35.6.0 impacting inverted domain charts. Thanks @​jhumbug!

v35.6.1

Compare Source

  • #​1832 - Add support for custom baselines for VictoryStack. Thanks @​jhumbug!
  • #​1833 - Add missing scale prop type for container type definitions.

v35.6.0

Compare Source

  • #​1827 - Points fully outside of a chart domain are now given null values to prevent them from being rendered. Exceptions are made for continuous chart types like VictoryArea and VictoryLine. This PR also includes a fix for animations so that animating data always reaches its final state before a new animation begins. Thanks @​jhumbug!

v35.5.1

Compare Source

v35.5.0

Compare Source

  • #​1815 - Fix a bug affecting VictoryBrushContainer with allowResize set to false, and use defaultBrushArea="move" by default when allowResize is set to false.

v35.4.13

Compare Source

  • #​1812 - Update VictoryTooltip types to allow users to set single dimensions for the center prop

v35.4.12

Compare Source

  • #​1807 - Add missing handleWidth type to VictoryBrushContainer interface. Thanks @​aknaut!

v35.4.11

Compare Source

v35.4.10

Compare Source

v35.4.9

Compare Source

v35.4.8

Compare Source

-#​1784 - - Add more font widths for the textsize util. Thanks @​eatyourpeas!

v35.4.7

Compare Source

  • #​1780 - Remove unused type prop from primitive components used by VictoryAxis and VictoryPolarAxis
  • #​1782 - Fix type definition for the getPath prop used by the Point primitive. Thanks @​ASmartLynx!

v35.4.6

Compare Source

-#​1767 - Adds support for rx and ry props on the Background primitive component. Thanks @​NgoKnows!

v35.4.5

Compare Source

  • #​1765 - Adds "cross" symbol for VictoryScatter and the Point primitive.

  • #​1766 - Allows the bin prop on VictoryHistogram to accept arrays of negative numbers. Thanks @​NgoKnows!

v35.4.4

Compare Source

v35.4.3

Compare Source

v35.4.2

Compare Source

v35.4.1

Compare Source

  • #​1812 - Update VictoryTooltip types to allow users to set single dimensions for the center prop

v35.4.0

Compare Source

Support for Global Events

This release adds a concept of global events that are attached to window rather than to any of the elements rendered by Victory components. Global events are only supported for "parent" events that would normally be attached to svg elements rendered by Victory's containerComponents. Events that should be global can be flagged by including onGlobal in the name of the event handler. So, for example, use onGlobalMouseUp rather than onMouseUp to create a global mouse up handler.

VictoryBrushContainer uses Global Events

VictoryBrushContainer now uses global events in its defaultEvents so that brushing continues even as the user's mouse moves outside of the chart area.

v35.3.5

Compare Source

  • #​1743 - Add a role prop for VictoryContainer

v35.3.4

Compare Source

  • #​1738 - Stop timers used by VictoryAnimation when there are no active subscriptions. Thanks @​noVerity!
  • #​1739 - Improve types related to styles and themes across all packages.
  • #​1740 - Replace all instances of Object.keys with lodash keys for consistency.

v35.3.3

Compare Source

v35.3.2

Compare Source

  • #​1728 - Use exact versions for Victory interdependencies to make it easier for users to specify exact versions
  • #​1726 - Decrease throttle on VictoryCursorContainer for smoother movement. Thanks @​Alexander-AJ-Berman!

v35.3.1

Compare Source

  • #​1724 Fixes a regression introduced in 35.3.0 affecting charts whose dimensions are updated via a useEffect hook

  • #​1723 - Avoids unnecessary re-renders caused by empty events. Thanks @​Hypnosphi!

v35.3.0

Compare Source

  • #​1715 Adds a dependency on json-safe-stringify in VictorySharedEvents
  • #​1716 Changes how event updates are cached to support React Strict Mode

v35.2.0

Compare Source

Accessibility Improvements
  • #​1708 - This PR adds ariaLabel to Victory's primitive components (VictoryLabel, Area, Bar etc.). This new prop can take a string or a function that expected to return a string, and adds aria-label attributes to svg elements Victory renders. This PR also adds tabIndex and aria-label props to VictoryClipContainer, and creates a new groupContainer, VictoryAccessibleGroup, which renders a g tag and an optional desc tag along with its other children. VictoryAccessibleGroup also takes aria-label and aria-describedby props. Thanks @​ljones87 for all the hard work on this new feature!

  • #​1709 - Adds default onFocus and onBlur event handlers to VictoryTooltip so that users can trigger tooltips by tabbing through the chart elements when tabIndex is set.

Bug fixes for labels and tooltips
  • #​1707 - Respects user-provided props on the label component VictoryVoronoiContainer renders, including text, style, flyoutStyle, width and height
  • #​1710 - Adds support for providing functions to the angle prop on VictoryLabel
  • #​1711 - Fixes a bug related to applying angles to labels whose position is set by datum rather than coordinate.

v35.1.1

Compare Source

v35.1.0

Compare Source

  • #​1692 - Adds a unique key prop for chart backgrounds
  • #​1690 - Fixes a minor positioning bug in label backgrounds
  • #​1688 - Fixes vertical alignment issue for labels. Thanks @​Hypnosphi!
  • #​1685 - Adds an optional preserveAspectRatio prop to VictoryContainer, and uses height: "100%" rather than height: "auto", giving users finer control over how Victory's svgs are positioned and scaled within their containers.

v35.0.9

Compare Source

v35.0.8

Compare Source

  • #​1657 - Fix bug in ouiaSafe prop on VictoryContainer

v35.0.7

Compare Source

v35.0.6

Compare Source

v35.0.5

Compare Source

v35.0.4

Compare Source

v35.0.3

Compare Source

  • #​1640 - Update package readmes with new docs links

v35.0.2

Compare Source

v35.0.1

Compare Source

v35.0.0

Compare Source

Label and Theme Improvements!

This release introduces new label features and makes improvements to themes. This release includes breaking style changes. Please double check your label and tooltip styles when upgrading. Polar axes and pie charts may be particularly impacted.

New Features!
  • VictoryLabel now supports label backgrounds, which are rendered as rect elements behind your labels. Backgrounds are styled via the new backgroundStyle prop on VictoryLabel. This prop may be given as a style object, or an array of objects for styling multi-line labels. Background elements are sized for their corresponding text elements, but padding may also be added with the backgroundPadding prop, which accepts a single number, an object with values for "top", "bottom", "left" and "right", or an array of either of these for adding background padding to multi-line labels.

  • VictoryTooltip has a new flyoutPadding prop that may be used to add padding between the edge of the flyout and the label within it. The flyoutPadding prop may be given as a single number of as an object with values for "top", "bottom", "left" and "right". This is a breaking change, as style.padding no longer adds padding between the flyout and its label. Both of Victory's built-in themes have been altered so that tooltips get flyoutPadding={5} by default.

  • VictoryPie now supports the labelPlacement prop used in polar charts. Possible values are "vertical" "parallel" and "perpendicular". When not given, vertical labels are rendered as before.

  • Themes now support polarAxis, polarDependentAxis, and polarIndependentAxis namespaces that are merges with the less specific axis, dependentAxis, and independentAxis themes as appropriate.

Improvements
  • Changes Victory's default branch from master to main 🖤

  • Textsize approximations have changed, and are much more accurate in most cases. This may be a breaking change for layouts that depended on approximated text size

  • Tooltip themes are now correctly merged with label styles and props.

  • VictoryPolarAxis elements are now rendered relative to the origin independently, rather than being translated as a group. This allows for correct positioning of elements within VictoryPortal This may be a breaking change for custom components in VictoryPolarAxis

  • Corrects the labelPosition prop on VictoryPie (previously startAngle and endAngle were inverted) This is a breaking change

  • Alters material and greyscale themes. The following theme updates may cause breaking style changes

    • Uses more widely available default fonts for labels
    • Reduces default label padding for boxplot and candlestick
    • Adds polarDependentAxis settings to the material theme
    • Zero padding on from tooltip styles override label styles on all other theme namespaces. This means that tooltips pointers will now all start exactly at the data element they correspond to by default. To alter this behavior, either 1) provide a different theme, 2) alter padding in via label styles like so:
      <VictoryBar
      style={{ labels: { padding: 5 } }}
      labelComponent={}
      />
      or
      <VictoryBar
      labelComponent={
      <VictoryTooltip style={{ padding: 5 }} />
      }
      />
Associated PRs

v34.3.12

Compare Source

-#​1620 - Allow granular voronoiPadding. Thanks @​dlabrecq!

-#​1607 - Add missing containerRef type. Thanks @​NgoKnows!

v34.3.11

Compare Source

v34.3.10

Compare Source

v34.3.9

Compare Source

v34.3.8

Compare Source

v34.3.7

Compare Source

v34.3.6

Compare Source

  • #​1580 - Improve histogram tooltip positioning for VictoryVoronoiContainer
  • #​1581 - Prevent VictoryVoronoiContainer from rendering tooltips with empty text

v34.3.5

Compare Source

-#​1575 - Allow the id prop for VictoryLabel to be given as a function. Thanks @​amyboyd!

v34.3.4

Compare Source

  • #​1573 - Add explicit dependencies on d3-scale and react-fast-compare for victory-histogram. Thanks @​Mike-Dax!

v34.3.3

Compare Source

  • #​1572 - Add missing backgroundComponent type

v34.3.2

Compare Source

  • #​1570 - Correct missing victory-histogram dependency

v34.3.1

Compare Source

-#​1620 - Allow granular voronoiPadding. Thanks @​dlabrecq!

-#​1607 - Add missing containerRef type. Thanks @​NgoKnows!

v34.3.0

Compare Source

<VictoryHistogram
  binSpacing={1}
  bins={[0, 20, 50, 500]}
  data={[
    { value: 1 }, { value: 1 }, { value: 2 }, { value: 3 } ...
  ]}
  x="value"
/>

Histogram bins may be defined with the bin prop, which takes either an array of bin edges, or a single number which corresponds to an approximate number of bins. VictoryHistogram is meant to work with continuous data, and expects a data prop as an array of objects with x values. By default, histogram bins will be laid out with no spaces between bins, but the optional binSpacing prop may be provided to change this behavior. Additional documentation and examples will be coming soon.

v34.2.2

Compare Source

  • #​1558 - Adds a backgroundComponent for VictoryChart that will be rendered if VictoryChart's style component includes background styles. The Background component renders a rect for cartesian charts and a circle for polar charts that is correctly sized and positioned to fill the entire range of the chart. Thanks @​maddles and @​wparsons!

v34.2.1

Compare Source

  • #​1563 - Fixes a regression introduced in 34.1.3 that was effecting charts with the domain prop defined for a single dimension.
  • #​1564 - Fixes a regression introduced in 34.1.3 that was causing domainPadding to not be applied to stacked and grouped charts with domain props defined.

v34.2.0

Compare Source

Update typescript types for all Victory components. A huge thanks to @​maddles @​wparsons and @​kale-stew for this work. This release includes the following PRs

#​1557, #​1556, #​1554, #​1552, #​1551, #​1550, #​1547, #​1546, #​1543, #​1538, #​1536, #​1535, #​1534, #​1533, #​1532, #​1530,#​1529, #​1528, #​1527, #​1526, #​1525, #​1524, #​1522, #​1521, #​1520, #​1519, #​1515, #​1514, #​1512, #​1510, #​1508

v34.1.3

Compare Source

  • #​1494 - Performance improvements targeted at reducing the number of calculations performed for nested charts (charts using the VictoryStack and VictoryGroup wrappers).

v34.1.2

Compare Source

v34.1.1

Compare Source

  • #​1485 - Better typescript linting and minor bug fix for VictoryChart types

v34.1.0

Compare Source

  • #​1481 - Add typescript types from the definitely-typed project so that we can maintain them more easily going forward

v34.0.1

Compare Source

  • #​1474 - Adds an activePoints prop to VictoryTooltip which VictoryVoronoiContainer supplies to its labelComponent. Thanks @​jotak!

v34.0.0

Compare Source

Breaking Changes

This version uses the context API introduced in react@16.3.0

v33.1.7

Compare Source

  • 1453 - Correctly handle null values in tooltips with custom flyoutComponents. Thanks @​alecf!

v33.1.6

Compare Source

  • #​1450 - Skips stringMap computation when data is preformatted (i.e. data uses has _x and _y values and accessors). Thanks @​na9da!

v33.1.5

Compare Source

  • #​1443 - Adds a mouseMoveThreshold prop for VictoryBrushContainer to prevent accidental redraws. Thanks @​Hypnosphi!
  • #​1448 - Removes an unnecessary check for svg target in VictoryBrushContainer onMouseLeave

v33.1.4

Compare Source

  • #​1447 - Adds support for function values for the labelPosition prop on VictoryPie

v33.1.3

Compare Source

  • #​1434 Ensure the correct handles are used in VictoryBrushArea when axes are inverted. Thanks @​Hypnosphi!
  • #​1435 Adds a "move" option for the defaultBrushArea prop in VictoryBrushContainer. When this option is selected, clicking outside of the brush area will pan the brush to a the area the user clicked without resizing the brush. Thanks @​Hypnosphi!

v33.1.2

Compare Source

  • #​1425 Corrects padding on zero value tooltips.
  • #​1423 Make sure VictoryChart does not override axis orientations defined in themes.
  • #​1422 Use the correct domain in the onBrushEnd domain callback.
  • #​1420 Fixes behavior with allowZoom prop. Thanks @​Hypnosphi!

v33.1.1

Compare Source

  • #​1409 Updates delaunay-find to 0.0.4 to correct incorrect nearest values for sets of points with collinear values. Corrects bugs in VictoryVoronoiContainer

v33.1.0

Compare Source

  • #​1404 Adds a11y improvements
    • corrects behavior of VictoryContainer so that it only adds aria-labelledby and aria-describedby attributes when there are actually title and / or desc elements that are rendered (controlled by the title and desc props on VictoryContainer
    • adds a tabIndex prop to all primitive components that Victory renders (i.e. VictoryLabel, Bar etc). This prop may be given as a number or a function of other props
    • adds a desc prop to all primitive components. This prop may be given as a number or a function of other props

v33.0.6

Compare Source

  • #​1401 - Fixes a bug affecting automatic candle coloring

  • #​1402 - Fixes a bug affecting user-provided containerRef callbacks

v33.0.5

Compare Source

v33.0.4

Compare Source

  • 1384 - Fixes a bug affecting functional cornerRadius on VictoryTooltip

  • 1385 - Adds pointerOrientation prop on VictoryTooltip to make it possible to control which side of the tooltip the pointer extends from independent of which side of the data point the entire flyout is oriented towards. This prop only became sensible with the addition of center and centerOffset props added in victory@33.0.0

v33.0.3

Compare Source

  • #​1379 - Fixes a bug affecting functional padAngle prop in VictoryPie

v33.0.2

Compare Source

  • #​1378 - Fixes a bug affecting function labels in VictoryPie

v33.0.1

Compare Source

  • #​1375 - Evaluates / calculates some props early so they are available when functional props are being evaluated. Most notably, text is evaluated before any other functional props for VictoryLabel so it may be used to determine things like style, etc.

v33.0.0

Compare Source

Breaking Changes

Changes for functional props and styles:

Related PR: #​1360

Functional props like labels and functional styles will now be called with a single argument instead of datum and active. The argument passed to functional props and styles will be an object containing all the props that control the rendering of the the target the prop applies to. Including things like datum, active, index, data, scale, etc. We hope this will give users a lot more flexibility and control. In most cases, this change should be very straightforward to apply

old:

labels={(d) => `x: ${d.x}`}

new

labels={({ datum }) => `x: ${datum.x}`}

Gotchas:

  • Some of the props passed into functional props and styles may themselves be functions. These will not be evaluated, because we have no way to determine evaluation order. So, if you create a cornerRadius function that depends on barWidth, do not also make barWidth a function of some other prop.
  • A few props that take functions do not follow this pattern. These include data accessor functions like y and x, and tickFormat. The arguments for these props have not changed.

Changes for VictoryCandlestick labels

Related PR: #​1295

VictoryCandlestick now has granular support for labels corresponding to each portion of the candle. The current labels and labelComponent props will be joined by new props corresponding to each part of the candle.
New props
lowLabels
lowLabelComponent
highLabels
highLabelComponent
openLabels
openLabelComponent
closeLabels
closeLabelComponent

This will be a breaking change affecting the positioning of the default label. In earlier versions, the default label was positioned above the candle, it will now be positioned next to the center of the candle.
To use older label positioning, use highLabels / highLabelComponent rather than label / labelComponent. If you are using tooltips with VictoryCandlestick, you will need to register a custom event to trigger your highLabels tooltip:

example:

<VictoryCandlestick
  highLabels={({ datum }) => datum.high}
  highLabelComponent={<VictoryTooltip />}
  events={[{
    target: "data",
    eventHandlers: {
      onMouseOver: () => ({ target: "highLabels", mutation: () => ({ active: true }) }),
      onMouseOut: () => ({ target: "highLabels", mutation: () => ({ active: false }) })
    }
  }]}
/>

The style prop for VictoryCandlestick now also has namespaces for the new labels in addition to the current labels namespace. When both labels and specific label styles (e.g. highLabels) are provided, the styles will be merged

Changes for VictoryVoronoiContainer

Related PR: #​1371

Before this version VictoryVoronoiContainer had limited functionality for mouse-following tooltips, and for constraining a tooltip to the chart area, but it was only usable for multi-point tooltips (with voronoiDimension), and was not user configurable. This version aims to correct these limitations:

  • mouseFollowTooltips: This new boolean prop on VictoryVoronoiContainer determines whether the labels should follow the mouse position or snap into place. (Note that in charts using voronoiDimension, the tooltip still follows the mouse in the non-voronoiDimension, as demonstrated in the charts below (both with voronoiDimension="x")

mouseFollowLabels={true}
mouseFollowLabels

mouseFollowTooltips={false}
non-mouseFollowTooltips

  • constrained tooltips: multi-point tooltips rendered by VictoryVoronoiContainer will no longer be constrained to the chart area by default. Instead, add the constrainToVisibleArea prop to VictoryTooltip to enable this behavior for both multi-point and single point tooltips:
    example:
containerComponent={
  <VictoryVoronoiContainer
    labelComponent={<VictoryTooltip constrainToVisibleArea />}
  />
}

Changes for VictoryTooltip and VictoryLabel

Related PR:#​1371

The changes we wanted to make to support new behaviors in VictoryVoronoiContainer required some changes to VictoryTooltip and VictoryLabel

New props for VictoryTooltip:

  • constrainToVisibleArea is a boolean prop that, when true, will alter the position of the tooltip so that it exactly fits within the svg Victory renders. The tooltip's center will be moved, but the pointer wi

@mend-for-github-com mend-for-github-com bot added the security fix Security fix generated by Mend label Mar 7, 2024
@luzixiao luzixiao merged commit 3a02ac4 into main Mar 7, 2024
1 check failed
@mend-for-github-com mend-for-github-com bot deleted the whitesource-remediate/victory-36.x branch March 7, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security fix Security fix generated by Mend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant