Skip to content

Commit

Permalink
Update dependency @elastic/charts to v25 (#91557)
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored Feb 17, 2021
1 parent 03c423f commit a3dfecb
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
"@cypress/webpack-preprocessor": "^5.5.0",
"@elastic/apm-rum": "^5.6.1",
"@elastic/apm-rum-react": "^1.2.5",
"@elastic/charts": "24.6.0",
"@elastic/charts": "25.0.1",
"@elastic/eslint-config-kibana": "link:packages/elastic-eslint-config-kibana",
"@elastic/eslint-plugin-eui": "0.0.2",
"@elastic/github-checks-reporter": "0.0.20b3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ export interface BrushTriggerEvent {

type AllSeriesAccessors = Array<[accessor: Accessor | AccessorFn, value: string | number]>;

// TODO: replace when exported from elastic/charts
const DEFAULT_SINGLE_PANEL_SM_VALUE = '__ECH_DEFAULT_SINGLE_PANEL_SM_VALUE__';

/**
* returns accessor value from string or function accessor
* @param datum
Expand Down Expand Up @@ -97,11 +94,11 @@ function getSplitChartValue({
| string
| number
| undefined {
if (smHorizontalAccessorValue !== DEFAULT_SINGLE_PANEL_SM_VALUE) {
if (smHorizontalAccessorValue !== undefined) {
return smHorizontalAccessorValue;
}

if (smVerticalAccessorValue !== DEFAULT_SINGLE_PANEL_SM_VALUE) {
if (smVerticalAccessorValue !== undefined) {
return smVerticalAccessorValue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ interface TooltipData {
value: string;
}

// TODO: replace when exported from elastic/charts
const DEFAULT_SINGLE_PANEL_SM_VALUE = '__ECH_DEFAULT_SINGLE_PANEL_SM_VALUE__';

export const getTooltipData = (
aspects: Aspects,
header: TooltipValue | null,
Expand Down Expand Up @@ -81,7 +78,7 @@ export const getTooltipData = (
if (
aspects.splitColumn &&
valueSeries.smHorizontalAccessorValue !== undefined &&
valueSeries.smHorizontalAccessorValue !== DEFAULT_SINGLE_PANEL_SM_VALUE
valueSeries.smHorizontalAccessorValue !== undefined
) {
data.push({
label: aspects.splitColumn.title,
Expand All @@ -92,7 +89,7 @@ export const getTooltipData = (
if (
aspects.splitRow &&
valueSeries.smVerticalAccessorValue !== undefined &&
valueSeries.smVerticalAccessorValue !== DEFAULT_SINGLE_PANEL_SM_VALUE
valueSeries.smVerticalAccessorValue !== undefined
) {
data.push({
label: aspects.splitRow.title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const getLegendActions = (
onFilter: (data: ClickTriggerEvent, negate?: any) => void,
getSeriesName: (series: XYChartSeriesIdentifier) => SeriesName
): LegendAction => {
return ({ series: xySeries }) => {
return ({ series: [xySeries] }) => {
const [popoverOpen, setPopoverOpen] = useState(false);
const [isfilterable, setIsfilterable] = useState(false);
const series = xySeries as XYChartSeriesIdentifier;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_xy/public/utils/use_color_picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const useColorPicker = (
getSeriesName: (series: XYChartSeriesIdentifier) => SeriesName
): LegendColorPicker =>
useMemo(
() => ({ anchor, color, onClose, onChange, seriesIdentifier }) => {
() => ({ anchor, color, onClose, onChange, seriesIdentifiers: [seriesIdentifier] }) => {
const seriesName = getSeriesName(seriesIdentifier as XYChartSeriesIdentifier);
const handlChange = (newColor: string | null, event: BaseSyntheticEvent) => {
if (!seriesName) {
Expand Down
16 changes: 3 additions & 13 deletions src/plugins/vis_type_xy/public/vis_component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,12 @@ const VisComponent = (props: VisComponentProps) => {
(
visData: Datatable,
xAccessor: Accessor | AccessorFn,
splitSeriesAccessors: Array<Accessor | AccessorFn>,
splitChartAccessor?: Accessor | AccessorFn
splitSeriesAccessors: Array<Accessor | AccessorFn>
) => {
const splitSeriesAccessorFnMap = getSplitSeriesAccessorFnMap(splitSeriesAccessors);
return (series: XYChartSeriesIdentifier): ClickTriggerEvent | null => {
if (xAccessor !== null) {
return getFilterFromSeriesFn(visData)(
series,
splitSeriesAccessorFnMap,
splitChartAccessor
);
return getFilterFromSeriesFn(visData)(series, splitSeriesAccessorFnMap);
}

return null;
Expand Down Expand Up @@ -373,12 +368,7 @@ const VisComponent = (props: VisComponentProps) => {
config.aspects.series && (config.aspects.series?.length ?? 0) > 0
? getLegendActions(
canFilter,
getFilterEventData(
visData,
xAccessor,
splitSeriesAccessors,
splitChartColumnAccessor ?? splitChartRowAccessor
),
getFilterEventData(visData, xAccessor, splitSeriesAccessors),
handleFilterAction,
getSeriesName
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
Position,
timeFormatter,
Settings,
SeriesIdentifier,
BrushEndListener,
LegendItemListener,
} from '@elastic/charts';
import { getChartDateLabel } from '../../../lib/helper';
import { LocationDurationLine } from '../../../../common/types';
Expand Down Expand Up @@ -75,7 +75,7 @@ export const DurationChartComponent = ({
});
};

const legendToggleVisibility = (legendItem: SeriesIdentifier | null) => {
const legendToggleVisibility: LegendItemListener = ([legendItem]) => {
if (legendItem) {
setHiddenLegends((prevState) => {
if (prevState.includes(legendItem.specId)) {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2138,10 +2138,10 @@
dependencies:
object-hash "^1.3.0"

"@elastic/charts@24.6.0":
version "24.6.0"
resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-24.6.0.tgz#2123c72e69e1e4557be41ae55c085a5a9f75d3b6"
integrity sha512-fL0301EcHxJEYRzdlD4JIA3VXY4qwRPSkRrk8hvJNryTlQWEdyXZF3HNczk0IrgST5cfCOGAWG8IVtO59HxUJw==
"@elastic/charts@25.0.1":
version "25.0.1"
resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-25.0.1.tgz#7c61fc22887b7b1feba3e52fc1b44f21a9c1d0bc"
integrity sha512-UYGO9Yg2+cdJOOs9DjlYeB2Oy/3UMXTtF6/yWZt2iXh7mmW9jI5DqfjgG/9BFSCwQZHUKBZ58d5ZCQfe72maGA==
dependencies:
"@popperjs/core" "^2.4.0"
chroma-js "^2.1.0"
Expand Down

0 comments on commit a3dfecb

Please sign in to comment.