-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[NP] Inline buildPointSeriesData and buildHierarchicalData dependencies #61575
Merged
maryia-lapata
merged 38 commits into
elastic:master
from
maryia-lapata:agg-response-cleanup
Apr 9, 2020
Merged
Changes from 31 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
7fafc54
Move buildHierarchicalData to vislib
maryia-lapata 4cd75d1
Move shortened version of buildPointSeriesData to Discover
maryia-lapata 2bc346b
Move buildPointSeriesData to vis_type_vislib
maryia-lapata ba83566
Convert unit tests to jest
maryia-lapata 8283cad
Remove ui/agg_response
maryia-lapata 45b33f8
Merge remote-tracking branch 'remotes/kibana/master' into agg-respons…
maryia-lapata 6d3b22e
Convert point_series files to TS
maryia-lapata 2020a63
Update TS in unit tests
maryia-lapata 9c2cc97
Merge branch 'master' into agg-response-cleanup
elasticmachine d05da68
Convert buildHierarchicalData to TS
maryia-lapata 8e39fbd
Convert buildPointSeriesData to TS in Discover
maryia-lapata abcc032
Clean TS in Discover
maryia-lapata f7609a4
Update TS for buildHierarchicalData
maryia-lapata 4eb83d9
Update buildHierarchicalData unit tests
maryia-lapata 994b93e
Clean up TS in point_series
maryia-lapata 207d32c
Merge branch 'master' into agg-response-cleanup
elasticmachine 3de79f7
Add unit tests fro response_handler.js
maryia-lapata 76f0266
Simplify point_series for Discover
maryia-lapata 5bd3a5d
Return array for data
maryia-lapata f610ffd
Merge branch 'master' into agg-response-cleanup
elasticmachine 15af087
Add check for empty row
maryia-lapata da332e0
Merge branch 'agg-response-cleanup' of https://github.com/maryia-lapa…
maryia-lapata f6a4ed5
Simplify point_series for Discover
maryia-lapata 84fdace
Merge branch 'master' into agg-response-cleanup
elasticmachine bbc4624
Return all points
maryia-lapata e7c88f6
Merge remote-tracking branch 'kibana/master' into agg-response-cleanup
maryia-lapata ad8ab46
Merge remote-tracking branch 'kibana/master' into agg-response-cleanup
maryia-lapata 10eca3f
Specify TS
maryia-lapata a72aa56
Merge branch 'agg-response-cleanup' of https://github.com/maryia-lapa…
maryia-lapata 1168932
Refactoring
maryia-lapata acef340
Merge remote-tracking branch 'upstream/master' into agg-response-cleanup
flash1293 b0d9e60
Merge remote-tracking branch 'kibana/master' into agg-response-cleanup
maryia-lapata 16028af
Merge remote-tracking branch 'kibana/master' into agg-response-cleanup
maryia-lapata 5617d0c
Simplifying
maryia-lapata c0d6422
Merge branch 'agg-response-cleanup' of github.com:maryia-lapata/kiban…
flash1293 5f7b63e
improve types
flash1293 d7e5043
Merge pull request #12 from flash1293/agg-response-cleanup-types
maryia-lapata 838f5cf
Update _get_point.test.ts
maryia-lapata File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
115 changes: 115 additions & 0 deletions
115
src/legacy/core_plugins/kibana/public/discover/np_ready/angular/helpers/point_series.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { uniq } from 'lodash'; | ||
import { Duration, Moment } from 'moment'; | ||
import { Unit } from '@elastic/datemath'; | ||
|
||
import { SerializedFieldFormat } from '../../../../../../../../plugins/expressions/common/types'; | ||
|
||
export interface Column { | ||
id: string; | ||
name: string; | ||
} | ||
|
||
export interface Row { | ||
[key: string]: number | 'NaN'; | ||
} | ||
|
||
export interface Table { | ||
columns: Column[]; | ||
rows: Row[]; | ||
} | ||
|
||
interface HistogramParams { | ||
date: true; | ||
interval: Duration; | ||
intervalESValue: number; | ||
intervalESUnit: Unit; | ||
format: string; | ||
bounds: { | ||
min: Moment; | ||
max: Moment; | ||
}; | ||
} | ||
export interface Dimension { | ||
accessor: 0 | 1; | ||
format: SerializedFieldFormat<{ pattern: string }>; | ||
} | ||
|
||
export interface Dimensions { | ||
x: Dimension & { params: HistogramParams }; | ||
y: Dimension; | ||
} | ||
|
||
interface Ordered { | ||
date: true; | ||
interval: Duration; | ||
intervalESUnit: string; | ||
intervalESValue: number; | ||
min: Moment; | ||
max: Moment; | ||
} | ||
export interface Chart { | ||
values: Array<{ | ||
x: number; | ||
y: number; | ||
}>; | ||
xAxisOrderedValues: number[]; | ||
xAxisFormat: Dimension['format']; | ||
xAxisLabel: Column['name']; | ||
yAxisLabel?: Column['name']; | ||
ordered: Ordered; | ||
} | ||
|
||
export const buildPointSeriesData = (table: Table, dimensions: Dimensions) => { | ||
const { x, y } = dimensions; | ||
const xAccessor = table.columns[x.accessor].id; | ||
const yAccessor = table.columns[y.accessor].id; | ||
const chart = {} as Chart; | ||
|
||
chart.xAxisOrderedValues = uniq(table.rows.map(r => r[xAccessor] as number)); | ||
chart.xAxisFormat = x.format; | ||
chart.xAxisLabel = table.columns[x.accessor].name; | ||
|
||
const { intervalESUnit, intervalESValue, interval, bounds } = x.params; | ||
chart.ordered = { | ||
date: true, | ||
interval, | ||
intervalESUnit, | ||
intervalESValue, | ||
min: bounds.min, | ||
max: bounds.max, | ||
}; | ||
|
||
chart.yAxisLabel = table.columns[y.accessor].name; | ||
|
||
chart.values = table.rows | ||
.filter(row => row && row[yAccessor] !== 'NaN') | ||
.map(row => ({ | ||
x: row[xAccessor] as number, | ||
y: row[yAccessor] as number, | ||
})); | ||
|
||
if (!chart.values.length) { | ||
chart.values.push({} as any); | ||
} | ||
|
||
return chart; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 0 additions & 137 deletions
137
src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/response_handlers.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can easily remove this lines, by a modification of histogram.tsx
kibana/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/histogram.tsx
Line 231 in 82e048a
e.g. by using
you no longer need to push this empty object, and the histogram is displaying 'No data to display'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, done.