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

[7.x] [Lens] Fix display single bar in XYChart Bar Vis (#61452) #61514

Merged
merged 1 commit into from
Mar 27, 2020
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
Expand Up @@ -39,7 +39,12 @@ function sampleArgs() {
formatHint: { id: 'number', params: { pattern: '0,0.000' } },
},
{ id: 'b', name: 'b', formatHint: { id: 'number', params: { pattern: '000,0' } } },
{ id: 'c', name: 'c', formatHint: { id: 'string' } },
{
id: 'c',
name: 'c',
formatHint: { id: 'string' },
meta: { type: 'date-histogram', aggConfigParams: { interval: '10s' } },
},
{ id: 'd', name: 'ColD', formatHint: { id: 'string' } },
],
rows: [
Expand Down Expand Up @@ -179,6 +184,7 @@ describe('xy_expression', () => {
Object {
"max": 1546491600000,
"min": 1546405200000,
"minInterval": 10000,
}
`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { XYArgs, SeriesType, visualizationTypes } from './types';
import { VisualizationContainer } from '../visualization_container';
import { isHorizontalChart } from './state_helpers';
import { UiActionsStart } from '../../../../../../src/plugins/ui_actions/public';
import { parseInterval } from '../../../../../../src/plugins/data/common';
import { getExecuteTriggerActions } from './services';

type InferPropType<T> = T extends React.FunctionComponent<infer P> ? P : T;
Expand Down Expand Up @@ -210,11 +211,14 @@ export function XYChart({
const shouldRotate = isHorizontalChart(layers);

const xTitle = (xAxisColumn && xAxisColumn.name) || args.xTitle;
const interval = parseInterval(xAxisColumn?.meta?.aggConfigParams?.interval);

const xDomain =
data.dateRange && layers.every(l => l.xScaleType === 'time')
? {
min: data.dateRange.fromDate.getTime(),
max: data.dateRange.toDate.getTime(),
minInterval: interval?.asMilliseconds(),
}
: undefined;
return (
Expand Down