export function renderPanelSubstrates()

in packages/charts/src/chart_types/xy_chart/renderer/canvas/panels/panels.ts [69:133]


export function renderPanelSubstrates(ctx: CanvasRenderingContext2D, props: AxesProps, locale: string) {
  const { axesSpecs, perPanelAxisGeoms, axesStyles, sharedAxesStyle, debug, renderingArea } = props;
  const seenAxesTitleIds = new Set<AxisId>();

  perPanelAxisGeoms.forEach(({ axesGeoms, panelAnchor }) => {
    axesGeoms.forEach((geometry) => {
      const {
        axis: { panelTitle, id, position, secondary, multilayerTimeAxis },
        anchorPoint,
        size,
        dimension,
        visibleTicks: ticks,
        parentSize,
      } = geometry;
      const axisSpec = getSpecsById<AxisSpec>(axesSpecs, id);

      if (!axisSpec || !dimension || !position || axisSpec.hide) {
        return;
      }

      const axisStyle = axesStyles.get(axisSpec.id) ?? sharedAxesStyle;

      if (!seenAxesTitleIds.has(id)) {
        seenAxesTitleIds.add(id);
        renderTitle(
          ctx,
          false,
          {
            size: parentSize,
            debug,
            panelTitle,
            anchorPoint,
            dimension,
            axisStyle,
            axisSpec,
            multilayerTimeAxis,
          },
          locale,
        );
      }

      const layerGirth = dimension.maxLabelBboxHeight;

      renderPanel(
        ctx,
        {
          panelTitle,
          secondary,
          panelAnchor,
          axisSpec,
          anchorPoint,
          size,
          dimension,
          ticks,
          axisStyle,
          debug,
          renderingArea,
          layerGirth,
          multilayerTimeAxis,
        },
        locale,
      );
    });
  });
}