Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* eslint-disable camelcase */
import chart_global_label_Fill from '@patternfly/react-tokens/dist/esm/chart_global_label_Fill';

import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { CallbackArgs, CoordinatesPropType, OriginType } from 'victory-core';
import { CallbackArgs, CoordinatesPropType, LineSegment, OriginType } from 'victory-core';
import {
CursorCoordinatesPropType,
VictoryCursorContainer,
Expand Down Expand Up @@ -201,6 +204,7 @@ export interface ChartCursorContainerProps extends VictoryCursorContainerProps {

export const ChartCursorContainer: React.FunctionComponent<ChartCursorContainerProps> = ({
className,
cursorComponent = <LineSegment />,
themeColor,
themeVariant,

Expand All @@ -215,11 +219,20 @@ export const ChartCursorContainer: React.FunctionComponent<ChartCursorContainerP
...cursorLabelComponent.props
});

// Clone so users can override cursor container props
const cursor = React.cloneElement(cursorComponent, {
style: {
strokeColor: chart_global_label_Fill.value
},
...cursorComponent.props
});

// Note: theme is required by voronoiContainerMixin
return (
// Note: className is valid, but Victory is missing a type
<VictoryCursorContainer
className={chartClassName}
cursorComponent={cursor}
cursorLabelComponent={chartCursorLabelComponent}
theme={theme}
{...rest}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/* eslint-disable camelcase */
import chart_global_label_Fill from '@patternfly/react-tokens/dist/esm/chart_global_label_Fill';

import * as React from 'react';
import { ContainerType, createContainer as victoryCreateContainer } from 'victory-create-container';
import { ChartCursorTooltip } from '../ChartCursorTooltip';
import { ChartLabel } from '../ChartLabel';
import { LineSegment } from 'victory-core';

/**
* Makes a container component with multiple behaviors. It allows you to effectively combine any two
Expand All @@ -27,6 +31,13 @@ export const createContainer = (behaviorA: ContainerType, behaviorB: ContainerTy

if (isCursor) {
container.defaultProps.cursorLabelComponent = <ChartLabel textAnchor="start" />;
container.defaultProps.cursorComponent = (
<LineSegment
style={{
stroke: chart_global_label_Fill.value
}}
/>
);
}
if (isVoronoi) {
container.defaultProps.labelComponent = <ChartCursorTooltip />;
Expand Down