forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Visualize] New heatmap implementation with elastic-charts (elastic#1…
…18338) * [WIP][Heatmap] Creates implementation with elastic-charts * Fix types and connection with vislib * Add coloring options * Brush, click events, coloring etc * Cleaning up the expression function * Add legend picker, fix sorting and other fixes * Further fixes * Use the shared expression to Lens and cleanup * PrepareLogTables for new expression function * Use common renderer and expression function with lens * Fix i18n * Small tweaks * Add unit tests * Adds a unit test to the heatmap component * update plugin list * Fix types * Fix types * update limits * Change to the expression function * Cleanup translations * Refactor to use vis * Fix types * further cleanup of the translations * register new setting * Fix sorting for histogram * Adds functional tests for the new nisualize heatmap * Cleanup * Fix * Apply PR comments * Address PR comments * Fix i18n * Fix i18n * Makes the <Heatmap /> id dynamic * reverse * fix translation file * Apply design PR comments * Fix package * More fixes * Fix brush problem Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
Showing
100 changed files
with
5,690 additions
and
806 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
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
12 changes: 12 additions & 0 deletions
12
src/plugins/chart_expressions/expression_heatmap/common/constants.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,12 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
export const EXPRESSION_HEATMAP_NAME = 'heatmap'; | ||
export const EXPRESSION_HEATMAP_LEGEND_NAME = 'heatmap_legend'; | ||
export const EXPRESSION_HEATMAP_GRID_NAME = 'heatmap_grid'; | ||
export const HEATMAP_FUNCTION_RENDERER_NAME = 'heatmap_renderer'; |
103 changes: 103 additions & 0 deletions
103
...xpression_heatmap/common/expression_functions/__snapshots__/heatmap_function.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
77 changes: 77 additions & 0 deletions
77
...chart_expressions/expression_heatmap/common/expression_functions/heatmap_function.test.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,77 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { heatmapFunction } from './heatmap_function'; | ||
import type { HeatmapArguments } from '../../common'; | ||
import { functionWrapper } from '../../../../expressions/common/expression_functions/specs/tests/utils'; | ||
import { Datatable } from '../../../../expressions/common/expression_types/specs'; | ||
import { EXPRESSION_HEATMAP_GRID_NAME, EXPRESSION_HEATMAP_LEGEND_NAME } from '../constants'; | ||
|
||
describe('interpreter/functions#heatmap', () => { | ||
const fn = functionWrapper(heatmapFunction()); | ||
const context: Datatable = { | ||
type: 'datatable', | ||
rows: [{ 'col-0-1': 0 }], | ||
columns: [ | ||
{ id: 'col-0-1', name: 'Count', meta: { type: 'number' } }, | ||
{ id: 'col-1-2', name: 'Dest', meta: { type: 'string' } }, | ||
], | ||
}; | ||
const args: HeatmapArguments = { | ||
percentageMode: false, | ||
legend: { | ||
isVisible: true, | ||
position: 'top', | ||
type: EXPRESSION_HEATMAP_LEGEND_NAME, | ||
}, | ||
gridConfig: { | ||
isCellLabelVisible: true, | ||
isYAxisLabelVisible: true, | ||
isXAxisLabelVisible: true, | ||
type: EXPRESSION_HEATMAP_GRID_NAME, | ||
}, | ||
palette: { | ||
type: 'palette', | ||
name: '', | ||
params: { | ||
colors: ['rgb(0, 0, 0, 0)', 'rgb(112, 38, 231)'], | ||
stops: [0, 10000], | ||
gradient: false, | ||
rangeMin: 0, | ||
rangeMax: 150, | ||
range: 'number', | ||
}, | ||
}, | ||
showTooltip: true, | ||
highlightInHover: false, | ||
xAccessor: 'col-1-2', | ||
valueAccessor: 'col-0-1', | ||
}; | ||
|
||
it('returns an object with the correct structure', () => { | ||
const actual = fn(context, args, undefined); | ||
|
||
expect(actual).toMatchSnapshot(); | ||
}); | ||
|
||
it('logs correct datatable to inspector', async () => { | ||
let loggedTable: Datatable; | ||
const handlers = { | ||
inspectorAdapters: { | ||
tables: { | ||
logDatatable: (name: string, datatable: Datatable) => { | ||
loggedTable = datatable; | ||
}, | ||
}, | ||
}, | ||
}; | ||
await fn(context, args, handlers as any); | ||
|
||
expect(loggedTable!).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.