kibana/test/functional/page_objects/visualize_chart_page.ts

457 lines
16 KiB
TypeScript
Raw Normal View History

/*
* 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 { Position } from '@elastic/charts';
import chroma from 'chroma-js';
import { FtrService } from '../ftr_provider_context';
[Pie] New implementation of the vislib pie chart with es-charts (#83929) * es lint fix * Add formatter on the buckets labels * Config the new plugin, toggle tooltip * Aff filtering on slice click * minor fixes * fix eslint error * use legacy palette for now * Add color picker to legend colors * Fix ts error * Add legend actions * Fix bug on Color Picker and remove local state as it is unecessary * Fix some bugs on colorPicker * Add setting for the user to select between the legacy palette or the eui ones * small enhancements, treat empty labels with (empty) * Fix color picker bugs with multiple layers * fixes on internationalization * Create migration script for pie chart and legacy palette * Add unit tests (wip) and a small refactoring * Add unit tests and move some things to utils, useMemo and useCallback where it should * Add jest config file * Fix jest test * fix api integration failure * Fix to_ast_esaggs for new pie plugin * Close legendColorPicker popover when user clicks outside * Fix warning * Remove getter/setters and refactor * Remove kibanaUtils from pie plugin as it is not needed * Add new values to the migration script * Fix bug on not changing color for expty string * remove from migration script as they don't need it * Fix editor settings for old and new implementation * fix uistate type * Disable split chart for the new plugin for now * Remove temp folder * Move translations to the pie plugin * Fix CI failures * Add unit test for the editor config * Types cleanup * Fix types vol2 * Minor improvements * Display data on the inspector * Cleanup translations * Add telemetry for new editor pie options * Fix missing translation * Use Eui component to detect click outside the color picker popover * Retrieve color picker from editor and syncColors on dashboard * Lazy load palette service * Add the new plugin to ts references, fix tests, refactor * Fix ci failure * Move charts library switch to vislib plugin * Remove cyclic dependencies * Modify license headers * Move charts library switch to visualizations plugin * Fix i18n on the switch moved to visualizations plugin * Update license * Fix tests * Fix bugs created by new charts version * Fix the i18n switch problem * Update the migration script * Identify if colorIsOverwritten or not * Small multiples, missing the click event * Fixes the UX for small multiples part1 * Distinct colors per slice implementation * Fix ts references problem * Fix some small multiples bugs * Add unit tests * Fix ts ref problem * Fix TS problems caused by es-charts new version * Update the sample pie visualizations with the new eui palette * Allows filtering by the small multiples value * Apply sortPredicate on partition layers * Fix vilib test * Enable functional tests for new plugin * Fix some functional tests * Minor fix * Fix functional tests * Fix dashboard tests * Fix all dashboard tests * Apply some improvements * Explicit params instead of visConfig Json * Fix i18n failure * Add top level setting * Minor fix * Fix jest tests * Address PR comments * Fix i18n error * fix functional test * Add an icon tip on the distinct colors per slice switch * Fix some of the PR comments * Address more PR comments * Small fix * Functional test * address some PR comments * Add padding to the pie container * Add a max width to the container * Improve dashboard functional test * Move the labels expression function to the pie plugin * Fix i18n * Fix functional test * Apply PR comments * Do not forget to also add the migration to them embeddable too :D * Fix distinct colors for IP range layer * Remove console errors * Fix small mulitples colors with multiple layers * Fix lint problem * Fix problems created from merging with master * Address PR comments * Change the config in order the pie chart to not appear so huge on the editor * Address PR comments * Change the max percentage digits to 4 * Change the max size to 1000 Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-03 17:17:14 +02:00
const pieChartSelector = 'visTypePieChart';
export class VisualizeChartPageObject extends FtrService {
private readonly testSubjects = this.ctx.getService('testSubjects');
private readonly config = this.ctx.getService('config');
private readonly find = this.ctx.getService('find');
private readonly log = this.ctx.getService('log');
private readonly retry = this.ctx.getService('retry');
private readonly kibanaServer = this.ctx.getService('kibanaServer');
private readonly elasticChart = this.ctx.getService('elasticChart');
private readonly dataGrid = this.ctx.getService('dataGrid');
private readonly common = this.ctx.getPageObject('common');
private readonly header = this.ctx.getPageObject('header');
private readonly defaultFindTimeout = this.config.get('timeouts.find');
public async getEsChartDebugState(chartSelector: string) {
return await this.elasticChart.getChartDebugData(chartSelector);
}
/**
* Is new charts library advanced setting enabled
*/
public async isNewChartsLibraryEnabled(): Promise<boolean> {
const legacyChartsLibrary =
Boolean(
await this.kibanaServer.uiSettings.get('visualization:visualize:legacyPieChartsLibrary')
) ?? true;
const enabled = !legacyChartsLibrary;
this.log.debug(`-- isNewChartsLibraryEnabled = ${enabled}`);
return enabled;
}
/**
* Is new charts library enabled and an area, line or histogram chart exists
*/
public async isNewLibraryChart(chartSelector: string): Promise<boolean> {
const enabled = await this.isNewChartsLibraryEnabled();
if (!enabled) {
this.log.debug(`-- isNewLibraryChart = false`);
return false;
}
// check if enabled but not a line, area, histogram or pie chart
if (await this.find.existsByCssSelector('.visLib__chart', 1)) {
const chart = await this.find.byCssSelector('.visLib__chart');
const chartType = await chart.getAttribute('data-vislib-chart-type');
if (!['line', 'area', 'histogram', 'pie'].includes(chartType)) {
this.log.debug(`-- isNewLibraryChart = false`);
return false;
}
}
if (!(await this.elasticChart.hasChart(chartSelector, 1))) {
// not be a vislib chart type
this.log.debug(`-- isNewLibraryChart = false`);
return false;
}
this.log.debug(`-- isNewLibraryChart = true`);
return true;
}
public async getYAxisTitle(selector: string) {
const xAxis = (await this.getEsChartDebugState(selector))?.axes?.y ?? [];
return xAxis[0]?.title;
}
public async getXAxisLabels(selector: string) {
const [xAxis] = (await this.getEsChartDebugState(selector))?.axes?.x ?? [];
return xAxis?.labels;
}
public async getYAxisLabels(selector: string, nth = 0) {
const yAxis = (await this.getEsChartDebugState(selector))?.axes?.y ?? [];
return yAxis[nth]?.labels;
}
public async getYAxisLabelsAsNumbers(selector: string) {
const [yAxis] = (await this.getEsChartDebugState(selector))?.axes?.y ?? [];
return yAxis?.values;
}
/**
* Gets the chart data and scales it based on chart height and label.
* @param dataLabel data-label value
* @param selector chart selector
[Timelion Viz] Add functional tests (#107287) * First draft migrate timelion to elastic-charts * Some refactoring. Added brush event. * Added title. Some refactoring * Fixed some type problems. Added logic for yaxes function * Fixed some types, added missing functionality for yaxes * Fixed some types, added missing functionality for stack property * Fixed unit test * Removed unneeded code * Some refactoring * Some refactoring * Fixed some remarks. * Fixed some styles * Added themes. Removed unneeded styles in BarSeries * removed unneeded code. * Fixed some comments * Fixed vertical cursor across Timelion visualizations of a dashboad * Fix some problems with styles * Use RxJS instead of jQuery * Remove unneeded code * Fixed some problems * Fixed unit test * Fix CI * Fix eslint * Fix some gaps * Fix legend columns * Some fixes * add 2 versions of Timeline app * fix CI * cleanup code * fix CI * fix legend position * fix some cases * fix some cases * remove extra casting * cleanup code * fix issue with static * fix header formatter * fix points * fix ts error * Fix yaxis behavior * Fix some case with yaxis * Add deprecation message and update asciidoc * Fix title * some text improvements * [Timelion Viz] Add functional tests * Add more complex cases for _timelion * Update test expected data Co-authored-by: Uladzislau Lasitsa <Uladzislau_Lasitsa@epam.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Alexey Antonov <alexwizp@gmail.com>
2021-08-04 20:56:46 +02:00
* @param shouldContainXAxisData boolean value for mapping points, false by default
*
* Returns an array of height values
*/
[Timelion Viz] Add functional tests (#107287) * First draft migrate timelion to elastic-charts * Some refactoring. Added brush event. * Added title. Some refactoring * Fixed some type problems. Added logic for yaxes function * Fixed some types, added missing functionality for yaxes * Fixed some types, added missing functionality for stack property * Fixed unit test * Removed unneeded code * Some refactoring * Some refactoring * Fixed some remarks. * Fixed some styles * Added themes. Removed unneeded styles in BarSeries * removed unneeded code. * Fixed some comments * Fixed vertical cursor across Timelion visualizations of a dashboad * Fix some problems with styles * Use RxJS instead of jQuery * Remove unneeded code * Fixed some problems * Fixed unit test * Fix CI * Fix eslint * Fix some gaps * Fix legend columns * Some fixes * add 2 versions of Timeline app * fix CI * cleanup code * fix CI * fix legend position * fix some cases * fix some cases * remove extra casting * cleanup code * fix issue with static * fix header formatter * fix points * fix ts error * Fix yaxis behavior * Fix some case with yaxis * Add deprecation message and update asciidoc * Fix title * some text improvements * [Timelion Viz] Add functional tests * Add more complex cases for _timelion * Update test expected data Co-authored-by: Uladzislau Lasitsa <Uladzislau_Lasitsa@epam.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Alexey Antonov <alexwizp@gmail.com>
2021-08-04 20:56:46 +02:00
public async getAreaChartData(
dataLabel: string,
selector: string,
[Timelion Viz] Add functional tests (#107287) * First draft migrate timelion to elastic-charts * Some refactoring. Added brush event. * Added title. Some refactoring * Fixed some type problems. Added logic for yaxes function * Fixed some types, added missing functionality for yaxes * Fixed some types, added missing functionality for stack property * Fixed unit test * Removed unneeded code * Some refactoring * Some refactoring * Fixed some remarks. * Fixed some styles * Added themes. Removed unneeded styles in BarSeries * removed unneeded code. * Fixed some comments * Fixed vertical cursor across Timelion visualizations of a dashboad * Fix some problems with styles * Use RxJS instead of jQuery * Remove unneeded code * Fixed some problems * Fixed unit test * Fix CI * Fix eslint * Fix some gaps * Fix legend columns * Some fixes * add 2 versions of Timeline app * fix CI * cleanup code * fix CI * fix legend position * fix some cases * fix some cases * remove extra casting * cleanup code * fix issue with static * fix header formatter * fix points * fix ts error * Fix yaxis behavior * Fix some case with yaxis * Add deprecation message and update asciidoc * Fix title * some text improvements * [Timelion Viz] Add functional tests * Add more complex cases for _timelion * Update test expected data Co-authored-by: Uladzislau Lasitsa <Uladzislau_Lasitsa@epam.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Alexey Antonov <alexwizp@gmail.com>
2021-08-04 20:56:46 +02:00
shouldContainXAxisData = false
) {
const areas = (await this.getEsChartDebugState(selector))?.areas ?? [];
const points = areas.find(({ name }) => name === dataLabel)?.lines.y1.points ?? [];
return shouldContainXAxisData ? points.map(({ x, y }) => [x, y]) : points.map(({ y }) => y);
}
/**
* Returns the paths that compose an area chart.
* @param dataLabel data-label value
*/
public async getAreaChartPaths(dataLabel: string, selector: string) {
const areas = (await this.getEsChartDebugState(selector))?.areas ?? [];
const path = areas.find(({ name }) => name === dataLabel)?.path ?? '';
return path.split('L');
}
/**
* Gets the dots and normalizes their height.
* @param dataLabel data-label value
* @param axis axis value, 'ValueAxis-1' by default
*/
public async getLineChartData(selector: string, dataLabel = 'Count') {
// For now lines are rendered as areas to enable stacking
const areas = (await this.getEsChartDebugState(selector))?.areas ?? [];
const lines = areas.map(({ lines: { y1 }, name, color }) => ({ ...y1, name, color }));
const points = lines.find(({ name }) => name === dataLabel)?.points ?? [];
return points.map(({ y }) => y);
}
/**
* Returns bar chart data in pixels
* @param dataLabel data-label value
*/
public async getBarChartData(selector: string, dataLabel = 'Count') {
const bars = (await this.getEsChartDebugState(selector))?.bars ?? [];
const values = bars.find(({ name }) => name === dataLabel)?.bars ?? [];
return values.map(({ y }) => y);
}
private async toggleLegend(force = false) {
const isVisTypePieChart = await this.isNewLibraryChart(pieChartSelector);
const legendSelector = force || isVisTypePieChart ? '.echLegend' : '.visLegend';
await this.retry.try(async () => {
const isVisible = await this.find.existsByCssSelector(legendSelector);
if (!isVisible) {
await this.testSubjects.click('vislibToggleLegend');
}
});
}
public async filterLegend(name: string, force = false) {
await this.toggleLegend(force);
await this.testSubjects.click(`legend-${name}`);
const filterIn = await this.testSubjects.find(`legend-${name}-filterIn`);
await filterIn.click();
await this.waitForVisualizationRenderingStabilized();
}
public async doesLegendColorChoiceExist(color: string) {
return await this.testSubjects.exists(`visColorPickerColor-${color}`);
}
public async selectNewLegendColorChoice(color: string) {
await this.testSubjects.click(`visColorPickerColor-${color}`);
}
public async doesSelectedLegendColorExistForXY(color: string, selector: string) {
const items = (await this.getEsChartDebugState(selector))?.legend?.items ?? [];
return items.some(({ color: c }) => c === color);
}
public async doesSelectedLegendColorExistForPie(matchingColor: string) {
if (await this.isNewLibraryChart(pieChartSelector)) {
const hexMatchingColor = chroma(matchingColor).hex().toUpperCase();
const slices =
(await this.getEsChartDebugState(pieChartSelector))?.partition?.[0]?.partitions ?? [];
return slices.some(({ color }) => {
return hexMatchingColor === chroma(color).hex().toUpperCase();
});
}
return await this.testSubjects.exists(`legendSelectedColor-${matchingColor}`);
}
public async expectError() {
if (!this.isNewLibraryChart(pieChartSelector)) {
await this.testSubjects.existOrFail('vislibVisualizeError');
}
}
public async getVisualizationRenderingCount() {
const visualizationLoader = await this.testSubjects.find('visualizationLoader');
const renderingCount = await visualizationLoader.getAttribute('data-rendering-count');
return Number(renderingCount);
}
public async waitForRenderingCount(minimumCount = 1) {
await this.retry.waitFor(
`rendering count to be greater than or equal to [${minimumCount}]`,
async () => {
const currentRenderingCount = await this.getVisualizationRenderingCount();
this.log.debug(`-- currentRenderingCount=${currentRenderingCount}`);
this.log.debug(`-- expectedCount=${minimumCount}`);
return currentRenderingCount >= minimumCount;
}
);
}
public async waitForVisualizationRenderingStabilized() {
await this.header.waitUntilLoadingHasFinished();
// assuming rendering is done when data-rendering-count is constant within 1000 ms
await this.retry.waitFor('rendering count to stabilize', async () => {
const firstCount = await this.getVisualizationRenderingCount();
this.log.debug(`-- firstCount=${firstCount}`);
await this.common.sleep(2000);
const secondCount = await this.getVisualizationRenderingCount();
this.log.debug(`-- secondCount=${secondCount}`);
return firstCount === secondCount;
});
}
public async waitForVisualization() {
await this.waitForVisualizationRenderingStabilized();
}
public async getLegendEntriesXYCharts(selector: string) {
const items = (await this.getEsChartDebugState(selector))?.legend?.items ?? [];
return items.map(({ name }) => name);
}
public async getLegendEntries() {
const isVisTypePieChart = await this.isNewLibraryChart(pieChartSelector);
if (isVisTypePieChart) {
const slices =
(await this.getEsChartDebugState(pieChartSelector))?.partition?.[0]?.partitions ?? [];
return slices.map(({ name }) => name);
}
const legendEntries = await this.find.allByCssSelector(
'.visLegend__button',
this.defaultFindTimeout * 2
);
return await Promise.all(
legendEntries.map(async (chart) => await chart.getAttribute('data-label'))
);
}
public async openLegendOptionColorsForXY(name: string, chartSelector: string) {
await this.waitForVisualizationRenderingStabilized();
await this.retry.try(async () => {
const chart = await this.find.byCssSelector(chartSelector);
const legendItemColor = await chart.findByCssSelector(
`[data-ech-series-name="${name}"] .echLegendItem__color`
);
legendItemColor.click();
await this.waitForVisualizationRenderingStabilized();
// arbitrary color chosen, any available would do
const arbitraryColor = '#d36086';
const isOpen = await this.doesLegendColorChoiceExist(arbitraryColor);
if (!isOpen) {
throw new Error('legend color selector not open');
}
});
}
public async openLegendOptionColorsForPie(name: string, chartSelector: string) {
await this.waitForVisualizationRenderingStabilized();
await this.retry.try(async () => {
if (await this.isNewLibraryChart(pieChartSelector)) {
const chart = await this.find.byCssSelector(chartSelector);
const legendItemColor = await chart.findByCssSelector(
`[data-ech-series-name="${name}"] .echLegendItem__color`
);
legendItemColor.click();
} else {
// This click has been flaky in opening the legend, hence the this.retry. See
// https://github.com/elastic/kibana/issues/17468
await this.testSubjects.click(`legend-${name}`);
}
await this.waitForVisualizationRenderingStabilized();
// arbitrary color chosen, any available would do
const arbitraryColor = '#EF843C';
const isOpen = await this.doesLegendColorChoiceExist(arbitraryColor);
if (!isOpen) {
throw new Error('legend color selector not open');
}
});
}
public async filterOnTableCell(columnIndex: number, rowIndex: number) {
await this.retry.try(async () => {
const cell = await this.dataGrid.getCellElement(rowIndex, columnIndex);
await cell.click();
const filterBtn = await this.testSubjects.findDescendant(
'tbvChartCell__filterForCellValue',
cell
);
await this.common.sleep(2000);
filterBtn.click();
});
}
public async getMarkdownText() {
const markdownContainer = await this.testSubjects.find('markdownBody');
return markdownContainer.getVisibleText();
}
public async getMarkdownBodyDescendentText(selector: string) {
const markdownContainer = await this.testSubjects.find('markdownBody');
const element = await this.find.descendantDisplayedByCssSelector(selector, markdownContainer);
return element.getVisibleText();
}
// Table visualization
[Data table] Reactify & EUIficate the visualization (#70801) * Use data grid for table vis * Create basic table template * Add table_vis_split component * Apply cell filtering * Add aria-label attributes * Use field formatters for values * Add no results component * Remove legacy dependencies * Add usePagination * Create usePagination util * Use percentage column and total row * Use csv export button * Update labels * Fix merge conflicts * Use split table * Fix functional tests * Fix dashboard tests * Update data table functional tests * Fix missed test * Introduce showToolbar option * Remove useless package * Fix merge conflicts * Return back kibanaUtils required bundle * Revert "Remove useless package" This reverts commit 144a7cd77c8a33d866aaa8369af54f9d72f583cf. * Use feature flag for legacy vis * Add footer row * Remove lock files * Revert "Remove lock files" This reverts commit 5c5acd79f40822839f6dca467d9f7dd039169ddc. * Minor fixes * Use common no result message * Fix broken tests * Use ui state sorting * Fix error * Fix merge conflicts * Add legacy functional tests * Pull pagination footer up to keep with table and fix column split growing continuously in dashboard * Comments fixes * Use cell actions for filtering * Fix translations * Fix comments * Reduce legacy tests amount * Update sorting * Update split column layout * Add telemetry for legacy vis * Apply latest changes for split table * Fix eslint errors * Use aria labels with values * Use aria label for export btn * Fix functional test * Update translations * Cleanup * Truncate cells content * Enhance types in table_vis_response_handler.ts * Persist columns width on change * Fix sorting history * Add a migration script for toolbar * Export sorted table * Use reportUiCounter instead of reportUiStats * Fix integration tests * Fix typos * Adjust FieldFormat type * Hide the density selector * Update docs * Fix pagination * Restrict hiding the toolbar * Fix column index on filter * Add closePopover action Co-authored-by: cchaos <caroline.horn@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 12:44:20 +01:00
public async getTableVisNoResult() {
return await this.testSubjects.find('tbvChartContainer>visNoResult');
}
/**
* This function returns the text displayed in the Table Vis header
*/
public async getTableVisHeader() {
return await this.testSubjects.getVisibleText('dataGridHeader');
}
public async getFieldLinkInVisTable(fieldName: string, rowIndex: number = 1) {
const headers = await this.dataGrid.getHeaders();
const fieldColumnIndex = headers.indexOf(fieldName);
const cell = await this.dataGrid.getCellElement(rowIndex, fieldColumnIndex + 1);
return await cell.findByTagName('a');
}
/**
* Function to retrieve data from within a table visualization.
*/
public async getTableVisContent({ stripEmptyRows = true } = {}) {
return await this.retry.try(async () => {
const container = await this.testSubjects.find('tbvChart');
const allTables = await this.testSubjects.findAllDescendant('dataGridWrapper', container);
if (allTables.length === 0) {
return [];
}
const allData = await Promise.all(
allTables.map(async (t) => {
let data = await this.dataGrid.getDataFromElement(t, 'tbvChartCellContent');
if (stripEmptyRows) {
data = data.filter(
(row) => row.length > 0 && row.some((cell) => cell.trim().length > 0)
);
}
return data;
})
);
if (allTables.length === 1) {
// If there was only one table we return only the data for that table
// This prevents an unnecessary array around that single table, which
// is the case we have in most tests.
return allData[0];
}
return allData;
});
}
public async getMetric() {
const elements = await this.find.allByCssSelector(
'[data-test-subj="visualizationLoader"] .mtrVis__container'
);
const values = await Promise.all(
elements.map(async (element) => {
const text = await element.getVisibleText();
return text;
})
);
return values
.filter((item) => item.length > 0)
.reduce((arr: string[], item) => arr.concat(item.split('\n')), []);
}
public async getGaugeValue() {
const elements = await this.find.allByCssSelector(
'[data-test-subj="visualizationLoader"] .chart svg text'
);
const values = await Promise.all(
elements.map(async (element) => {
const text = await element.getVisibleText();
return text;
})
);
return values.filter((item) => item.length > 0);
}
public async getAxesCountByPosition(
axesPosition: typeof Position[keyof typeof Position],
selector: string
) {
const yAxes = (await this.getEsChartDebugState(selector))?.axes?.y ?? [];
return yAxes.filter(({ position }) => position === axesPosition).length;
}
public async clickOnGaugeByLabel(label: string) {
const gauge = await this.testSubjects.find(`visGauge__meter--${label}`);
const gaugeSize = await gauge.getSize();
const gaugeHeight = gaugeSize.height;
// To click at Gauge arc instead of the center of SVG element
// the offset for a click is calculated as half arc height without 1 pixel
const yOffset = 1 - Math.floor(gaugeHeight / 2);
await gauge.clickMouseButton({ xOffset: 0, yOffset });
}
public async getAreaSeriesCount(selector: string) {
const areas = (await this.getEsChartDebugState(selector))?.areas ?? [];
return areas.filter((area) => area.lines.y1.visible).length;
[Timelion Viz] Add functional tests (#107287) * First draft migrate timelion to elastic-charts * Some refactoring. Added brush event. * Added title. Some refactoring * Fixed some type problems. Added logic for yaxes function * Fixed some types, added missing functionality for yaxes * Fixed some types, added missing functionality for stack property * Fixed unit test * Removed unneeded code * Some refactoring * Some refactoring * Fixed some remarks. * Fixed some styles * Added themes. Removed unneeded styles in BarSeries * removed unneeded code. * Fixed some comments * Fixed vertical cursor across Timelion visualizations of a dashboad * Fix some problems with styles * Use RxJS instead of jQuery * Remove unneeded code * Fixed some problems * Fixed unit test * Fix CI * Fix eslint * Fix some gaps * Fix legend columns * Some fixes * add 2 versions of Timeline app * fix CI * cleanup code * fix CI * fix legend position * fix some cases * fix some cases * remove extra casting * cleanup code * fix issue with static * fix header formatter * fix points * fix ts error * Fix yaxis behavior * Fix some case with yaxis * Add deprecation message and update asciidoc * Fix title * some text improvements * [Timelion Viz] Add functional tests * Add more complex cases for _timelion * Update test expected data Co-authored-by: Uladzislau Lasitsa <Uladzislau_Lasitsa@epam.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Alexey Antonov <alexwizp@gmail.com>
2021-08-04 20:56:46 +02:00
}
public async getHistogramSeriesCount(selector: string) {
const bars = (await this.getEsChartDebugState(selector))?.bars ?? [];
return bars.filter(({ visible }) => visible).length;
}
public async getGridLines(selector: string): Promise<Array<{ x: number; y: number }>> {
const { x, y } = (await this.getEsChartDebugState(selector))?.axes ?? {
x: [],
y: [],
};
return [...x, ...y].flatMap(({ gridlines }) => gridlines);
}
public async getChartValues(selector: string) {
const barSeries = (await this.getEsChartDebugState(selector))?.bars ?? [];
return barSeries.filter(({ visible }) => visible).flatMap((bars) => bars.labels);
}
}