import { SmallMultiplesSpec } from '../../../specs' ; import { Dimensions } from '../../../utils/dimensions' ; import { AxisId } from '../../../utils/ids' ; import { Theme , AxisStyle } from '../../../utils/themes/theme' ; import { getAxesDimensions } from '../axes/axes_sizes' ; import { AxesTicksDimensions } from '../state/selectors/compute_axis_ticks_dimensions' ; import { AxisSpec } from './specs' ; internal export interface ChartDimensions { /**
     * Dimensions relative to canvas element
     */ chartDimensions : Dimensions ; /**
     * Margin to account for ending text overflow
     */ leftMargin : number ; } internal export function computeChartDimensions ( parentDimensions , theme , axisTickDimensions , axesStyles , axisSpecs , [ smSpec ] = [ ] ) { const axesDimensions = getAxesDimensions ( theme , axisTickDimensions , axesStyles , axisSpecs , smSpec ) ; const chartWidth = parentDimensions . width - axesDimensions . left - axesDimensions . right ; const chartHeight = parentDimensions . height - axesDimensions . top - axesDimensions . bottom ; const pad = theme . chartPaddings ; return { leftMargin : axesDimensions . margin . left , chartDimensions : { top : axesDimensions . top + pad . top , left : axesDimensions . left + pad . left , width : Math . max ( 0 , chartWidth - pad . left - pad . right ) , height : Math . max ( 0 , chartHeight - pad . top - pad . bottom ) , } , } ; }