import { LegendItem } from '../../../../common/legend' ; import { Rect } from '../../../../geoms/types' ; import { Rotation } from '../../../../utils/common' ; import { Dimensions } from '../../../../utils/dimensions' ; import { BarGeometry , PerPanel } from '../../../../utils/geometry' ; import { SharedGeometryStateStyle } from '../../../../utils/themes/theme' ; import { getGeometryStateStyle } from '../../rendering/utils' ; import { renderRect } from './primitives/rect' ; import { buildBarStyle } from './styles/bar' ; import { withPanelTransform } from './utils/panel_transform' ; internal export function renderBars ( ctx , imgCanvas , geoms , sharedStyle , clippings , renderingArea , highlightedLegendItem ? , rotation = 0 ) { geoms . forEach ( ( { panel , value : bars } ) => withPanelTransform ( ctx , panel , rotation , renderingArea , ( ) => bars . forEach ( ( barGeometry ) => { const { x , y , width , height , color , seriesStyle : style , seriesIdentifier } = barGeometry ; const rect = { x , y , width , height } ; const geometryStateStyle = getGeometryStateStyle ( seriesIdentifier , sharedStyle , highlightedLegendItem ) ; const barStyle = buildBarStyle ( ctx , imgCanvas , color , style . rect , style . rectBorder , geometryStateStyle , rect ) ; renderRect ( ctx , rect , barStyle . fill , barStyle . stroke ) ; } ) , { area : clippings , shouldClip : true } ) ) ; }