code: def _get_x_encoding_type(
      df: pd.DataFrame, chart_type: ChartType, x_column: str | None
  ) -> type_util.VegaLiteType:
      if x_column is None:
          return "quantitative"  # Anything. If None, Vega-Lite may hide the axis.
  
      # Bar charts should have a discrete (ordinal) x-axis, UNLESS type is date/time
      # https://github.com/streamlit/streamlit/pull/2097#issuecomment-714802475
      if chart_type == ChartType.BAR and not _is_date_column(
          df, x_column
      ):
          return "ordinal"
  
      return type_util.infer_vegalite_type(df[x_column])
  
imports: from __future__ import annotations
  from contextlib import nullcontext
  from datetime import date
  from enum import Enum
  from typing import TYPE_CHECKING, Any, Collection, Dict, List, Sequence, Tuple, cast
  import pandas
  from pandas.api.types import infer_dtype, is_integer_dtype
  from typing_extensions import Literal
  import streamlit.elements.arrow_vega_lite
  from streamlit import type_util
  from streamlit.color_util import Color, is_color_like, is_color_tuple_like, is_hex_color_like, to_css_color
  from streamlit.elements.altair_utils import AddRowsMetadata
  from streamlit.elements.arrow import Data
  from streamlit.elements.utils import last_index_for_melted_dataframes
  from streamlit.errors import Error, StreamlitAPIException
  from streamlit.proto.ArrowVegaLiteChart_pb2 import ArrowVegaLiteChart
  from streamlit.runtime.metrics_util import gather_metrics
label_desc: Use image node_id 21 for calling a global function with example usage: _get_x_encoding_type(df, chart_type, x_column) and returns: type_util, str, str