Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency @elastic/charts to v15 #52621

Closed
wants to merge 11 commits into from
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"**/isomorphic-git/**/base64-js": "^1.2.1",
"**/image-diff/gm/debug": "^2.6.9",
"**/react-dom": "^16.12.0",
"**/react": "^16.12.0",
"**/react-test-renderer": "^16.12.0",
"**/deepmerge": "^4.2.2"
},
Expand All @@ -109,7 +110,7 @@
"dependencies": {
"@babel/core": "^7.5.5",
"@babel/register": "^7.7.0",
"@elastic/charts": "^14.0.0",
"@elastic/charts": "^15.0.3",
"@elastic/datemath": "5.0.2",
"@elastic/ems-client": "1.0.5",
"@elastic/eui": "16.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/apm.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function (serviceName = name) {
if (configFileExists()) conf.configFile = 'config/apm.js';
else conf.active = false;

require('elastic-apm-node').start(conf);
require('elastic-apm-node').start(conf); // eslint-disable-line import/no-unresolved
};

function configFileExists() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ import {
Chart,
HistogramBarSeries,
GeometryValue,
getAnnotationId,
getAxisId,
getSpecId,
LineAnnotation,
Position,
ScaleType,
Expand Down Expand Up @@ -237,34 +234,34 @@ export class DiscoverHistogram extends Component<DiscoverHistogramProps, Discove
theme={chartsTheme}
/>
<Axis
id={getAxisId('discover-histogram-left-axis')}
id="discover-histogram-left-axis"
position={Position.Left}
ticks={5}
title={chartData.yAxisLabel}
/>
<Axis
id={getAxisId('discover-histogram-bottom-axis')}
id="discover-histogram-bottom-axis"
position={Position.Bottom}
title={chartData.xAxisLabel}
tickFormat={this.formatXValue}
ticks={10}
/>
<LineAnnotation
annotationId={getAnnotationId('line-annotation')}
id="line-annotation"
domainType={AnnotationDomainTypes.XDomain}
dataValues={lineAnnotationData}
hideTooltips={true}
style={lineAnnotationStyle}
/>
<RectAnnotation
dataValues={rectAnnotations}
annotationId={getAnnotationId('rect-annotation')}
id="rect-annotation"
zIndex={2}
style={rectAnnotationStyle}
hideTooltips={true}
/>
<HistogramBarSeries
id={getSpecId('discover-histogram')}
id="discover-histogram"
xScaleType={ScaleType.Time}
yScaleType={ScaleType.Linear}
xAccessor="x"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,5 @@ export const ScaleType = {
Time: 'time',
};

export const getSpecId = x => `id:${x}`;
export const getGroupId = x => `groupId:${x}`;

export const BarSeries = () => null;
export const AreaSeries = () => null;

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 @@ -18,8 +18,8 @@
*/

import React from 'react';
import { getSpecId, getGroupId, ScaleType, AreaSeries } from '@elastic/charts';
import { getSeriesColors, getAreaStyles } from '../utils/series_styles';
import { ScaleType, AreaSeries } from '@elastic/charts';
import { getAreaStyles } from '../utils/series_styles';
import { ChartsEntities } from '../model/charts';
import { X_ACCESSOR_INDEX, Y_ACCESSOR_INDEXES } from '../../../constants';

Expand All @@ -41,9 +41,9 @@ export function AreaSeriesDecorator({
useDefaultGroupDomain,
sortIndex,
}) {
const id = getSpecId(seriesId);
const groupId = getGroupId(seriesGroupId);
const customSeriesColors = getSeriesColors(color, id);
const id = seriesId;
const groupId = seriesGroupId;
const customSeriesColors = [color];
const areaSeriesStyle = getAreaStyles({ points, lines, color });

const seriesSettings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

import React from 'react';
import { getSpecId, getGroupId, ScaleType, BarSeries } from '@elastic/charts';
import { getSeriesColors, getBarStyles } from '../utils/series_styles';
import { ScaleType, BarSeries } from '@elastic/charts';
import { getBarStyles } from '../utils/series_styles';
import { ChartsEntities } from '../model/charts';
import { X_ACCESSOR_INDEX, Y_ACCESSOR_INDEXES } from '../../../constants';

Expand All @@ -40,9 +40,9 @@ export function BarSeriesDecorator({
useDefaultGroupDomain,
sortIndex,
}) {
const id = getSpecId(seriesId);
const groupId = getGroupId(seriesGroupId);
const customSeriesColors = getSeriesColors(color, id);
const id = seriesId;
const groupId = seriesGroupId;
const customSeriesColors = [color];
const barSeriesStyle = getBarStyles(bars, color);

const seriesSettings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ import {
Chart,
Position,
Settings,
getAxisId,
getGroupId,
DARK_THEME,
LIGHT_THEME,
getAnnotationId,
AnnotationDomainTypes,
LineAnnotation,
TooltipType,
Expand Down Expand Up @@ -126,7 +123,7 @@ export const TimeSeries = ({
return (
<LineAnnotation
key={id}
annotationId={getAnnotationId(id)}
id={id}
domainType={AnnotationDomainTypes.XDomain}
dataValues={dataValues}
marker={<EuiIcon type={ICON_TYPES_MAP[icon] || 'asterisk'} />}
Expand Down Expand Up @@ -213,8 +210,8 @@ export const TimeSeries = ({
{yAxis.map(({ id, groupId, position, tickFormatter, domain, hide }) => (
<Axis
key={groupId}
groupId={getGroupId(groupId)}
id={getAxisId(id)}
groupId={groupId}
id={id}
position={position}
domain={domain}
hide={hide}
Expand All @@ -225,7 +222,7 @@ export const TimeSeries = ({
))}

<Axis
id={getAxisId('bottom')}
id="bottom"
position={Position.Bottom}
title={xAxisLabel}
tickFormat={xAxisFormatter}
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 @@ -56,12 +56,3 @@ export const getBarStyles = ({ show = true, lineWidth = 0, fill = 1 }, color) =>
},
},
});

export const getSeriesColors = (color, specId) => {
const map = new Map();
const seriesColorsValues = { specId, colorValues: [] };

map.set(seriesColorsValues, color);

return map;
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
* under the License.
*/

import { getBarStyles, getSeriesColors, getAreaStyles } from './series_styles';
import { getBarStyles, getAreaStyles } from './series_styles';

describe('src/legacy/core_plugins/metrics/public/visualizations/views/timeseries/utils/series_styles.js', () => {
let bars;
let color;
let specId;
let points;
let lines;

Expand All @@ -33,7 +32,6 @@ describe('src/legacy/core_plugins/metrics/public/visualizations/views/timeseries
show: true,
};
color = 'rgb(224, 0, 221)';
specId = 'IT';
points = {
lineWidth: 1,
show: true,
Expand All @@ -60,12 +58,6 @@ describe('src/legacy/core_plugins/metrics/public/visualizations/views/timeseries
});
});

describe('getSeriesColors()', () => {
test('should match a snapshot', () => {
expect(getSeriesColors(color, specId)).toMatchSnapshot();
});
});

describe('getAreaStyles()', () => {
test('should match a snapshot', () => {
expect(getAreaStyles({ points, lines, color })).toMatchSnapshot();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/services/elastic_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function ElasticChartProvider({ getService }: FtrProviderContext) {

public async getVisualizationRenderingCount(dataTestSubj: string) {
const chart = await testSubjects.find(dataTestSubj);
const visContainer = await chart.findByCssSelector('.echChart');
const visContainer = await chart.findByCssSelector('.echChartStatus');
const renderingCount = await visContainer.getAttribute('data-ech-render-count');
return Number(renderingCount);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@
import React, { useCallback, useMemo } from 'react';

import { EuiTitle, EuiToolTip, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import {
Axis,
Chart,
getAxisId,
niceTimeFormatter,
Position,
Settings,
TooltipValue,
} from '@elastic/charts';
import { Axis, Chart, niceTimeFormatter, Position, Settings, TooltipValue } from '@elastic/charts';
import { first, last } from 'lodash';
import moment from 'moment';
import { UICapabilities } from 'ui/capabilities';
Expand Down Expand Up @@ -141,13 +133,13 @@ export const MetricsExplorerChart = injectUICapabilities(
/>
))}
<Axis
id={getAxisId('timestamp')}
id="timestamp"
position={Position.Bottom}
showOverlappingTicks={true}
tickFormat={dateFormatter}
/>
<Axis
id={getAxisId('values')}
id="values"
position={Position.Left}
tickFormat={yAxisFormater}
domain={domain}
Expand Down
Loading