code: def _build_type_chart(variant_type_counts):
      """Create a chart of the counts of each variant type."""
      width = 400
      height = 200
      title = "Variant types"
      variant_type_data = _dict_to_dataframe(variant_type_counts)
      type_chart = _placeholder_for_empty_chart(
          "No entries in VCF", width=width, height=height, title=title
      )
      if not variant_type_data.empty:
          bars = (
              alt.Chart(variant_type_data)
              .mark_bar()
              .encode(
                  x=alt.X(
                      "label",
                      title=None,
                      sort=ordered_variant_type_labels,
                      axis=alt.Axis(labelAngle=-45),
                  ),
                  y=alt.Y(
                      "value", axis=alt.Axis(title="Count", format="s")
                  ),
                  tooltip=alt.Tooltip("value", format=".4s"),
                  color=alt.Color(
                      "label",
                      legend=None,
                      scale=alt.Scale(
                          scheme="set1",
                          domain=ordered_variant_type_labels,
                      ),
                  ),
              )
          )
          labels = bars.mark_text(dy=-5).encode(
              text=alt.Text("value", format=".4s")
          )
          type_chart = (bars + labels).properties(
              width=width, height=height, title=title
          )
      return type_chart
  
imports: import io
  import json
  import os
  import altair
  import numpy
  import pandas
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: _build_type_chart(variant_type_counts) and returns: type_chart