본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Stack Chart

원문 보기 위키 갱신

스택 차트(Stack chart)는 여러 계열을 층으로 쌓아 전체 합계와 함께 비교하는 차트예요. 오른쪽 정렬 범례, 월별 데이터, 반응형 컨테이너 등의 예시를 제공해요.

출처: 문서

본문

소개

참고: PatternFly React charts live in its own package at @patternfly/react-charts! 아래 예시들은 Victory 차트 라이브러리를 기반으로 하며, PatternFly를 위한 추가 기능, 사용자 지정 컴포넌트, 테마가 함께 포함되어 있어요. 이를 통해 일관된 마크업, 스타일, 동작으로 PatternFly 패턴을 만들 수 있는 React 기반 컴포넌트 모음을 제공해요.

예시

기본 with right aligned legend

Stack chart exampleAverage number of pets

  • 2015
  • 2016
  • 2017
  • 2018
  • 5
  • 10
  • 15
  • 20
  • 25CatsDogsBirdsMice

아래 정렬 범례가 있는 가로

Stack chart exampleAverage number of pets

  • 2015
  • 2016
  • 2017
  • 2018
  • 5
  • 10
  • 15
  • 20
  • 25CatsDogsBirdsMice

Multi-color (ordered) horizontal with bottom aligned legend

데이터 라벨을 사용해 툴팁을 적용하는 대체 방법을 보여줍니다.

Stack chart exampleAverage number of pets

  • 2015
  • 2016
  • 2017
  • 2018
  • 5
  • 10
  • 15
  • 20
  • 25CatsDogsBirdsMice

반응형 컨테이너가 있는 월별 데이터

Monthly Stack ChartStack Chart with monthly metric data

  • Aug. 30
  • 5
  • 10
  • 15SocketsCoresNodes

반응형 컨테이너가 있는 다중 색상(순서 없음)

아래 정렬 범례와 모바일 대응을 갖춘 월별 데이터를 보여줍니다.

Area chart exampleAverage number of pets

  • Sunday
  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
  • 5
  • 10
  • 15
  • 20
  • 25
  • 30CatsDogsBirds

문서

팁

  • Victory의 FAQ를 참고하세요.

  • For single data points or zero values, you may want to set the domain prop

  • ChartLegend may be used as a standalone component, instead of using legendData

  • Themes are inherited, so a default theme may override themeColor for a child component

  • The theme and themeColor props should be applied at the most top level component

참고

현재 아래 생성된 문서는 Victory import에서 타입 정의를 해석하지 못합니다. 위 예시에서 사용된 컴포넌트에 대한 Victory 패스스루(pass-thru) 속성도 여기에 문서화되어 있습니다: components used in the examples above, Victory pass-thru props are also documented here:

Props

Chart

Chart is a wrapper component that reconciles the domain for all its children, controls the layout of the chart, and coordinates animations and shared events.

See https://github.com/FormidableLabs/victory/blob/main/packages/victory-chart/src/victory-chart.tsx

*required | | Name | Type | Default | Description | animate | boolean | object | | The animate prop specifies props for VictoryAnimation to use. The animate prop should also be used to specify enter and exit transition configurations with the onExit and onEnter namespaces respectively.

@example {duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}

| ariaDesc | string | | The ariaDesc prop specifies the description of the chart/SVG to assist with accessibility for screen readers.

참고: Overridden by the desc prop of containerComponent

| ariaTitle | string | | The ariaTitle prop specifies the title to be applied to the SVG to assist accessibility for screen readers.

참고: Overridden by the title prop of containerComponent

| backgroundComponent | React.ReactElement | | The backgroundComponent prop takes a component instance which will be responsible for rendering a background if the Chart's style component includes background styles. The new element created from the passed backgroundComponent will be provided with the following properties calculated by Chart: height, polar, scale, style, x, y, width. All of these props on Background should take precedence over what VictoryChart is trying to set.

| children | React.ReactNode | React.ReactNode[] | | The children to render with the chart

| containerComponent | React.ReactElement | | The containerComponent prop takes an entire component which will be used to create a container element for standalone charts. The new element created from the passed containerComponent wil be provided with these props from ChartArea: height, width, children (the chart itself) and style. Props that are not provided by the child chart component include title and desc, both of which are intended to add accessibility to Victory components. The more descriptive these props are, the more accessible your data will be for people using screen readers. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If a dataComponent is not provided, ChartArea will use the default ChartContainer component.

@example

| domain | number[] | { x: number[], y: number[] } | | The domain prop describes the range of values your chart will include. This prop can be given as a array of the minimum and maximum expected values for your chart, or as an object that specifies separate arrays for x and y. If this prop is not provided, a domain will be calculated from data, or other available information.

@example [low, high], { x: [low, high], y: [low, high] }

[-1, 1], {x: [0, 100], y: [0, 1]}

| domainPadding | number | number[] | { x: number[], y: number[] } | | The domainPadding prop specifies a number of pixels of padding to add to the beginning and end of a domain. This prop is useful for explicitly spacing ticks farther from the origin to prevent crowding. This prop should be given as an object with numbers specified for x and y.

@example [left, right], { x: [left, right], y: [bottom, top] }

{x: [10, -10], y: 5}

| endAngle | number | | The endAngle props defines the overall end angle of a polar chart in degrees. This prop is used in conjunction with startAngle to create polar chart that spans only a segment of a circle, or to change overall rotation of the chart. This prop should be given as a number of degrees. Degrees are defined as starting at the 3 o'clock position, and proceeding counterclockwise.

| eventKey | number | string | Function | | Similar to data accessor props x and y, this prop may be used to functionally assign eventKeys to data

| events | object[] | | The event prop takes an array of event objects. Event objects are composed of a target, an eventKey, and eventHandlers. Targets may be any valid style namespace for a given component, so "data" and "labels" are all valid targets for ChartPie events. The eventKey may optionally be used to select a single element by index rather than an entire set. The eventHandlers object should be given as an object whose keys are standard event names (i.e. onClick) and whose values are event callbacks. The return value of an event handler is used to modify elements. The return value should be given as an object or an array of objects with optional target and eventKey keys, and a mutation key whose value is a function. The target and eventKey keys will default to those corresponding to the element the event handler was attached to. The mutation function will be called with the calculated props for the individual selected element (i.e. a single bar), and the object returned from the mutation function will override the props of the selected element via object assignment.

@example events={[ { target: "data", eventKey: 1, eventHandlers: { onClick: () => { return [ { eventKey: 2, mutation: (props) => { return {style: merge({}, props.style, {fill: "orange"})}; } }, { eventKey: 2, target: "labels", mutation: () => { return {text: "hey"}; } } ]; } } } ]}

| externalEventMutations | object[] | | Chart uses the standard externalEventMutations prop.

| groupComponent | React.ReactElement | | The groupComponent prop takes an entire component which will be used to create group elements for use within container elements. This prop defaults to a tag on web, and a react-native-svg tag on mobile

| hasPatterns | boolean | boolean[] | | The hasPatterns prop is an optional prop that indicates whether a pattern is shown for a chart. SVG patterns are dynamically generated (unique to each chart) in order to apply colors from the selected color theme or custom color scale. Those generated patterns are applied in a specific order (via a URL), similar to the color theme ordering defined by PatternFly. If the multi-color theme was in use; for example, colorized patterns would be displayed in that same order. Create custom patterns via the patternScale prop.

참고: Not all components are supported; for example, ChartLine, ChartBullet, ChartThreshold, etc.

@example hasPatterns={ true } @example hasPatterns={[ true, true, false ]}

| height | number | theme.chart.height | Specifies the height the svg viewBox of the chart container. This value should be given as a number of pixels.

Because Victory renders responsive containers, the width and height props do not determine the width and height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of pixels will depend on the size of the container the chart is rendered into. Typically, the parent container is set to the same width in order to maintain the aspect ratio.

| horizontal | boolean | | The horizontal prop determines whether data will be plotted horizontally. When this prop is set to true, the independent variable will be plotted on the y axis and the dependent variable will be plotted on the x axis.

| innerRadius | number | Function | | When the innerRadius prop is set, polar charts will be hollow rather than circular.

| legendAllowWrap | boolean | ((extraHeight: number) => void) | | Allows legend items to wrap onto the next line if the chart is not wide enough.

참고 that the chart's SVG height and width are 100% by default, so it can be responsive itself. However, if you define the height and width of the chart's parent container, you must accommodate for extra legend height due to legend items wrapping onto the next line. When the height of the chart's parent container is too small, some legend items may not be visible.

Alternatively, a callback function may be provided, which will be called after the legend's itemsPerRow property has been calculated. The value provided can be used to increase the chart's parent container height as legend items wrap onto the next line. If no adjustment is necessary, the value will be zero.

참고: This is overridden by the legendItemsPerRow property

| legendComponent | React.ReactElement | | The legend component to render with chart.

참고: Use legendData so the legend width can be calculated and positioned properly. Default legend properties may be applied

| legendData | { name?: string; symbol?: { fill?: string; type?: string; }; }[] | | Specify data via the data prop. ChartLegend expects data as an array of objects with name (required), symbol, and labels properties. The data prop must be given as an array.

@example legendData={[{ name: GBps capacity - 45% }, { name: 'Unused' }]}

| legendDirection | 'ltr' | 'rtl' | 'ltr' | Text direction of the legend labels.

| legendOrientation | 'horizontal' | 'vertical' | theme.legend.orientation | The orientation prop takes a string that defines whether legend data are displayed in a row or column. When orientation is "horizontal", legend items will be displayed in a single row. When orientation is "vertical", legend items will be displayed in a single column. Line and text-wrapping is not currently supported, so "vertical" orientation is both the default setting and recommended for displaying many series of data.

| legendPosition | 'bottom' | 'bottom-left' | 'right' | "right" | The legend position relation to the chart. Valid values are 'bottom', 'bottom-left', and 'right'

참고: When adding a legend, padding may need to be adjusted in order to accommodate the extra legend. In some cases, the legend may not be visible until enough padding is applied.

| maxDomain | number | { x?: number; y?: number } | | The maxDomain prop defines a maximum domain value for a chart. This prop is useful in situations where the maximum domain of a chart is static, while the minimum value depends on data or other variable information. If the domain prop is set in addition to maximumDomain, domain will be used.

참고: The x value supplied to the maxDomain prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

maxDomain={0} maxDomain={{ y: 0 }}

| minDomain | number | { x?: number; y?: number } | | The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum domain of a chart is static, while the maximum value depends on data or other variable information. If the domain prop is set in addition to minimumDomain, domain will be used.

참고: The x value supplied to the minDomain prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

minDomain={0} minDomain={{ y: 0 }}

| name | string | | The name prop is typically used to reference a component instance when defining shared events. However, this optional prop may also be applied to child elements as an ID prefix. This is a workaround to ensure Victory based components output unique IDs when multiple charts appear in a page.

| padding | number | { top: number, bottom: number, left: number, right: number } | | The padding props specifies the amount of padding in number of pixels between the edge of the chart and any rendered child components. This prop can be given as a number or as an object with padding specified for top, bottom, left and right.

| patternScale | string[] | | The patternScale prop is an optional prop that defines patterns to apply, where applicable. This prop should be given as a string array of pattern URLs. Patterns will be assigned to children by index and will repeat when there are more children than patterns in the provided patternScale. Use null to omit the pattern for a given index.

참고: Not all components are supported; for example, ChartLine, ChartBullet, ChartThreshold, etc.

@example patternScale={[ 'url("#pattern1")', 'url("#pattern2")', null ]}

| polar | boolean | | Victory components can pass a boolean polar prop to specify whether a label is part of a polar chart.

| range | number[] | { x: number[], y: number[] } | | The range prop describes the dimensions over which data may be plotted. For cartesian coordinate systems, this corresponds to minimum and maximum svg coordinates in the x and y dimension. In polar coordinate systems this corresponds to a range of angles and radii. When this value is not given it will be calculated from the width, height, and padding, or from the startAngle and endAngle in the case of polar charts. All components in a given chart must share the same range, so setting this prop on children nested within Chart, ChartStack, or ChartGroup will have no effect. This prop is usually not set manually.

@example [low, high] | { x: [low, high], y: [low, high] }

Cartesian: range={{ x: [50, 250], y: [50, 250] }} Polar: range={{ x: [0, 360], y: [0, 250] }}

| scale | string | { x: string, y: string } | | The scale prop determines which scales your chart should use. This prop can be given as a string specifying a supported scale ("linear", "time", "log", "sqrt"), as a d3 scale function, or as an object with scales specified for x and y

@example d3Scale.time(), {x: "linear", y: "log"}

| showAxis | boolean | true | Convenience prop to hide both x and y axis, which are shown by default. Alternatively, the axis can be hidden via chart styles.

| singleQuadrantDomainPadding | boolean | { x?: boolean; y?: boolean } | | By default domainPadding is coerced to existing quadrants. This means that if a given domain only includes positive values, no amount of padding applied by domainPadding will result in a domain with negative values. This is the desired behavior in most cases. For users that need to apply padding without regard to quadrant, the singleQuadrantDomainPadding prop may be used. This prop may be given as a boolean or an object with boolean values specified for "x" and/or "y". When this prop is false (or false for a given dimension), padding will be applied without regard to quadrant. If this prop is not specified, domainPadding will be coerced to existing quadrants.

참고: The x value supplied to the singleQuadrantDomainPadding prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

singleQuadrantDomainPadding={false} singleQuadrantDomainPadding={{ x: false }}

| standalone | boolean | | The standalone prop determines whether the component will render a standalone svg or a tag that will be included in an external svg. Set standalone to false to compose Chart with other components within an enclosing

| startAngle | number | | The startAngle props defines the overall start angle of a polar chart in degrees. This prop is used in conjunction with endAngle to create polar chart that spans only a segment of a circle, or to change overall rotation of the chart. This prop should be given as a number of degrees. Degrees are defined as starting at the 3 o'clock position, and proceeding counterclockwise.

| style | { parent: object, background: object } | | The style prop defines the style of the component. The style prop should be given as an object with styles defined for data, labels and parent. Any valid svg styles are supported, but width, height, and padding should be specified via props as they determine relative layout for components in Chart.

@propType { parent: object, background: object }

| theme | object | getChartTheme(themeColor, showAxis) | The theme prop specifies a theme to use for determining styles and layout properties for a component. Any styles or props defined in theme may be overwritten by props specified on the component instance.

| themeColor | string | | Specifies the theme color. Valid values are 'blue', 'green', 'multi', etc.

참고: Not compatible with theme prop

@example themeColor={ChartThemeColor.blue}

| width | number | theme.chart.width | Specifies the width of the svg viewBox of the chart container. This value should be given as a number of pixels.

Because Victory renders responsive containers, the width and height props do not determine the width and height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of pixels will depend on the size of the container the chart is rendered into. Typically, the parent container is set to the same width in order to maintain the aspect ratio.

ChartArea

ChartArea renders a dataset as a single area path. Since ChartArea renders only a single element to represent a dataset rather than individual elements for each data point, some of its behavior is different from other Victory based components. Pay special attention to style and events props, and take advantage of ChartVoronoiContainer to enable tooltips. ChartArea can be composed with Chart to create area charts.

See https://github.com/FormidableLabs/victory/blob/main/packages/victory-area/src/victory-area.tsx

*required | | Name | Type | Default | Description | animate | boolean | object | | The animate prop specifies props for VictoryAnimation to use. The animate prop should also be used to specify enter and exit transition configurations with the onExit and onEnter namespaces respectively.

@example {duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}

| categories | string[] | { x: string[], y: string[] } | | The categories prop specifies how categorical data for a chart should be ordered. This prop should be given as an array of string values, or an object with these arrays of values specified for x and y. If this prop is not set, categorical data will be plotted in the order it was given in the data array

@example ["dogs", "cats", "mice"]

| containerComponent | React.ReactElement | | The containerComponent prop takes an entire component which will be used to create a container element for standalone charts. The new element created from the passed containerComponent wil be provided with these props from ChartArea: height, width, children (the chart itself) and style. Props that are not provided by the child chart component include title and desc, both of which are intended to add accessibility to Victory components. The more descriptive these props are, the more accessible your data will be for people using screen readers. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If a dataComponent is not provided, ChartArea will use the default ChartContainer component.

@example

| data | any[] | | The data prop specifies the data to be plotted. Data should be in the form of an array of data points, or an array of arrays of data points for multiple datasets. Each data point may be any format you wish (depending on the x and y accessor props), but by default, an object with x and y properties is expected.

@example

[{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]], [[{x: "a", y: 1}, {x: "b", y: 2}], [{x: "a", y: 2}, {x: "b", y: 3}]]

| dataComponent | React.ReactElement | | The dataComponent prop takes an entire component which will be used to create an area. The new element created from the passed dataComponent will be provided with the following properties calculated by ChartArea: a scale, style, events, interpolation, and an array of modified data objects (including x, y, and calculated y0 and y1). Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If a dataComponent is not provided, ChartArea will use its default Area component.

| domain | number[] | { x: number[], y: number[] } | | The domain prop describes the range of values your chart will cover. This prop can be given as a array of the minimum and maximum expected values for your bar chart, or as an object that specifies separate arrays for x and y. If this prop is not provided, a domain will be calculated from data, or other available information.

@example [low, high], { x: [low, high], y: [low, high] }

[-1, 1], {x: [0, 100], y: [0, 1]}

| domainPadding | number | number[] | { x: number[], y: number[] } | | The domainPadding prop specifies a number of pixels of padding to add to the beginning and end of a domain. This prop is useful for explicitly spacing ticks farther from the origin to prevent crowding. This prop should be given as an object with numbers specified for x and y.

@example [left, right], { x: [left, right], y: [bottom, top] }

{x: [10, -10], y: 5}

| eventKey | number | string | Function | string[] | number[] | | Similar to data accessor props x and y, this prop may be used to functionally assign eventKeys to data

| events | object[] | | The event prop take an array of event objects. Event objects are composed of a target, an eventKey, and eventHandlers. Targets may be any valid style namespace for a given component, so "data" and "labels" are all valid targets for ChartArea events. Since ChartArea only renders a single element, the eventKey property is not used. The eventHandlers object should be given as an object whose keys are standard event names (i.e. onClick) and whose values are event callbacks. The return value of an event handler is used to modify elements. The return value should be given as an object or an array of objects with optional target and eventKey keys, and a mutation key whose value is a function. The target and eventKey keys will default to those corresponding to the element the event handler was attached to. The mutation function will be called with the calculated props for the individual selected element (i.e. an area), and the object returned from the mutation function will override the props of the selected element via object assignment.

@example events={[ { target: "data", eventHandlers: { onClick: () => { return [ { mutation: (props) => { return {style: merge({}, props.style, {fill: "orange"})}; } }, { target: "labels", mutation: () => { return {text: "hey"}; } } ]; } } } ]}

| externalEventMutations | object[] | | ChartArea uses the standard externalEventMutations prop.

| groupComponent | React.ReactElement | | The groupComponent prop takes an entire component which will be used to create group elements for use within container elements. This prop defaults to a tag on web, and a react-native-svg tag on mobile

| height | number | | The height props specifies the height the svg viewBox of the chart container. This value should be given as a number of pixels

| horizontal | boolean | | The horizontal prop determines whether data will be plotted horizontally. When this prop is set to true, the independent variable will be plotted on the y axis and the dependent variable will be plotted on the x axis.

| interpolation | string | Function | | The interpolation prop determines how data points should be connected when plotting a line. Polar area charts may use the following interpolation options: "basis", "cardinal", "catmullRom", "linear". Cartesian area charts may use the following interpolation options: "basis", "cardinal", "catmullRom", "linear", "monotoneX", "monotoneY", "natural", "step", "stepAfter", "stepBefore".

| labelComponent | React.ReactElement | | The labelComponent prop takes in an entire label component which will be used to create a label for the area. The new element created from the passed labelComponent will be supplied with the following properties: x, y, index, data, verticalAnchor, textAnchor, angle, style, text, and events. any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If labelComponent is omitted, a new ChartLabel will be created with props described above. This labelComponent prop should be used to provide a series label for ChartArea. If individual labels are required for each data point, they should be created by composing ChartArea with VictoryScatter

| labels | string[] | number[] | ((data: any) => string | number | null) | | The labels prop defines labels that will appear above each bar in your chart. This prop should be given as an array of values or as a function of data. If given as an array, the number of elements in the array should be equal to the length of the data array. Labels may also be added directly to the data object like data={[{x: 1, y: 1, label: "first"}]}.

@example ["spring", "summer", "fall", "winter"], (datum) => datum.title

| maxDomain | number | { x?: number; y?: number } | | The maxDomain prop defines a maximum domain value for a chart. This prop is useful in situations where the maximum domain of a chart is static, while the minimum value depends on data or other variable information. If the domain prop is set in addition to maximumDomain, domain will be used.

참고: The x value supplied to the maxDomain prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

maxDomain={0} maxDomain={{ y: 0 }}

| minDomain | number | { x?: number; y?: number } | | The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum domain of a chart is static, while the maximum value depends on data or other variable information. If the domain prop is set in addition to minimumDomain, domain will be used.

참고: The x value supplied to the minDomain prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

minDomain={0} minDomain={{ y: 0 }}

| name | string | | The name prop is used to reference a component instance when defining shared events.

| origin | { x: number, y: number } | | Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.

참고: It will not typically be necessary to set an origin prop manually

| padding | number | { top: number, bottom: number, left: number, right: number } | | The padding props specifies the amount of padding in number of pixels between the edge of the chart and any rendered child components. This prop can be given as a number or as an object with padding specified for top, bottom, left and right.

| polar | boolean | | Victory components can pass a boolean polar prop to specify whether a label is part of a polar chart.

| range | number[] | { x: number[], y: number[] } | | The range prop describes the dimensions over which data may be plotted. For cartesian coordinate systems, this corresponds to minimum and maximum svg coordinates in the x and y dimension. In polar coordinate systems this corresponds to a range of angles and radii. When this value is not given it will be calculated from the width, height, and padding, or from the startAngle and endAngle in the case of polar charts. All components in a given chart must share the same range, so setting this prop on children nested within Chart or ChartGroup will have no effect. This prop is usually not set manually.

@example [low, high] | { x: [low, high], y: [low, high] }

Cartesian: range={{ x: [50, 250], y: [50, 250] }} Polar: range={{ x: [0, 360], y: [0, 250] }}

| samples | number | | The samples prop specifies how many individual points to plot when plotting y as a function of x. Samples is ignored if x props are provided instead.

| scale | string | { x: string, y: string } | | The scale prop determines which scales your chart should use. This prop can be given as a string specifying a supported scale ("linear", "time", "log", "sqrt"), as a d3 scale function, or as an object with scales specified for x and y

@example d3Scale.time(), {x: "linear", y: "log"}

| singleQuadrantDomainPadding | boolean | { x?: boolean; y?: boolean } | | By default domainPadding is coerced to existing quadrants. This means that if a given domain only includes positive values, no amount of padding applied by domainPadding will result in a domain with negative values. This is the desired behavior in most cases. For users that need to apply padding without regard to quadrant, the singleQuadrantDomainPadding prop may be used. This prop may be given as a boolean or an object with boolean values specified for "x" and/or "y". When this prop is false (or false for a given dimension), padding will be applied without regard to quadrant. If this prop is not specified, domainPadding will be coerced to existing quadrants.

참고: The x value supplied to the singleQuadrantDomainPadding prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

singleQuadrantDomainPadding={false} singleQuadrantDomainPadding={{ x: false }}

| sortKey | number | string | Function | string[] | | Use the sortKey prop to indicate how data should be sorted. This prop is given directly to the lodash sortBy function to be executed on the final dataset.

| sortOrder | string | | The sortOrder prop specifies whether sorted data should be returned in 'ascending' or 'descending' order.

| standalone | boolean | | The standalone prop determines whether the component will render a standalone svg or a tag that will be included in an external svg. Set standalone to false to compose ChartArea with other components within an enclosing

| style | { parent: object, data: object, labels: object } | | The style prop specifies styles for your ChartArea. Any valid inline style properties will be applied. Height, width, and padding should be specified via the height, width, and padding props, as they are used to calculate the alignment of components within chart.

@example {data: {fill: "red"}, labels: {fontSize: 12}}

| theme | object | getTheme(themeColor) | The theme prop takes a style object with nested data, labels, and parent objects. You can create this object yourself, or you can use a theme provided by When using ChartArea as a solo component, implement the theme directly on ChartArea. If you are wrapping ChartArea in ChartChart or ChartGroup, please call the theme on the outermost wrapper component instead.

| themeColor | string | | Specifies the theme color. Valid values are 'blue', 'green', 'multi', etc.

참고: Not compatible with theme prop

@example themeColor={ChartThemeColor.blue}

| width | number | | The width props specifies the width of the svg viewBox of the chart container This value should be given as a number of pixels

| x | number | string | Function | string[] | | The x prop specifies how to access the X value of each data point. If given as a function, it will be run on each data point, and returned value will be used. If given as an integer, it will be used as an array index for array-type data points. If given as a string, it will be used as a property key for object-type data points. If given as an array of strings, or a string containing dots or brackets, it will be used as a nested object property path (for details see Lodash docs for _.get). If null or undefined, the data value will be used as is (identity function/pass-through).

@example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d)

| y | number | string | Function | string[] | | The y prop specifies how to access the Y value of each data point. If given as a function, it will be run on each data point, and returned value will be used. If given as an integer, it will be used as an array index for array-type data points. If given as a string, it will be used as a property key for object-type data points. If given as an array of strings, or a string containing dots or brackets, it will be used as a nested object property path (for details see Lodash docs for _.get). If null or undefined, the data value will be used as is (identity function/pass-through).

@example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d)

| y0 | number | string | Function | string[] | | Use y0 data accessor prop to determine how the component defines the baseline y0 data. This prop is useful for defining custom baselines for components like ChartArea. This prop may be given in a variety of formats.

@example 'last_quarter_profit', () => 10, 1, 'employees.salary', ["employees", "salary"]

ChartBar

ChartBar renders a dataset as series of bars. ChartBar can be composed with Chart to create bar charts.

See https://github.com/FormidableLabs/victory/blob/main/packages/victory-bar/src/index.d.ts

*required | | Name | Type | Default | Description | alignment | string | | The alignment prop specifies how bars should be aligned relative to their data points. This prop may be given as “start”, “middle” or “end”. When this prop is not specified, bars will have “middle” alignment relative to their data points.

| animate | boolean | object | | The animate prop specifies props for VictoryAnimation to use. The animate prop should also be used to specify enter and exit transition configurations with the onExit and onEnter namespaces respectively.

@example {duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}

| barRatio | number | | The barRatio prop specifies an approximate ratio between bar widths and spaces between bars. When width is not specified via the barWidth prop or in bar styles, the barRatio prop will be used to calculate a default width for each bar given the total number of bars in the data series and the overall width of the chart.

| barWidth | number | Function | | The barWidth prop is used to specify the width of each bar. This prop may be given as a number of pixels or as a function that returns a number. When this prop is given as a function, it will be evaluated with the arguments datum, and active. When this value is not given, a default value will be calculated based on the overall dimensions of the chart, and the number of bars.

| categories | string[] | { x: string[], y: string[] } | | The categories prop specifies how categorical data for a chart should be ordered. This prop should be given as an array of string values, or an object with these arrays of values specified for x and y. If this prop is not set, categorical data will be plotted in the order it was given in the data array

@example ["dogs", "cats", "mice"]

| containerComponent | React.ReactElement | | The containerComponent prop takes an entire component which will be used to create a container element for standalone charts. The new element created from the passed containerComponent wil be provided with these props from ChartBar: height, width, children (the chart itself) and style. Props that are not provided by the child chart component include title and desc, both of which are intended to add accessibility to Victory components. The more descriptive these props are, the more accessible your data will be for people using screen readers. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If a dataComponent is not provided, ChartBar will use the default ChartContainer component.

@example

| cornerRadius | Function | number | { top, bottom, topLeft, topRight, bottomLeft, bottomRight } | | The cornerRadius prop specifies a radius to apply to each bar. If this prop is given as a single number, the radius will only be applied to the top of each bar. When this prop is given as a function, it will be evaluated with the arguments datum, and active.

@example {topLeft: ({ datum }) => datum.x * 4}

| data | any[] | | The data prop specifies the data to be plotted. Data should be in the form of an array of data points, or an array of arrays of data points for multiple datasets. Each data point may be any format you wish (depending on the x and y accessor props), but by default, an object with x and y properties is expected.

@example

[{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]], [[{x: "a", y: 1}, {x: "b", y: 2}], [{x: "a", y: 2}, {x: "b", y: 3}]]

| dataComponent | React.ReactElement | | The dataComponent prop takes an entire component which will be used to create a bar. The new element created from the passed dataComponent will be provided with the following properties calculated by ChartBar: a scale, style, events, interpolation, and an array of modified data objects (including x, y, and calculated y0 and y1). Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If a dataComponent is not provided, ChartBar will use its default Bar component.

| domain | number[] | { x: number[], y: number[] } | | The domain prop describes the range of values your chart will cover. This prop can be given as a array of the minimum and maximum expected values for your bar chart, or as an object that specifies separate arrays for x and y. If this prop is not provided, a domain will be calculated from data, or other available information.

@example [low, high], { x: [low, high], y: [low, high] }

[-1, 1], {x: [0, 100], y: [0, 1]}

| domainPadding | number | number[] | { x: number[], y: number[] } | | The domainPadding prop specifies a number of pixels of padding to add to the beginning and end of a domain. This prop is useful for explicitly spacing ticks farther from the origin to prevent crowding. This prop should be given as an object with numbers specified for x and y.

@example [left, right], { x: [left, right], y: [bottom, top] }

{x: [10, -10], y: 5}

| eventKey | number | string | Function | | Similar to data accessor props x and y, this prop may be used to functionally assign eventKeys to data

| events | object[] | | The event prop take an array of event objects. Event objects are composed of a target, an eventKey, and eventHandlers. Targets may be any valid style namespace for a given component, so "data" and "labels" are all valid targets for VictoryBar events. The eventKey may optionally be used to select a single element by index rather than an entire set. The eventHandlers object should be given as an object whose keys are standard event names (i.e. onClick) and whose values are event callbacks. The return value of an event handler is used to modify elements. The return value should be given as an object or an array of objects with optional target and eventKey keys, and a mutation key whose value is a function. The target and eventKey keys will default to those corresponding to the element the event handler was attached to. The mutation function will be called with the calculated props for the individual selected element (i.e. a single bar), and the object returned from the mutation function will override the props of the selected element via object assignment.

@example events={[ { target: "data", eventKey: "thisOne", eventHandlers: { onClick: () => { return [ { eventKey: "theOtherOne", mutation: (props) => { return {style: merge({}, props.style, {fill: "orange"})}; } }, { eventKey: "theOtherOne", target: "labels", mutation: () => { return {text: "hey"}; } } ]; } } } ]}

| externalEventMutations | object[] | | ChartBar uses the standard externalEventMutations prop.

| groupComponent | React.ReactElement | | The groupComponent prop takes an entire component which will be used to create group elements for use within container elements. This prop defaults to a tag on web, and a react-native-svg tag on mobile

| height | number | | The height props specifies the height the svg viewBox of the chart container. This value should be given as a number of pixels

| horizontal | boolean | | The horizontal prop determines whether the bars will be laid vertically or horizontally. The bars will be vertical if this prop is false or unspecified, or horizontal if the prop is set to true.

| labelComponent | React.ReactElement | | The labelComponent prop takes in an entire label component which will be used to create a label for the bar. The new element created from the passed labelComponent will be supplied with the following properties: x, y, index, data, verticalAnchor, textAnchor, angle, style, text, and events. any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If labelComponent is omitted, a new ChartLabel will be created with props described above. This labelComponent prop should be used to provide a series label for ChartBar. If individual labels are required for each data point, they should be created by composing ChartBar with VictoryScatter

| labels | string[] | number[] | ((data: any) => string | number | null) | | The labels prop defines labels that will appear above each bar in your chart. This prop should be given as an array of values or as a function of data. If given as an array, the number of elements in the array should be equal to the length of the data array. Labels may also be added directly to the data object like data={[{x: 1, y: 1, label: "first"}]}.

@example ["spring", "summer", "fall", "winter"], (datum) => datum.title

| maxDomain | number | { x?: number; y?: number } | | The maxDomain prop defines a maximum domain value for a chart. This prop is useful in situations where the maximum domain of a chart is static, while the minimum value depends on data or other variable information. If the domain prop is set in addition to maximumDomain, domain will be used.

참고: The x value supplied to the maxDomain prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

maxDomain={0} maxDomain={{ y: 0 }}

| minDomain | number | { x?: number; y?: number } | | The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum domain of a chart is static, while the maximum value depends on data or other variable information. If the domain prop is set in addition to minimumDomain, domain will be used.

참고: The x value supplied to the minDomain prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

minDomain={0} minDomain={{ y: 0 }}

| name | string | | The name prop is used to reference a component instance when defining shared events.

| origin | { x: number, y: number } | | Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.

참고: It will not typically be necessary to set an origin prop manually

| padding | number | { top: number, bottom: number, left: number, right: number } | | The padding props specifies the amount of padding in number of pixels between the edge of the chart and any rendered child components. This prop can be given as a number or as an object with padding specified for top, bottom, left and right.

| range | number[] | { x: number[], y: number[] } | | The range prop describes the dimensions over which data may be plotted. For cartesian coordinate systems, this corresponds to minimum and maximum svg coordinates in the x and y dimension. In polar coordinate systems this corresponds to a range of angles and radii. When this value is not given it will be calculated from the width, height, and padding, or from the startAngle and endAngle in the case of polar charts. All components in a given chart must share the same range, so setting this prop on children nested within Chart or ChartGroup will have no effect. This prop is usually not set manually.

@example [low, high] | { x: [low, high], y: [low, high] }

Cartesian: range={{ x: [50, 250], y: [50, 250] }} Polar: range={{ x: [0, 360], y: [0, 250] }}

| samples | number | | The samples prop specifies how many individual points to plot when plotting y as a function of x. Samples is ignored if x props are provided instead.

| scale | string | { x: string, y: string } | | The scale prop determines which scales your chart should use. This prop can be given as a string specifying a supported scale ("linear", "time", "log", "sqrt"), as a d3 scale function, or as an object with scales specified for x and y

@example d3Scale.time(), {x: "linear", y: "log"}

| singleQuadrantDomainPadding | boolean | { x?: boolean; y?: boolean } | | By default domainPadding is coerced to existing quadrants. This means that if a given domain only includes positive values, no amount of padding applied by domainPadding will result in a domain with negative values. This is the desired behavior in most cases. For users that need to apply padding without regard to quadrant, the singleQuadrantDomainPadding prop may be used. This prop may be given as a boolean or an object with boolean values specified for "x" and/or "y". When this prop is false (or false for a given dimension), padding will be applied without regard to quadrant. If this prop is not specified, domainPadding will be coerced to existing quadrants.

참고: The x value supplied to the singleQuadrantDomainPadding prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

singleQuadrantDomainPadding={false} singleQuadrantDomainPadding={{ x: false }}

| sortKey | number | string | Function | string[] | | Use the sortKey prop to indicate how data should be sorted. This prop is given directly to the lodash sortBy function to be executed on the final dataset.

| sortOrder | string | | The sortOrder prop specifies whether sorted data should be returned in 'ascending' or 'descending' order.

| standalone | boolean | | The standalone prop determines whether the component will render a standalone svg or a tag that will be included in an external svg. Set standalone to false to compose ChartBar with other components within an enclosing

| style | { parent: object, data: object, labels: object } | | The style prop specifies styles for your ChartBar. Any valid inline style properties will be applied. Height, width, and padding should be specified via the height, width, and padding props, as they are used to calculate the alignment of components within chart.

@example {data: {fill: "red"}, labels: {fontSize: 12}}

| theme | object | getTheme(themeColor) | The theme prop takes a style object with nested data, labels, and parent objects. You can create this object yourself, or you can use a theme provided by When using ChartBar as a solo component, implement the theme directly on ChartBar. If you are wrapping ChartBar in ChartChart or ChartGroup, please call the theme on the outermost wrapper component instead.

| themeColor | string | | Specifies the theme color. Valid values are 'blue', 'green', 'multi', etc.

참고: Not compatible with theme prop

@example themeColor={ChartThemeColor.blue}

| width | number | | The width props specifies the width of the svg viewBox of the chart container This value should be given as a number of pixels

| x | number | string | Function | string[] | | The x prop specifies how to access the X value of each data point. If given as a function, it will be run on each data point, and returned value will be used. If given as an integer, it will be used as an array index for array-type data points. If given as a string, it will be used as a property key for object-type data points. If given as an array of strings, or a string containing dots or brackets, it will be used as a nested object property path (for details see Lodash docs for _.get). If null or undefined, the data value will be used as is (identity function/pass-through).

@example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d)

| y | number | string | Function | string[] | | The y prop specifies how to access the Y value of each data point. If given as a function, it will be run on each data point, and returned value will be used. If given as an integer, it will be used as an array index for array-type data points. If given as a string, it will be used as a property key for object-type data points. If given as an array of strings, or a string containing dots or brackets, it will be used as a nested object property path (for details see Lodash docs for _.get). If null or undefined, the data value will be used as is (identity function/pass-through).

@example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d)

| y0 | number | string | Function | string[] | | Use y0 data accessor prop to determine how the component defines the baseline y0 data. This prop is useful for defining custom baselines for components like ChartBar. This prop may be given in a variety of formats.

@example 'last_quarter_profit', () => 10, 1, 'employees.salary', ["employees", "salary"]

ChartStack

ChartStack is a wrapper component that renders a given set of children in a stacked layout. Like other wrapper components, ChartStack also reconciles the domain and layout for all its children, and coordinates animations and shared events.

See https://github.com/FormidableLabs/victory/blob/main/packages/victory-stack/src/index.d.ts

*required | | Name | Type | Default | Description | animate | boolean | object | | The animate prop specifies props for VictoryAnimation to use. The animate prop should also be used to specify enter and exit transition configurations with the onExit and onEnter namespaces respectively.

@example {duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}

| ariaDesc | string | | The ariaDesc prop specifies the description of the chart/SVG to assist with accessibility for screen readers.

참고: Overridden by the desc prop of containerComponent

| ariaTitle | string | | The ariaTitle prop specifies the title to be applied to the SVG to assist accessibility for screen readers.

참고: Overridden by the title prop of containerComponent

| categories | string[] | { x: string[], y: string[] } | | The categories prop specifies how categorical data for a chart should be ordered. This prop should be given as an array of string values, or an object with these values for x and y. When categories are not given as an object When this prop is set on a wrapper component, it will dictate the categories of its the children. If this prop is not set, any categories on child component or categorical data, will be merged to create a shared set of categories.

@example ["dogs", "cats", "mice"]

| children | React.ReactNode | | ChartStack works with any combination of the following children: ChartArea, ChartBar, VictoryCandlestick, VictoryErrorBar, ChartGroup, ChartLine, VictoryScatter, ChartStack, and ChartVoronoi. Children supplied to ChartGroup will be cloned and rendered with new props so that all children share common props such as domain and scale.

| colorScale | string[] | | The colorScale prop is an optional prop that defines the color scale the chart's bars will be created on. This prop should be given as an array of CSS colors, or as a string corresponding to one of the built in color scales. ChartStack will automatically assign values from this color scale to the bars unless colors are explicitly provided in the dataAttributes prop.

| containerComponent | React.ReactElement | | The containerComponent prop takes an entire component which will be used to create a container element for standalone charts. The new element created from the passed containerComponent wil be provided with these props from ChartArea: height, width, children (the chart itself) and style. Props that are not provided by the child chart component include title and desc, both of which are intended to add accessibility to Victory components. The more descriptive these props are, the more accessible your data will be for people using screen readers. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If a dataComponent is not provided, ChartArea will use the default ChartContainer component.

@example

| domain | number[] | { x: number[], y: number[] } | | The domain prop describes the range of values your chart will include. This prop can be given as a array of the minimum and maximum expected values for your chart, or as an object that specifies separate arrays for x and y. If this prop is not provided, a domain will be calculated from data, or other available information.

@example [low, high], { x: [low, high], y: [low, high] }

[-1, 1], {x: [0, 100], y: [0, 1]}

| domainPadding | number | number[] | { x: number[], y: number[] } | | The domainPadding prop specifies a number of pixels of padding to add to the beginning and end of a domain. This prop is useful for explicitly spacing ticks farther from the origin to prevent crowding. This prop should be given as an object with numbers specified for x and y.

@example [left, right], { x: [left, right], y: [bottom, top] }

{x: [10, -10], y: 5}

| eventKey | number | string | Function | | Similar to data accessor props x and y, this prop may be used to functionally assign eventKeys to data

| events | object[] | | The event prop take an array of event objects. Event objects are composed of a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace for a given component, (i.e. "data" and "labels"). The childName will refer to an individual child of ChartStack, either by its name prop, or by index. The eventKey may optionally be used to select a single element by index or eventKey rather than an entire set. The eventHandlers object should be given as an object whose keys are standard event names (i.e. onClick) and whose values are event callbacks. The return value of an event handler is used to modify elements. The return value should be given as an object or an array of objects with optional target and eventKey and childName keys, and a mutation key whose value is a function. The target and eventKey and childName keys will default to those corresponding to the element the event handler was attached to. The mutation function will be called with the calculated props for the individual selected element (i.e. a single bar), and the object returned from the mutation function will override the props of the selected element via object assignment.

@example events={[ { target: "data", childName: "firstBar", eventHandlers: { onClick: () => { return [ { childName: "secondBar", mutation: (props) => { return {style: merge({}, props.style, {fill: "orange"})}; } }, { childName: "secondBar", target: "labels", mutation: () => { return {text: "hey"}; } } ]; } } } ]}

| externalEventMutations | object[] | | ChartStack uses the standard externalEventMutations prop.

| groupComponent | React.ReactElement | | The groupComponent prop takes an entire component which will be used to create group elements for use within container elements. This prop defaults to a tag on web, and a react-native-svg tag on mobile

| hasPatterns | boolean | boolean[] | | The hasPatterns prop is an optional prop that indicates whether a pattern is shown for a chart. SVG patterns are dynamically generated (unique to each chart) in order to apply colors from the selected color theme or custom color scale. Those generated patterns are applied in a specific order (via a URL), similar to the color theme ordering defined by PatternFly. If the multi-color theme was in use; for example, colorized patterns would be displayed in that same order. Create custom patterns via the patternScale prop.

참고: Not all components are supported; for example, ChartLine, ChartBullet, ChartThreshold, etc.

@example hasPatterns={ true } @example hasPatterns={[ true, true, false ]}

| height | number | | The height props specifies the height the svg viewBox of the chart container. This value should be given as a number of pixels

| horizontal | boolean | | The horizontal prop determines whether the bars will be laid vertically or horizontally. The bars will be vertical if this prop is false or unspecified, or horizontal if the prop is set to true.

| labelComponent | React.ReactElement | | The labelComponent prop takes in an entire label component which will be used to create a label for the area. The new element created from the passed labelComponent will be supplied with the following properties: x, y, index, data, verticalAnchor, textAnchor, angle, style, text, and events. any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If labelComponent is omitted, a new ChartLabel will be created with props described above. This labelComponent prop should be used to provide a series label for ChartArea. If individual labels are required for each data point, they should be created by composing ChartArea with VictoryScatter

| labels | string[] | number[] | ((data: any) => string | number | null) | | The labels prop defines labels that will appear above each bar in your chart. This prop should be given as an array of values or as a function of data. If given as an array, the number of elements in the array should be equal to the length of the data array. Labels may also be added directly to the data object like data={[{x: 1, y: 1, label: "first"}]}.

@example ["spring", "summer", "fall", "winter"], (datum) => datum.title

| maxDomain | number | { x?: number; y?: number } | | The maxDomain prop defines a maximum domain value for a chart. This prop is useful in situations where the maximum domain of a chart is static, while the minimum value depends on data or other variable information. If the domain prop is set in addition to maximumDomain, domain will be used.

참고: The x value supplied to the maxDomain prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

maxDomain={0} maxDomain={{ y: 0 }}

| minDomain | number | { x?: number; y?: number } | | The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum domain of a chart is static, while the maximum value depends on data or other variable information. If the domain prop is set in addition to minimumDomain, domain will be used.

참고: The x value supplied to the minDomain prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

minDomain={0} minDomain={{ y: 0 }}

| name | string | | The name prop is used to reference a component instance when defining shared events.

| origin | { x: number, y: number } | | Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.

참고: It will not typically be necessary to set an origin prop manually

| padding | number | { top: number, bottom: number, left: number, right: number } | | The padding props specifies the amount of padding in number of pixels between the edge of the chart and any rendered child components. This prop can be given as a number or as an object with padding specified for top, bottom, left and right.

| patternScale | string[] | | The patternScale prop is an optional prop that defines patterns to apply, where applicable. This prop should be given as a string array of pattern URLs. Patterns will be assigned to children by index and will repeat when there are more children than patterns in the provided patternScale. Use null to omit the pattern for a given index.

참고: Not all components are supported; for example, ChartLine, ChartBullet, ChartThreshold, etc.

@example patternScale={[ 'url("#pattern1")', 'url("#pattern2")', null ]}

| range | number[] | { x: number[], y: number[] } | | The range prop describes the dimensions over which data may be plotted. For cartesian coordinate systems, this corresponds to minimum and maximum svg coordinates in the x and y dimension. In polar coordinate systems this corresponds to a range of angles and radii. When this value is not given it will be calculated from the width, height, and padding, or from the startAngle and endAngle in the case of polar charts. All components in a given chart must share the same range, so setting this prop on children nested within Chart or ChartGroup will have no effect. This prop is usually not set manually.

@example [low, high] | { x: [low, high], y: [low, high] }

Cartesian: range={{ x: [50, 250], y: [50, 250] }} Polar: range={{ x: [0, 360], y: [0, 250] }}

| scale | string | { x: string, y: string } | | The scale prop determines which scales your chart should use. This prop can be given as a string specifying a supported scale ("linear", "time", "log", "sqrt"), as a d3 scale function, or as an object with scales specified for x and y

@example d3Scale.time(), {x: "linear", y: "log"}

| singleQuadrantDomainPadding | boolean | { x?: boolean; y?: boolean } | | By default domainPadding is coerced to existing quadrants. This means that if a given domain only includes positive values, no amount of padding applied by domainPadding will result in a domain with negative values. This is the desired behavior in most cases. For users that need to apply padding without regard to quadrant, the singleQuadrantDomainPadding prop may be used. This prop may be given as a boolean or an object with boolean values specified for "x" and/or "y". When this prop is false (or false for a given dimension), padding will be applied without regard to quadrant. If this prop is not specified, domainPadding will be coerced to existing quadrants.

참고: The x value supplied to the singleQuadrantDomainPadding prop refers to the independent variable, and the y value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to the y axis.

@example

singleQuadrantDomainPadding={false} singleQuadrantDomainPadding={{ x: false }}

| standalone | boolean | | The standalone prop determines whether the component will render a standalone svg or a tag that will be included in an external svg. Set standalone to false to compose ChartArea with other components within an enclosing

| style | { parent: object, data: object, labels: object } | | The style prop specifies styles for your grouped chart. These styles will be applied to all grouped children

| theme | object | getTheme(themeColor) | The theme prop takes a style object with nested data, labels, and parent objects. You can create this object yourself, or you can use a theme provided by When using ChartArea as a solo component, implement the theme directly on ChartArea. If you are wrapping ChartArea in ChartChart or ChartGroup, please call the theme on the outermost wrapper component instead.

| themeColor | string | | Specifies the theme color. Valid values are 'blue', 'green', 'multi', etc.

참고: Not compatible with theme prop

@example themeColor={ChartThemeColor.blue}

| width | number | | The width props specifies the width of the svg viewBox of the chart container This value should be given as a number of pixels

| xOffset | number | | The xOffset prop is used for grouping stacks of bars. This prop will be set by the ChartGroup component wrapper, or can be set manually.

ChartTooltip

ChartTooltip renders a tooltip component with a set of default events. When ChartTooltip is used as a label component for any Victory based component that renders data, it will attach events to rendered data components that will activate the tooltip when hovered or focused. ChartTooltipTooltip renders text as well as a configurable Flyout container.

참고: When providing tooltips for ChartLine or ChartArea, it is necessary to use ChartVoronoiContainer, as these components only render a single element for the entire dataset.

See https://github.com/FormidableLabs/victory/blob/main/packages/victory-tooltip/src/index.d.ts

*required | | Name | Type | Default | Description | activateData | boolean | | When true, tooltip events will set the active prop on both data and label elements.

| active | boolean | | The active prop specifies whether the tooltip component should be displayed.

| angle | number | | The angle prop specifies the angle to rotate the tooltip around its origin point.

| center | { x: number; y: number } | | The center prop determines the position of the center of the tooltip flyout. This prop should be given as an object that describes the desired x and y svg coordinates of the center of the tooltip. This prop is useful for positioning the flyout of a tooltip independent from the pointer. When ChartTooltip is used with ChartVoronoiContainer, the center prop is what enables the mouseFollowTooltips option. When this prop is set, non-zero pointerLength values will no longer be respected.

| centerOffset | { x: number | Function, y: number | Function } | | The centerOffset prop determines the position of the center of the tooltip flyout in relation to the flyout pointer. This prop should be given as an object of x and y, where each is either a numeric offset value or a function that returns a numeric value. When this prop is set, non-zero pointerLength values will no longer be respected.

| constrainToVisibleArea | boolean | false | The constrainToVisibleArea prop determines whether to coerce tooltips so that they fit within the visible area of the chart. When this prop is set to true, tooltip pointers will still point to the correct data point, but the center of the tooltip will be shifted to fit within the overall width and height of the svg Victory renders.

| cornerRadius | number | Function | | The cornerRadius prop determines corner radius of the flyout container. This prop may be given as a positive number or a function of datum.

| data | any[] | | Victory components can pass a data prop to their label component. This can be useful in custom components that need to make use of the entire dataset.

| datum | {} | | Victory components can pass a datum prop to their label component. This can be used to calculate functional styles, and determine text.

| dx | number | Function | | The dx prop defines a horizontal shift from the x coordinate.

| dy | number | Function | | The dy prop defines a vertical shift from the y coordinate.

| events | object | | The events prop attaches arbitrary event handlers to the label component. This prop should be given as an object of event names and corresponding event handlers. When events are provided via Victory’s event system, event handlers will be called with the event, the props of the component is attached to, and an eventKey.

@example events={{onClick: (evt) => alert("x: " + evt.clientX)}}

| flyoutComponent | React.ReactElement | | The flyoutComponent prop takes a component instance which will be used to create the flyout path for each tooltip. The new element created from the passed flyoutComponent will be supplied with the following properties: x, y, dx, dy, index, datum, cornerRadius, pointerLength, pointerWidth, width, height, orientation, style, and events. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If flyoutComponent is omitted, a default Flyout component will be created with props described above.

@example flyoutComponent={}, flyoutComponent={}

| flyoutHeight | number | Function | | The flyoutHeight prop defines the height of the tooltip flyout. This prop may be given as a positive number or a function of datum. If this prop is not set, height will be determined based on an approximate text size calculated from the text and style props provided to ChartTooltip.

| flyoutStyle | number | Function | | The style prop applies SVG style properties to the rendered flyout container. These props will be passed to the flyoutComponent.

| flyoutWidth | number | Function | | The flyoutWidth prop defines the width of the tooltip flyout. This prop may be given as a positive number or a function of datum. If this prop is not set, flyoutWidth will be determined based on an approximate text size calculated from the text and style props provided to VictoryTooltip.

| groupComponent | React.ReactElement | | The groupComponent prop takes a component instance which will be used to create group elements for use within container elements. This prop defaults to a tag.}

| horizontal | boolean | | The horizontal prop determines whether to plot the flyouts to the left / right of the (x, y) coordinate rather than top / bottom. This is useful when an orientation prop is not provided, and data will determine the default orientation. i.e. negative values result in a left orientation and positive values will result in a right orientation by default.

| index | number | string | | The index prop represents the index of the datum in the data array.

| labelComponent | React.ReactElement | | The labelComponent prop takes a component instance which will be used to render each tooltip label. The new element created from the passed labelComponent will be supplied with the following properties: x, y, index, datum, verticalAnchor, textAnchor, style, text, and events. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If labelComponent is omitted, a new ChartLabel will be created with the props described above.

@example labelComponent={}, labelComponent={}

| labelTextAnchor | string | Function | | Defines how the labelComponent text is horizontally positioned relative to its x and y coordinates. Valid values are 'start', 'middle', 'end', and 'inherit'.

| orientation | string | Function | | The orientation prop determines which side of the (x, y) coordinate the tooltip should be rendered on. This prop can be given as “top”, “bottom”, “left”, “right”, or as a function of datum that returns one of these values. If this prop is not provided it will be determined from the sign of the datum, and the value of the horizontal prop.

| pointerLength | number | Function | | The pointerLength prop determines the length of the triangular pointer extending from the flyout. This prop may be given as a positive number or a function of datum.

| pointerOrientation | string | Function | | This prop determines which side of the tooltip flyout the pointer should originate on. When this prop is not set, it will be determined based on the overall orientation of the flyout in relation to its data point, and any center or centerOffset values. Valid values are 'top', 'bottom', 'left' and 'right.

| pointerWidth | number | Function | | The pointerWidth prop determines the width of the base of the triangular pointer extending from the flyout. This prop may be given as a positive number or a function of datum.

| renderInPortal | boolean | | When renderInPortal is true, rendered tooltips will be wrapped in VictoryPortal and rendered within the Portal element within ChartContainer. 참고: This prop should not be set to true when using a custom container element.

| style | React.CSSProperties | React.CSSProperties[] | | The style prop applies CSS properties to the rendered <text> element.

| text | number | string | Function | string[] | number[] | | The text prop defines the text ChartTooltip will render. The text prop may be given as a string, number, or function of datum. When ChartLabel is used as the labelComponent, strings may include newline characters, which ChartLabel will split in to separate elements.

| theme | object | getTheme(themeColor) | The theme prop specifies a theme to use for determining styles and layout properties for a component. Any styles or props defined in theme may be overwritten by props specified on the component instance.

| themeColor | string | | Specifies the theme color. Valid values are 'blue', 'green', 'multi', etc.

참고: Not compatible with theme prop

@example themeColor={ChartThemeColor.blue}

| x | number | | The x prop defines the x coordinate to use as a basis for horizontal positioning.

| y | number | | The y prop defines the y coordinate to use as a basis for vertical positioning.

Edit this page on GitHub

더 알아보기 (Learn more)