Skip to content

Commit

Permalink
Update dependency @elastic/charts to v65 (main) (elastic#184031)
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored May 29, 2024
1 parent a365891 commit dbc16cb
Show file tree
Hide file tree
Showing 25 changed files with 71 additions and 82 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"@elastic/apm-rum": "^5.16.0",
"@elastic/apm-rum-core": "^5.21.0",
"@elastic/apm-rum-react": "^2.0.2",
"@elastic/charts": "64.1.0",
"@elastic/charts": "65.0.0",
"@elastic/datemath": "5.0.3",
"@elastic/ecs": "^8.11.1",
"@elastic/elasticsearch": "^8.13.0",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
} from '@kbn/expressions-plugin/public';
import type { FieldFormat } from '@kbn/field-formats-plugin/common';
import { getOverridesFor } from '@kbn/chart-expressions-common';
import { PartitionLegendValue } from '@kbn/visualizations-plugin/common/constants';
import { consolidateMetricColumns } from '../../common/utils';
import { DEFAULT_PERCENT_DECIMALS } from '../../common/constants';
import {
Expand Down Expand Up @@ -564,7 +563,7 @@ const PartitionVisComponent = (props: PartitionVisComponentProps) => {
legendColorPicker={props.uiState ? LegendColorPickerWrapper : undefined}
flatLegend={flatLegend}
legendSort={customLegendSort}
showLegendExtra={visParams.legendStats?.[0] === PartitionLegendValue.Value}
legendValues={visParams.legendStats}
onElementClick={([elementEvent]) => {
// this cast is safe because we are rendering a partition chart
const [layerValues] = elementEvent as PartitionElementEvent;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,10 @@ describe('XYChart component', () => {
});
});

test('disabled legend extra by default', () => {
test('disabled legend values by default', () => {
const { args } = sampleArgs();
const component = shallow(<XYChart {...defaultProps} args={args} />);
expect(component.find(Settings).at(0).prop('showLegendExtra')).toEqual(false);
expect(component.find(Settings).at(0).prop('legendValues')).toEqual([]);
});

test('ignores legend extra for ordinal chart', () => {
Expand All @@ -748,7 +748,7 @@ describe('XYChart component', () => {
}}
/>
);
expect(component.find(Settings).at(0).prop('showLegendExtra')).toEqual(false);
expect(component.find(Settings).at(0).prop('legendValues')).toEqual([]);
});

test('shows legend extra for histogram chart', () => {
Expand All @@ -766,7 +766,9 @@ describe('XYChart component', () => {
}}
/>
);
expect(component.find(Settings).at(0).prop('showLegendExtra')).toEqual(true);
expect(component.find(Settings).at(0).prop('legendValues')).toEqual([
XYLegendValue.CurrentAndLastValue,
]);
});

test('applies the mark size ratio', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import {
import {
DEFAULT_LEGEND_SIZE,
LegendSizeToPixels,
XYLegendValue,
} from '@kbn/visualizations-plugin/common/constants';
import { PersistedState } from '@kbn/visualizations-plugin/public';
import { getOverridesFor, ChartSizeSpec } from '@kbn/chart-expressions-common';
Expand Down Expand Up @@ -878,9 +877,7 @@ export function XYChart({
)
: undefined
}
showLegendExtra={
isHistogramViz && legend.legendStats?.[0] === XYLegendValue.CurrentAndLastValue
}
legendValues={isHistogramViz ? legend.legendStats : []}
ariaLabel={args.ariaLabel}
ariaUseDefaultSummary={!args.ariaLabel}
orderOrdinalBinsBy={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
LayoutDirection,
Placement,
Tooltip,
LegendValue,
} from '@elastic/charts';
import { EuiTitle } from '@elastic/eui';
import { RangeFilterParams } from '@kbn/es-query';
Expand Down Expand Up @@ -207,7 +208,7 @@ export const TimelionVisComponent = ({
debugState={window._echDebugStateFlag ?? false}
onBrushEnd={brushEndListener}
showLegend={legend.showLegend}
showLegendExtra={true}
legendValues={[LegendValue.CurrentAndLastValue]}
legendPosition={legend.legendPosition}
onRenderChange={onRenderChange}
onPointerUpdate={syncCursor ? handleCursorUpdate : undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import { i18n } from '@kbn/i18n';
import {
MULTILAYER_TIME_AXIS_STYLE,
renderEndzoneTooltip,
useActiveCursor,
} from '@kbn/charts-plugin/public';
import {
LegendValue,
Axis,
Chart,
Position,
Expand All @@ -27,6 +23,11 @@ import {
Placement,
Tooltip,
} from '@elastic/charts';
import {
MULTILAYER_TIME_AXIS_STYLE,
renderEndzoneTooltip,
useActiveCursor,
} from '@kbn/charts-plugin/public';
import { EuiIcon } from '@elastic/eui';
import { getTimeZone } from '@kbn/visualization-utils';
import { getUISettings, getCharts } from '../../../../services';
Expand Down Expand Up @@ -183,7 +184,7 @@ export const TimeSeries = ({
<Settings
debugState={window._echDebugStateFlag ?? false}
showLegend={legend}
showLegendExtra={true}
legendValues={[LegendValue.CurrentAndLastValue]}
onRenderChange={onRenderChange}
allowBrushingLastHistogramBin={true}
legendPosition={legendPosition}
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/visualize/group5/_tsvb_time_series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visualBuilder.clickSeriesLegendItem('png');
await visualBuilder.clickSeriesLegendItem('php');
legendNames = await visualBuilder.getLegendNames();
expect(legendNames).to.eql(['jpg', 'css', 'gif']);
expect(legendNames).to.eql(['png', 'php']);

await visualize.clickRefresh(true);
legendNames = await visualBuilder.getLegendNames();
expect(legendNames).to.eql(['jpg', 'css', 'gif']);
expect(legendNames).to.eql(['png', 'php']);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ export const DocumentCountChart: FC<DocumentCountChartProps> = (props) => {
baseTheme={chartBaseTheme}
debugState={window._echDebugStateFlag ?? false}
showLegend={false}
showLegendExtra={false}
locale={i18n.getLocale()}
/>
<Axis id="aiops-histogram-left-axis" position={Position.Left} ticks={2} integersOnly />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ export const DocumentCountChartWithBrush: FC<DocumentCountChartProps> = (props)
baseTheme={chartBaseTheme}
debugState={window._echDebugStateFlag ?? false}
showLegend={false}
showLegendExtra={false}
locale={i18n.getLocale()}
/>
<Axis
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
Tooltip,
LIGHT_THEME,
DARK_THEME,
LegendValue,
} from '@elastic/charts';
import { EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -94,7 +95,7 @@ export function ErrorDistribution({ distribution, title, fetchStatus }: Props) {
<Settings
xDomain={{ min, max }}
showLegend
showLegendExtra
legendValues={[LegendValue.CurrentAndLastValue]}
legendPosition={Position.Bottom}
theme={theme.darkMode ? DARK_THEME : LIGHT_THEME}
locale={i18n.getLocale()}
Expand Down
Loading

0 comments on commit dbc16cb

Please sign in to comment.