Skip to content

Commit

Permalink
Add interval arg
Browse files Browse the repository at this point in the history
  • Loading branch information
VladLasitsa committed Mar 21, 2022
1 parent 0b6db50 commit e557ac6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ export const xyVisFunction: ExpressionFunctionDefinition<
defaultMessage: 'Show values in legend',
}),
},
interval: {
types: ['number'],
help: i18n.translate('expressionXY.xyVis.interval.help', {
defaultMessage: 'Specifies the interval for x-axis in milliseconds',
}),
},
ariaLabel: {
types: ['string'],
help: i18n.translate('expressionXY.xyVis.ariaLabel.help', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export interface XYArgs {
hideEndzones?: boolean;
valuesInLegend?: boolean;
ariaLabel?: string;
interval?: number;
}

export interface XYReferenceLineLayerConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { XYChartProps } from '../../common';
import { getFilteredLayers } from './layers';
import { isDataLayer } from './visualization';

export function calculateMinInterval({ args: { layers }, data }: XYChartProps) {
export function calculateMinInterval({ args: { layers, interval }, data }: XYChartProps) {
const filteredLayers = getFilteredLayers(layers, data);
if (filteredLayers.length === 0) return;
const isTimeViz = filteredLayers.every((l) => isDataLayer(l) && l.xScaleType === 'time');
Expand All @@ -20,6 +20,9 @@ export function calculateMinInterval({ args: { layers }, data }: XYChartProps) {
);

if (!xColumn) return;
if (interval) {
return interval;
}
if (!isTimeViz) {
const histogramInterval = search.aggs.getNumberHistogramIntervalByDatatableColumn(xColumn);
if (typeof histogramInterval === 'number') {
Expand Down

0 comments on commit e557ac6

Please sign in to comment.