diff --git a/src/plugins/vis_type_timelion/public/components/bar_series/index.tsx b/src/plugins/vis_type_timelion/public/components/bar_series/index.tsx index f6fe290a55def8..929a7e3983bca4 100644 --- a/src/plugins/vis_type_timelion/public/components/bar_series/index.tsx +++ b/src/plugins/vis_type_timelion/public/components/bar_series/index.tsx @@ -16,6 +16,7 @@ export function BarSeriesComponent({ data, index }: { data: any; index: number } rect: { fill: data.color, opacity: !bars.fill || bars.fill < 0 ? 1 : bars.fill, + widthPixel: bars.lineWidth, }, }, }; diff --git a/src/plugins/vis_type_timelion/public/components/timelion_vis_component.tsx b/src/plugins/vis_type_timelion/public/components/timelion_vis_component.tsx index f9953388bb1277..ae0e5d96fd520c 100644 --- a/src/plugins/vis_type_timelion/public/components/timelion_vis_component.tsx +++ b/src/plugins/vis_type_timelion/public/components/timelion_vis_component.tsx @@ -17,6 +17,8 @@ import { YDomainRange, BrushEndListener, PointerEvent, + LegendPositionConfig, + LayoutDirection, } from '@elastic/charts'; import { IInterpreterRenderHandlers } from 'src/plugins/expressions'; @@ -109,21 +111,31 @@ function TimelionVisComponent({ setChart(newChart); }, [seriesList.list]); - // temp solution, will be changed after fix https://github.com/elastic/elastic-charts/issues/878 const getLegendPosition = useCallback(() => { const chartGlobal = chart[0]._global; + const legendPositionConf: LegendPositionConfig = { + floating: true, + vAlign: Position.Top, + hAlign: Position.Right, + direction: LayoutDirection.Vertical, + }; + switch (chartGlobal?.legend?.position) { case 'ne': - return Position.Right; + legendPositionConf.vAlign = Position.Top; + legendPositionConf.hAlign = Position.Right; case 'nw': - return Position.Left; + legendPositionConf.vAlign = Position.Top; + legendPositionConf.hAlign = Position.Left; case 'se': - return Position.Right; + legendPositionConf.vAlign = Position.Bottom; + legendPositionConf.hAlign = Position.Right; case 'sw': - return Position.Left; - default: - return Position.Left; + legendPositionConf.vAlign = Position.Bottom; + legendPositionConf.hAlign = Position.Left; } + + return legendPositionConf; }, [chart]); const brushEndListener = useCallback(