diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/datatable.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/datatable.ts index 186f49adeb733..f31e03d310e03 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/datatable.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/datatable.ts @@ -183,6 +183,12 @@ const datatableStateSharedOptionsSchema = { * Sorting configuration */ sort_by: schema.maybe(sortingSchema), + /** + * Whether to show row numbers + */ + show_row_numbers: schema.maybe( + schema.boolean({ meta: { description: 'Whether to show row numbers' } }) + ), }; const datatableStateCommonOptionsSchema = { diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/gauge.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/gauge.ts index ce4bd6df0268f..f0dce09ae7fcd 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/gauge.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/gauge.ts @@ -113,6 +113,27 @@ const gaugeStateMetricOptionsSchema = { ), }; +const gaugeStateExtraOptionsSchema = { + /** + * Whether to respect the palette ranges for min/max + */ + respect_ranges: schema.maybe( + schema.boolean({ meta: { description: 'Whether to respect palette ranges for min/max' } }) + ), + /** + * Common label outside the chart + */ + common_label: schema.maybe( + schema.string({ meta: { description: 'Common label outside the chart' } }) + ), + /** + * Accessibility label for the chart + */ + aria_label: schema.maybe( + schema.string({ meta: { description: 'Accessibility label for the chart' } }) + ), +}; + export const gaugeStateSchemaNoESQL = schema.object( { type: schema.literal('gauge'), @@ -121,6 +142,7 @@ export const gaugeStateSchemaNoESQL = schema.object( ...layerSettingsSchema, ...datasetSchema, ...gaugeStateSharedOptionsSchema, + ...gaugeStateExtraOptionsSchema, /** * Primary value configuration, must define operation. */ @@ -139,6 +161,7 @@ export const gaugeStateSchemaESQL = schema.object( ...layerSettingsSchema, ...datasetEsqlTableSchema, ...gaugeStateSharedOptionsSchema, + ...gaugeStateExtraOptionsSchema, /** * Primary value configuration, must define operation. */ diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/heatmap.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/heatmap.ts index dda5649714b57..22ade5f85500e 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/heatmap.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/heatmap.ts @@ -31,6 +31,9 @@ const legendSchemaProps = { visible: schema.maybe(schema.boolean({ meta: { description: 'Whether to show the legend' } })), size: legendSizeSchema, position: schema.maybe(positionSchema({ meta: { description: 'Legend position' } })), + should_truncate: schema.maybe( + schema.boolean({ meta: { description: 'Whether to truncate legend items' } }) + ), }; const labelsSchemaProps = { @@ -94,10 +97,23 @@ const heatmapSharedStateSchema = { ), }) ), + stroke_width: schema.maybe( + schema.number({ meta: { description: 'Grid cell border width in pixels' } }) + ), + stroke_color: schema.maybe( + schema.string({ meta: { description: 'Grid cell border color' } }) + ), }, { meta: { id: 'heatmapCells', description: 'Cells configuration' } } ) ), + percentage_mode: schema.maybe( + schema.boolean({ meta: { description: 'Whether to show values as percentages' } }) + ), + show_tooltip: schema.maybe(schema.boolean({ meta: { description: 'Whether to show tooltips' } })), + highlight_in_hover: schema.maybe( + schema.boolean({ meta: { description: 'Whether to highlight cells on legend hover' } }) + ), }; const heatmapAxesStateSchemaProps = { diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/metric.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/metric.ts index 46d409e543385..e7a6c27db3c82 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/metric.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/metric.ts @@ -32,6 +32,7 @@ import { } from './shared'; import { horizontalAlignmentSchema, + verticalAlignmentSchema, leftRightAlignmentSchema, beforeAfterAlignmentSchema, } from '../alignments'; @@ -173,6 +174,26 @@ const metricStatePrimaryMetricOptionsSchema = { * Where to apply the color (background or value) */ apply_color_to: schema.maybe(applyColorToSchema), + /** + * Position of the primary metric value. Possible values: + * - 'top': Value appears above the labels + * - 'bottom': Value appears below the labels + */ + position: schema.maybe( + verticalAlignmentSchema({ + meta: { description: 'Position of the primary metric value (top or bottom)' }, + }) + ), + /** + * Font weight for title and subtitle. Possible values: + * - 'bold': Bold font weight + * - 'normal': Normal font weight + */ + title_weight: schema.maybe( + schema.oneOf([schema.literal('bold'), schema.literal('normal')], { + meta: { description: 'Font weight for title and subtitle' }, + }) + ), }; const metricStateSecondaryMetricOptionsSchema = { @@ -213,6 +234,26 @@ const metricStateSecondaryMetricOptionsSchema = { ), ]) ), + /** + * Alignments for the secondary metric value. + */ + alignments: schema.maybe( + schema.object( + { + /** + * Alignment for secondary value. Possible values: + * - 'left': Align value to the left + * - 'center': Align value to the center + * - 'right': Align value to the right + */ + value: horizontalAlignmentSchema({ + meta: { description: 'Alignment for secondary value' }, + defaultValue: LENS_METRIC_STATE_DEFAULTS.secondaryAlign, + }), + }, + { meta: { id: 'metricSecondaryMetricAlignments' } } + ) + ), /** * Color configuration */ diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/mosaic.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/mosaic.ts index 50421793213f6..8316b5ff07c14 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/mosaic.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/mosaic.ts @@ -20,6 +20,7 @@ import { sharedPanelInfoSchema, } from '../shared'; import { legendNestedSchema, legendVisibleSchema, valueDisplaySchema } from './partition_shared'; +import { positionSchema } from '../alignments'; import { legendSizeSchema, mergeAllBucketsWithChartDimensionSchema, @@ -35,6 +36,15 @@ const mosaicStateSharedSchema = { truncate_after_lines: legendTruncateAfterLinesSchema, visible: legendVisibleSchema, size: legendSizeSchema, + position: schema.maybe(positionSchema({ meta: { description: 'Legend position' } })), + values: schema.maybe( + schema.arrayOf( + schema.oneOf([schema.literal('value'), schema.literal('percent')], { + meta: { description: 'Legend value display mode' }, + }), + { maxSize: 2 } + ) + ), }, { meta: { diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/pie.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/pie.ts index 25d81b1c79ac0..4375debf5463d 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/pie.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/pie.ts @@ -31,6 +31,7 @@ import { validateColoringAssignments, valueDisplaySchema, } from './partition_shared'; +import { positionSchema } from '../alignments'; import { groupIsNotCollapsed } from '../../utils'; /** @@ -44,6 +45,15 @@ const pieStateSharedSchema = { truncate_after_lines: legendTruncateAfterLinesSchema, visible: legendVisibleSchema, size: legendSizeSchema, + position: schema.maybe(positionSchema({ meta: { description: 'Legend position' } })), + values: schema.maybe( + schema.arrayOf( + schema.oneOf([schema.literal('value'), schema.literal('percent')], { + meta: { description: 'Legend value display mode' }, + }), + { maxSize: 2 } + ) + ), }, { meta: { id: 'pieLegend', description: 'Legend configuration for pie/donut chart' } } ) diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/treemap.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/treemap.ts index b6755978e763d..a16dbc5a9a721 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/treemap.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/treemap.ts @@ -27,6 +27,7 @@ import { validateColoringAssignments, valueDisplaySchema, } from './partition_shared'; +import { positionSchema } from '../alignments'; import { legendSizeSchema, mergeAllBucketsWithChartDimensionSchema, @@ -42,6 +43,15 @@ const treemapSharedStateSchema = { truncate_after_lines: legendTruncateAfterLinesSchema, visible: legendVisibleSchema, size: legendSizeSchema, + position: schema.maybe(positionSchema({ meta: { description: 'Legend position' } })), + values: schema.maybe( + schema.arrayOf( + schema.oneOf([schema.literal('value'), schema.literal('percent')], { + meta: { description: 'Legend value display mode' }, + }), + { maxSize: 2 } + ) + ), }, { meta: { diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/waffle.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/waffle.ts index 07bfb5de036bf..7366727e9a8a4 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/waffle.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/waffle.ts @@ -24,6 +24,7 @@ import { validateMultipleMetricsCriteria, valueDisplaySchema, } from './partition_shared'; +import { positionSchema } from '../alignments'; import { legendSizeSchema, mergeAllBucketsWithChartDimensionSchema, @@ -51,6 +52,7 @@ export const waffleStateSharedSchema = { truncate_after_lines: legendTruncateAfterLinesSchema, visible: legendVisibleSchema, size: legendSizeSchema, + position: schema.maybe(positionSchema({ meta: { description: 'Legend position' } })), }, { meta: { id: 'waffleLegend', description: 'Legend configuration for waffle chart' } } ) diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/xy.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/xy.ts index 4cb08157bc2a5..39e29c5069c04 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/xy.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/xy.ts @@ -493,6 +493,11 @@ const referenceLineLayerShared = { }) ), color: schema.maybe(staticColorSchema), + decoration_position: schema.maybe( + schema.oneOf([schema.literal('auto'), schema.literal('left'), schema.literal('right')], { + meta: { description: 'Position of the icon and label relative to the reference line' }, + }) + ), axis: schema.maybe( schema.oneOf([schema.literal('bottom'), schema.literal('left'), schema.literal('right')], { defaultValue: 'left', diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/color.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/color.ts index 63349a32b51a6..0dddcf680f025 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/color.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/color.ts @@ -13,6 +13,25 @@ import { serializedValueSchema } from './serializedValue'; const colorByValueBase = schema.object({ type: schema.literal('dynamic'), // Specifies that the color assignment is dynamic (by value). Possible value: 'dynamic' + /** + * Controls the open/closed nature of the first and last color ranges. + * Possible values: + * - 'above': Last range extends to infinity + * - 'below': First range extends to negative infinity + * - 'all': Both first and last ranges are open-ended + * - 'none': All ranges are closed + */ + continuity: schema.maybe( + schema.oneOf( + [ + schema.literal('above'), + schema.literal('below'), + schema.literal('all'), + schema.literal('none'), + ], + { meta: { description: 'Controls the open/closed nature of the color ranges' } } + ) + ), /** * Array of color steps defining the mapping from values to colors. diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/datatable/lens_api_config_dsl.mock.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/datatable/lens_api_config_dsl.mock.ts index d3176232aa98b..2fd2bf78b900c 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/datatable/lens_api_config_dsl.mock.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/datatable/lens_api_config_dsl.mock.ts @@ -270,6 +270,7 @@ export const fullConfigDatatableWithAdhocDataView: DatatableState = { }, }, paging: 10, + show_row_numbers: true, }; /** diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/datatable/lens_state_config_dsl.mock.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/datatable/lens_state_config_dsl.mock.ts index d679bd63409f8..ad5e14c31551d 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/datatable/lens_state_config_dsl.mock.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/datatable/lens_state_config_dsl.mock.ts @@ -552,6 +552,7 @@ export const fullConfigDatatableAttributes: LensAttributes = { headerRowHeight: 'auto', headerRowHeightLines: 'auto', rowHeightLines: 3, + showRowNumbers: true, paging: { size: 10, enabled: true, diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/gauge/lens_api_config.mock.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/gauge/lens_api_config.mock.ts index 34c060d3fd2c9..3f2fce4edf153 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/gauge/lens_api_config.mock.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/gauge/lens_api_config.mock.ts @@ -80,6 +80,9 @@ export const comprehensiveGaugeWithAdHocDataView: GaugeState = { index: 'comprehensive-index', time_field: '@timestamp', }, + respect_ranges: true, + common_label: 'Bytes', + aria_label: 'Gauge chart', metric: { operation: 'average', field: 'bytes', diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/gauge/lens_state_config.mock.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/gauge/lens_state_config.mock.ts index 43b7062bd2b47..6bc1b00eef7ad 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/gauge/lens_state_config.mock.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/gauge/lens_state_config.mock.ts @@ -74,6 +74,9 @@ export const gaugeAttributes: LensAttributes = { ticksPosition: 'bands', labelMajorMode: 'auto', labelMinor: 'Bytes Subtitle', + respectRanges: true, + commonLabel: 'Bytes', + ariaLabel: 'Gauge chart', metricAccessor: '2ba2f501-1bca-4423-95b8-a5b92b05f5f5', colorMode: 'palette', minAccessor: 'a2ed356d-14fe-4066-9428-cec4a453cb7b', diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/heatmap/dsl.mocks.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/heatmap/dsl.mocks.ts index 0a274b28deefa..c075fb9f8fd0a 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/heatmap/dsl.mocks.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/heatmap/dsl.mocks.ts @@ -19,10 +19,14 @@ export const simple: LensAttributes = { shape: 'heatmap', layerId: '1df843f3-7796-4cef-a87d-babfbb85cd37', layerType: 'data', + percentageMode: true, + showTooltip: true, + highlightInHover: false, legend: { isVisible: true, position: 'right', type: 'heatmap_legend', + shouldTruncate: true, }, gridConfig: { type: 'heatmap_grid', @@ -31,6 +35,8 @@ export const simple: LensAttributes = { isXAxisLabelVisible: true, isYAxisTitleVisible: true, isXAxisTitleVisible: true, + strokeWidth: 2, + strokeColor: '#000', }, valueAccessor: 'e43d2fd3-5fdc-43c6-94db-d4ed285ebaff', xAccessor: '290700e9-5d95-43f4-a22f-00f688499b9d', diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/metric/lens_api_config.mock.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/metric/lens_api_config.mock.ts index 41d98bbcd553d..709657dd596e5 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/metric/lens_api_config.mock.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/metric/lens_api_config.mock.ts @@ -61,6 +61,8 @@ export const complexMetricAPIAttributes = { percentile: 95, }, }, + position: 'top', + title_weight: 'normal', }, { type: 'secondary', @@ -72,6 +74,9 @@ export const complexMetricAPIAttributes = { palette: 'status', value: false, }, + alignments: { + value: 'left', + }, }, ], breakdown_by: { diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/metric/lens_state_config.mock.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/metric/lens_state_config.mock.ts index 4f4e6ac5c3508..00cacba319e3a 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/metric/lens_state_config.mock.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/metric/lens_state_config.mock.ts @@ -186,6 +186,9 @@ export const complexMetricAttributes: LensAttributes = { maxAccessor: 'f041d9d0-db1d-4648-8320-a58449159841', color: '#FFf', showBar: true, + primaryPosition: 'top', + titleWeight: 'normal', + secondaryAlign: 'left', secondaryTrend: { type: 'none', }, diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/partition/lens_api_config.mock.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/partition/lens_api_config.mock.ts index 9ace39b71bf76..bb5bbb9c42724 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/partition/lens_api_config.mock.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/partition/lens_api_config.mock.ts @@ -139,6 +139,8 @@ export const esqlCharts = [ legend: { visible: 'auto', nested: false, + position: 'left', + values: ['value'], }, value_display: { mode: 'percentage', diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/partition/lens_state_config.mock.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/partition/lens_state_config.mock.ts index d05a86b6483f7..2846b11401c77 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/partition/lens_state_config.mock.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/partition/lens_state_config.mock.ts @@ -185,6 +185,7 @@ export const treemapLegacyBasicState = { numberDisplay: 'percent', legendDisplay: 'default', nestedLegend: true, + legendPosition: 'left', collapseFns: {}, categoryDisplay: 'default', }, diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/xy/referenceLines.mock.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/xy/referenceLines.mock.ts index ca94722331c37..f825ec4d14be7 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/xy/referenceLines.mock.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/tests/xy/referenceLines.mock.ts @@ -98,6 +98,7 @@ export const referenceLineXY: LensAttributes = { { axisMode: 'left', color: '#e5281e', + iconPosition: 'left', forAccessor: 'd661ac91-a1bc-45cc-bd62-b01cdf81199f', }, ], diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/datatable/to_api/appearance.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/datatable/to_api/appearance.ts index 1c888cb48a6fc..1d9a5ca8fb60a 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/datatable/to_api/appearance.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/datatable/to_api/appearance.ts @@ -144,7 +144,7 @@ function parseSortingToAPI( export function convertAppearanceToAPIFormat( visualization: DatatableVisualizationState, columnIdMapping: ColumnIdMapping -): Pick { +): Pick { const { paging, sorting } = visualization; const densityAPI = parseDensityToAPI(visualization); @@ -160,5 +160,8 @@ export function convertAppearanceToAPIFormat( ? { paging: isValidPagingSize(paging.size) ? paging.size : 10 } : {}), ...(sortByAPI ? { sort_by: sortByAPI } : {}), + ...(visualization.showRowNumbers != null + ? { show_row_numbers: visualization.showRowNumbers } + : {}), }; } diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/datatable/to_state/appearance.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/datatable/to_state/appearance.ts index ac424906e17ae..080dfe8a45d12 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/datatable/to_state/appearance.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/datatable/to_state/appearance.ts @@ -87,6 +87,15 @@ function buildPagingState(config: DatatableState): Pick { + if (config.show_row_numbers == null) { + return {}; + } + return { showRowNumbers: config.show_row_numbers }; +} + export function buildAppearanceState( config: DatatableState ): Pick< @@ -98,10 +107,12 @@ export function buildAppearanceState( | 'density' | 'paging' | 'sorting' + | 'showRowNumbers' > { return { ...buildDensityState(config), ...buildPagingState(config), ...buildSortingState(config), + ...buildShowRowNumbers(config), }; } diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/gauge.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/gauge.ts index 2455b2e20c451..fdbbbe5285d04 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/gauge.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/gauge.ts @@ -77,6 +77,9 @@ function buildVisualizationState(config: GaugeState): GaugeVisualizationState { ? { labelMajorMode: 'custom', labelMajor: layer.metric.title } : { labelMajorMode: 'auto' }), labelMinor: layer.metric.sub_title, + ...(layer.respect_ranges != null ? { respectRanges: layer.respect_ranges } : {}), + ...(layer.common_label ? { commonLabel: layer.common_label } : {}), + ...(layer.aria_label ? { ariaLabel: layer.aria_label } : {}), }; } @@ -173,6 +176,9 @@ function reverseBuildVisualizationState( type: 'gauge', dataset: dataset satisfies GaugeState['dataset'], ...props, + ...(visualization.respectRanges != null ? { respect_ranges: visualization.respectRanges } : {}), + ...(visualization.commonLabel ? { common_label: visualization.commonLabel } : {}), + ...(visualization.ariaLabel ? { aria_label: visualization.ariaLabel } : {}), } as GaugeState; } diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/heatmap/from_api.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/heatmap/from_api.ts index 3a7df2ec8d34f..ca39fc8d4d2c0 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/heatmap/from_api.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/heatmap/from_api.ts @@ -73,6 +73,8 @@ function buildVisualizationState(config: HeatmapState): HeatmapVisualizationStat xTitle: layer.axes?.x?.title?.value, yTitle: layer.axes?.y?.title?.value, xAxisLabelRotation, + strokeWidth: layer.cells?.stroke_width, + strokeColor: layer.cells?.stroke_color, }), }, legend: { @@ -82,8 +84,14 @@ function buildVisualizationState(config: HeatmapState): HeatmapVisualizationStat ...stripUndefined({ maxLines: layer.legend?.truncate_after_lines, legendSize: layer.legend?.size as LegendSize, + shouldTruncate: layer.legend?.should_truncate, }), }, + ...stripUndefined({ + percentageMode: layer.percentage_mode, + showTooltip: layer.show_tooltip, + highlightInHover: layer.highlight_in_hover, + }), ...(basePalette && { palette: { ...basePalette, diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/heatmap/to_api.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/heatmap/to_api.ts index 835acdbe9ae00..90ef000e234da 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/heatmap/to_api.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/heatmap/to_api.ts @@ -37,6 +37,7 @@ function getLegendProps(legend: HeatmapVisualizationState['legend']): HeatmapSta ...stripUndefined({ truncate_after_lines: legend.maxLines, size: legend.legendSize, + should_truncate: legend.shouldTruncate, }), }; } @@ -89,9 +90,16 @@ function reverseBuildVisualizationState( type: HEATMAP_NAME, legend: getLegendProps(visualization.legend), axes: getGridConfigProps(visualization.gridConfig), - cells: { + cells: stripUndefined({ labels: { visible: visualization.gridConfig.isCellLabelVisible }, - }, + stroke_width: visualization.gridConfig.strokeWidth, + stroke_color: visualization.gridConfig.strokeColor, + }), + ...stripUndefined({ + percentage_mode: visualization.percentageMode, + show_tooltip: visualization.showTooltip, + highlight_in_hover: visualization.highlightInHover, + }), } satisfies Partial; const paletteProps = { diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/metric.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/metric.ts index 107b1600075a2..659586f3d70ec 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/metric.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/metric.ts @@ -141,6 +141,8 @@ function buildVisualizationState(config: MetricState): MetricVisualizationState titlesTextAlign: primaryMetric.alignments.labels, } : {}), + ...(primaryMetric.position ? { primaryPosition: primaryMetric.position } : {}), + ...(primaryMetric.title_weight ? { titleWeight: primaryMetric.title_weight } : {}), ...(primaryMetric.icon ? { icon: primaryMetric.icon.name, @@ -157,7 +159,8 @@ function buildVisualizationState(config: MetricState): MetricVisualizationState ? { secondaryLabelPosition: secondaryMetric.label_position } : {}), secondaryAlign: - 'alignments' in primaryMetric ? primaryMetric.alignments?.value : undefined, + ('alignments' in secondaryMetric && secondaryMetric.alignments?.value) || + ('alignments' in primaryMetric ? primaryMetric.alignments?.value : undefined), ...('compare' in secondaryMetric && secondaryMetric.compare ? fromCompareAPIToLensState(secondaryMetric.compare) : {}), @@ -406,6 +409,14 @@ function enrichConfigurationWithVisualizationProperties( } primaryMetric.fit = visualization.valueFontMode === 'fit'; + + if (visualization.primaryPosition) { + primaryMetric.position = visualization.primaryPosition; + } + + if (visualization.titleWeight) { + primaryMetric.title_weight = visualization.titleWeight; + } } if (secondaryMetric) { @@ -427,6 +438,12 @@ function enrichConfigurationWithVisualizationProperties( color: visualization.secondaryTrend.color, }; } + + if (visualization.secondaryAlign) { + secondaryMetric.alignments = { + value: visualization.secondaryAlign, + }; + } } if (state.breakdown_by) { diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/partition.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/partition.ts index 6d68f4ac5b24f..d4b214e279002 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/partition.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/partition.ts @@ -192,7 +192,13 @@ function convertAPILegendDisplayOption( option: PartitionState ): Pick< PartitionLens['state']['visualization']['layers'][0], - 'legendDisplay' | 'nestedLegend' | 'legendMaxLines' | 'legendSize' | 'truncateLegend' + | 'legendDisplay' + | 'nestedLegend' + | 'legendMaxLines' + | 'legendSize' + | 'truncateLegend' + | 'legendPosition' + | 'legendStats' > { const legend = option?.legend; const legendOptions = legend @@ -201,6 +207,8 @@ function convertAPILegendDisplayOption( legendSize: legend?.size, legendMaxLines: legend?.truncate_after_lines, truncateLegend: legend?.truncate_after_lines != null, + legendPosition: 'position' in legend ? legend?.position : undefined, + legendStats: 'values' in legend ? legend?.values : undefined, }) : {}; if (legend?.visible === 'auto' || legend?.visible == null) { @@ -423,6 +431,8 @@ function fromLensStateToSharedPartitionAPI( truncate_after_lines: layerState.legendMaxLines, nested: isStateWaffleChart(visualization) ? undefined : layerState.nestedLegend, size: layerState.legendSize, + position: layerState.legendPosition, + values: layerState.legendStats, }); const valueDisplay = stripUndefined({ mode: convertStateValueDisplayToAPI(layerState.numberDisplay), diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/xy/api_layers.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/xy/api_layers.ts index 774904fffcd3c..a3daf8198473d 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/xy/api_layers.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/xy/api_layers.ts @@ -240,13 +240,21 @@ function convertReferenceLinesDecorationsToAPIFormat( yConfig: Omit ): Pick< ReferenceLineDef, - 'color' | 'stroke_dash' | 'stroke_width' | 'icon' | 'fill' | 'axis' | 'text' + | 'color' + | 'stroke_dash' + | 'stroke_width' + | 'icon' + | 'decoration_position' + | 'fill' + | 'axis' + | 'text' > { return stripUndefined({ color: yConfig.color ? fromStaticColorLensStateToAPI(yConfig.color) : undefined, stroke_dash: yConfig.lineStyle, stroke_width: yConfig.lineWidth, icon: isReferenceLineValidIcon(yConfig.icon) ? yConfig.icon : undefined, + decoration_position: yConfig.iconPosition, fill: yConfig.fill && yConfig.fill !== 'none' ? yConfig.fill : undefined, axis: yConfig.axisMode && yConfig.axisMode !== 'auto' ? yConfig.axisMode : undefined, text: yConfig.textVisibility != null ? (yConfig.textVisibility ? 'label' : 'none') : undefined, diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/xy/state_layers.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/xy/state_layers.ts index 6639473fed93a..2be837574965b 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/xy/state_layers.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/charts/xy/state_layers.ts @@ -172,6 +172,7 @@ function buildReferenceLineLayer( ): XYReferenceLineLayerConfig { const yConfig = layer.thresholds.map((threshold, index) => ({ icon: threshold.icon, + iconPosition: threshold.decoration_position, lineWidth: threshold.stroke_width, lineStyle: threshold.stroke_dash, textVisibility: threshold.text ? threshold.text === 'label' : undefined, diff --git a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/coloring.ts b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/coloring.ts index fb22662933d15..2be58aa847234 100644 --- a/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/coloring.ts +++ b/src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/transforms/coloring.ts @@ -60,6 +60,7 @@ export function fromColorByValueAPIToLensState( : API_TO_LEGACY_RANGE_NAMES.absolute, stops, colorStops: stops, + ...(color.continuity ? { continuity: color.continuity } : {}), }, }; } @@ -73,10 +74,13 @@ export function fromColorByValueLensStateToAPI( const rangeType = color.params.rangeType ? LEGACY_TO_API_RANGE_NAMES[color.params.rangeType] : LENS_DEFAULT_COLOR_BY_VALUE_RANGE_TYPE; + const continuity = color.params.continuity; + if (rangeType === 'absolute') { return { type: 'dynamic', range: rangeType, + ...(continuity ? { continuity } : {}), steps: color.params.stops?.map((step, index) => { const isFirst = index === 0; @@ -96,6 +100,7 @@ export function fromColorByValueLensStateToAPI( min: color.params.rangeMin ?? LENS_DEFAULT_COLOR_BY_VALUE_RANGE_MIN, max: color.params.rangeMax ?? LENS_DEFAULT_COLOR_BY_VALUE_RANGE_MAX, range: rangeType, + ...(continuity ? { continuity } : {}), steps: color.params.stops?.map((step, index) => { const isFirst = index === 0;