diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/histogram.tsx b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/histogram.tsx index f608e86184fa1..7cb309f64fb50 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/histogram.tsx +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/histogram.tsx @@ -221,14 +221,14 @@ export class DiscoverHistogram extends Component domainStart ? domainStart : data[0].x; const domainMax = domainEnd - xInterval > lastXValue ? domainEnd - xInterval : lastXValue; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/helpers/point_series.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/helpers/point_series.ts index 73d489a8c4368..10e41792f5cf8 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/helpers/point_series.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/helpers/point_series.ts @@ -18,7 +18,7 @@ */ import { uniq } from 'lodash'; -import moment, { Duration } from 'moment'; +import { Duration, Moment } from 'moment'; import { Unit } from '@elastic/datemath'; import { SerializedFieldFormat } from '../../../../../../../../plugins/expressions/common/types'; @@ -43,9 +43,9 @@ interface HistogramParams { intervalESValue: number; intervalESUnit: Unit; format: string; - bounds?: { - min: string | number; - max: string | number; + bounds: { + min: Moment; + max: Moment; }; } export interface Dimension { @@ -60,11 +60,11 @@ export interface Dimensions { interface Ordered { date: true; - interval: Duration | number; + interval: Duration; intervalESUnit: string; intervalESValue: number; - min?: number; - max?: number; + min: Moment; + max: Moment; } export interface Chart { values: Array<{ @@ -91,20 +91,13 @@ export const buildPointSeriesData = (table: Table, dimensions: Dimensions) => { const { intervalESUnit, intervalESValue, interval, bounds } = x.params; chart.ordered = { date: true, - interval: moment.duration(interval), + interval, intervalESUnit, intervalESValue, + min: bounds.min, + max: bounds.max, }; - if (bounds) { - chart.ordered.min = isNaN(bounds.min as number) - ? Date.parse(bounds.min as string) - : (bounds.min as number); - chart.ordered.max = isNaN(bounds.max as number) - ? Date.parse(bounds.max as string) - : (bounds.max as number); - } - chart.yAxisLabel = table.columns[y.accessor].name; chart.values = []; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts b/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts index 7c5bdb9a105ac..475555f3a15f3 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts @@ -36,7 +36,7 @@ function tableVisResponseHandler(table: Table, dimensions: Dimensions) { let splitIndex = 0; table.rows.forEach((row, rowIndex) => { - const splitValue = row[splitColumn.id]; + const splitValue = row[splitColumn.id] as string; if (!splitMap.hasOwnProperty(splitValue)) { splitMap[splitValue] = splitIndex++; @@ -49,15 +49,15 @@ function tableVisResponseHandler(table: Table, dimensions: Dimensions) { row: rowIndex, table, tables: [] as Table[], - }; + } as any; tableGroup.tables.push({ - $parent: tableGroup as TableParent, + $parent: tableGroup, columns: table.columns, rows: [], }); - converted.tables.push(tableGroup as TableParent); + converted.tables.push(tableGroup); } const tableIndex = splitMap[splitValue]; @@ -328,8 +328,8 @@ describe('buildHierarchicalData convertTable', () => { { id: 'col-1-1', name: 'Count' }, ], rows: [ - { 'col-0-agg_2': { gte: 0, lt: 1000 } as any, 'col-1-1': 606 }, - { 'col-0-agg_2': { gte: 1000, lt: 2000 } as any, 'col-1-1': 298 }, + { 'col-0-agg_2': { gte: 0, lt: 1000 }, 'col-1-1': 606 }, + { 'col-0-agg_2': { gte: 1000, lt: 2000 }, 'col-1-1': 298 }, ], }; dimensions = { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts b/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts index 7f79f78f52306..2c6d62ed084b5 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts @@ -46,7 +46,7 @@ interface Slice { table: Table; row: number; column: number; - value: string | number; + value: string | number | object; }; } diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts b/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts index 00243af088f25..6b4b19fca0eae 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts @@ -86,7 +86,7 @@ type Ordered = (DateHistogramOrdered | HistogramOrdered) & { export interface Chart { aspects: Aspects; series: Serie[]; - xAxisOrderedValues?: Array; + xAxisOrderedValues?: Array; xAxisFormat?: Dimension['format']; xAxisLabel?: Column['name']; yAxisFormat?: Dimension['format']; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/types.ts b/src/legacy/core_plugins/vis_type_vislib/public/vislib/types.ts index 0fcd62a6410f6..ad59603663b84 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/types.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/vislib/types.ts @@ -24,7 +24,7 @@ export interface Column { } export interface Row { - [key: string]: number | string; + [key: string]: number | string | object; } export interface TableParent {