Skip to content

Commit

Permalink
Update dependency @elastic/charts to v18.1.0 (elastic#60578)
Browse files Browse the repository at this point in the history
  • Loading branch information
markov00 committed Mar 20, 2020
1 parent e466309 commit 332fc6f
Show file tree
Hide file tree
Showing 39 changed files with 244 additions and 174 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"dependencies": {
"@babel/core": "^7.5.5",
"@babel/register": "^7.7.0",
"@elastic/charts": "^17.1.1",
"@elastic/charts": "^18.1.0",
"@elastic/datemath": "5.0.2",
"@elastic/ems-client": "7.7.0",
"@elastic/eui": "20.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"abortcontroller-polyfill": "^1.4.0",
"@elastic/eui": "20.0.2",
"@kbn/babel-preset": "1.0.0",
"@elastic/charts": "^17.1.1",
"@elastic/charts": "^18.1.0",
"@kbn/dev-utils": "1.0.0",
"@kbn/i18n": "1.0.0",
"@yarnpkg/lockfile": "^1.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
TooltipValue,
TooltipType,
ElementClickListener,
XYChartElementEvent,
} from '@elastic/charts';

import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -140,7 +141,7 @@ export class DiscoverHistogram extends Component<DiscoverHistogramProps, Discove
};

public onElementClick = (xInterval: number): ElementClickListener => ([elementData]) => {
const startRange = elementData[0].x;
const startRange = (elementData as XYChartElementEvent)[0].x;

const range = {
from: startRange,
Expand Down

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

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 @@ -43,15 +43,14 @@ export function AreaSeriesDecorator({
}) {
const id = seriesId;
const groupId = seriesGroupId;
const customSeriesColors = [color];
const areaSeriesStyle = getAreaStyles({ points, lines, color });

const seriesSettings = {
id,
name,
groupId,
data,
customSeriesColors,
color,
hideInLegend,
xAccessor: X_ACCESSOR_INDEX,
yAccessors: Y_ACCESSOR_INDEXES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ export function BarSeriesDecorator({
}) {
const id = seriesId;
const groupId = seriesGroupId;
const customSeriesColors = [color];
const barSeriesStyle = getBarStyles(bars, color);

const seriesSettings = {
id,
name,
groupId,
data,
customSeriesColors,
color,
hideInLegend,
xAccessor: X_ACCESSOR_INDEX,
yAccessors: Y_ACCESSOR_INDEXES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const TimeSeries = ({
<Chart ref={chartRef} renderer="canvas" className={classes}>
<Settings
showLegend={legend}
showLegendExtra={true}
legendPosition={legendPosition}
onBrushEnd={onBrush}
animateData={false}
Expand Down
6 changes: 3 additions & 3 deletions test/functional/page_objects/visual_builder_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro

public async getRhythmChartLegendValue(nth = 0) {
await PageObjects.visChart.waitForVisualizationRenderingStabilized();
const metricValue = (
await find.allByCssSelector(`.echLegendItem .echLegendItem__displayValue`)
)[nth];
const metricValue = (await find.allByCssSelector(`.echLegendItem .echLegendItem__extra`))[
nth
];
await metricValue.moveMouseTo();
return await metricValue.getVisibleText();
}
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 @@ -4,8 +4,15 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { Axis } from '@elastic/charts';
import { AreaSeries, BarSeries, Position, LineSeries, Settings, ScaleType } from '@elastic/charts';
import {
AreaSeries,
Axis,
BarSeries,
Position,
LineSeries,
Settings,
ScaleType,
} from '@elastic/charts';
import { xyChart, XYChart } from './xy_expression';
import { LensMultiTable } from '../types';
import React from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export function XYChart({ data, args, formatFactory, timeZone, chartTheme }: XYC
<Settings
showLegend={legend.isVisible ? chartHasMoreThanOneSeries : legend.isVisible}
legendPosition={legend.position}
showLegendDisplayValue={false}
showLegendExtra={false}
theme={chartTheme}
rotation={shouldRotate ? 90 : 0}
xDomain={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const AreaChartBaseComponent = ({
xAccessor="x"
yAccessors={['y']}
areaSeriesStyle={getSeriesLineStyle()}
customSeriesColors={series.color ? [series.color] : undefined}
color={series.color ? series.color : undefined}
/>
) : null;
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const BarChartBaseComponent = ({
splitSeriesAccessors={['g']}
data={series.value!}
stackAccessors={get('configs.series.stackAccessors', chartConfigs)}
customSeriesColors={series.color ? [series.color] : undefined}
color={series.color ? series.color : undefined}
/>
) : null;
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface ChartData {

export interface ChartSeriesConfigs {
customHeight?: number;
customSeriesColors?: string[];
color?: string[];
series?: {
xScaleType?: ScaleType | undefined;
yScaleType?: ScaleType | undefined;
Expand Down Expand Up @@ -110,7 +110,7 @@ export const chartDefaultSettings = {
rendering: chartDefaultRendering,
animatedData: false,
showLegend: false,
showLegendDisplayValue: false,
showLegendExtra: false,
debug: false,
legendPosition: Position.Bottom,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { BarChart } from '../charts/barchart';
import { HeaderSection } from '../header_section';
import { MatrixLoader } from './matrix_loader';
import { Panel } from '../panel';
import { getBarchartConfigs, getCustomChartData } from '../../components/matrix_histogram/utils';
import { getBarchartConfigs, getCustomChartData } from './utils';
import { useQuery } from '../../containers/matrix_histogram';
import {
MatrixHistogramProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export interface BarchartConfigs {
legendPosition: Position;
onBrushEnd: UpdateDateRange;
showLegend: boolean;
showLegendExtra: boolean;
theme: {
scales: {
barsPadding: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const getBarchartConfigs = ({
legendPosition: legendPosition ?? Position.Right,
onBrushEnd,
showLegend: showLegend ?? true,
showLegendExtra: true,
theme: {
scales: {
barsPadding: 0.08,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import {
Axis,
Chart,
getAxisId,
getSpecId,
HistogramBarSeries,
Position,
Settings,
Expand Down Expand Up @@ -46,9 +44,9 @@ export const SignalsHistogram = React.memo<HistogramSignalsProps>(
const theme = useTheme();

const chartSize: ChartSizeArray = useMemo(() => ['100%', chartHeight], [chartHeight]);
const xAxisId = useMemo(() => getAxisId('signalsHistogramAxisX'), []);
const yAxisId = useMemo(() => getAxisId('signalsHistogramAxisY'), []);
const id = useMemo(() => getSpecId('signalsHistogram'), []);
const xAxisId = 'signalsHistogramAxisX';
const yAxisId = 'signalsHistogramAxisY';
const id = 'signalsHistogram';
const yAccessors = useMemo(() => ['y'], []);
const splitSeriesAccessors = useMemo(() => ['g'], []);
const tickFormat = useMemo(() => histogramDateTimeFormatter([from, to]), [from, to]);
Expand All @@ -69,6 +67,7 @@ export const SignalsHistogram = React.memo<HistogramSignalsProps>(
legendPosition={legendPosition}
onBrushEnd={updateDateRange}
showLegend
showLegendExtra
theme={theme}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export const DurationChartComponent = ({ locationDurationLines, loading }: Durat
<Chart>
<Settings
xDomain={{ min, max }}
showLegend={true}
showLegend
showLegendExtra
legendPosition={Position.Bottom}
onBrushEnd={onBrushEnd}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const MonitorBarSeries = ({ dangerColor, histogramSeries }: MonitorBarSer
/>
<BarSeries
id={id}
customSeriesColors={[dangerColor]}
color={dangerColor}
data={(histogramSeries || []).map(({ timestamp, down }) => [timestamp, down])}
name={i18n.translate('xpack.uptime.monitorList.downLineSeries.downLabel', {
defaultMessage: 'Down checks',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const PingHistogramComponent: React.FC<PingHistogramComponentProps> = ({
/>

<BarSeries
customSeriesColors={[danger]}
color={danger}
data={histogram.map(({ x, downCount }) => [x, downCount || 0])}
id={downSpecId}
name={i18n.translate('xpack.uptime.snapshotHistogram.series.downLabel', {
Expand All @@ -136,7 +136,7 @@ export const PingHistogramComponent: React.FC<PingHistogramComponentProps> = ({
yScaleType="linear"
/>
<BarSeries
customSeriesColors={[gray]}
color={gray}
data={histogram.map(({ x, upCount }) => [x, upCount || 0])}
id={upMonitorsId}
name={upMonitorsId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const MetricsExplorerAreaChart = ({ metric, id, series, type, stack }: Pr
data={series.rows}
stackAccessors={stack ? ['timestamp'] : void 0}
areaSeriesStyle={seriesAreaStyle}
customSeriesColors={[color]}
color={color}
/>
);
};
Expand Down Expand Up @@ -101,7 +101,7 @@ export const MetricsExplorerBarChart = ({ metric, id, series, stack }: Props) =>
data={series.rows}
stackAccessors={stack ? ['timestamp'] : void 0}
barSeriesStyle={seriesBarStyle}
customSeriesColors={[color]}
color={color}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const LogEntryRateBarChart: React.FunctionComponent<{
tooltip={tooltipProps}
theme={isDarkMode ? DARK_THEME : LIGHT_THEME}
showLegend
showLegendExtra
legendPosition="right"
xDomain={{ min: timeRange.startTime, max: timeRange.endTime }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ export const ChartSectionVis = ({
tooltip={tooltipProps}
onBrushEnd={handleTimeChange}
theme={getChartTheme(isDarkMode)}
showLegend={true}
showLegend
showLegendExtra
legendPosition="right"
/>
</Chart>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const AreaChart = ({ id, color, series, name, type, stack }: Props) => {
yAccessors={['value']}
data={series.data}
areaSeriesStyle={style}
customSeriesColors={color ? [color] : void 0}
color={color ? color : void 0}
stackAccessors={stack ? ['timestamp'] : void 0}
/>
);
Expand All @@ -80,7 +80,7 @@ export const BarChart = ({ id, color, series, name, type, stack }: Props) => {
yAccessors={['value']}
data={series.data}
barSeriesStyle={style}
customSeriesColors={color ? [color] : void 0}
color={color ? color : void 0}
stackAccessors={stack ? ['timestamp'] : void 0}
/>
);
Expand Down
Loading

0 comments on commit 332fc6f

Please sign in to comment.