code: def make_all_charts(
      df: pd.DataFrame, by_task: pd.DataFrame
  ) -> List[Dict[Text, Union[str, alt.Chart]]]:
      """Creates charts and puts them in a list with their ID names.
  
      Args:
        df: A dataframe with one row per region.
        by_task: A dataframe with one row per task.
  
      Returns:
        list of dicts, each containing a chart and a descriptive ID.
      """
      charts = [
          {"id": "total_by_stage", "chart": totals_by_stage(by_task)},
          {
              "id": "pareto_and_runtimes_by_task",
              "chart": pareto_and_runtimes_by_task(df),
          },
          {
              "id": "histogram_by_task",
              "chart": stage_histogram(
                  by_task, title="Stage runtimes for each task"
              ),
          },
          {
              "id": "selected_longest_and_median_regions",
              "chart": selected_longest_and_median_regions(df),
          },
          {
              "id": "zero_examples",
              "chart": top_regions_producing_zero_examples(df),
          },
      ]
  
      # Altair shows a max of 5000 data points.
      if len(df) <= 5000:
          # With up to 5000 points, just show them all.
          charts.extend(
              [
                  {
                      "id": "histogram",
                      "chart": stage_histogram(
                          df, title="Runtime by stage for all regions"
                      ),
                  },
                  {
                      "id": "scatter_grid",
                      "chart": correlation_scatter_charts(
                          df, title="Trends for all regions"
                      ),
                  },
              ]
          )
      else:
          # With too many points, make different subsets to show trends better.
          top_100 = df.nlargest(100, "total runtime")
          top_5000 = df.nlargest(5000, "total runtime")
  
          # Sample the bottom 99% to avoid outliers that obscure general trends.
          bottom_99_percent = df.nsmallest(
              int(len(df) * 0.99), "total runtime"
          )
          if len(bottom_99_percent) > 5000:
              bottom_99_percent = bottom_99_percent.sample(5000)
  
          charts.extend(
              [
                  {
                      "id": "histogram_bottom_99_percent",
                      "chart": stage_histogram(
                          bottom_99_percent,
                          title="Runtime by stage for regions in the bottom 99%",
                      ),
                  },
                  {
                      "id": "histogram_top_100",
                      "chart": stage_histogram(
                          top_100,
                          title="Runtime by stage for regions in the top 100",
                      ),
                  },
                  {
                      "id": "scatter_grid_top_5000",
                      "chart": correlation_scatter_charts(
                          top_5000,
                          title="Trends for regions in the top 5000",
                      ),
                  },
                  {
                      "id": "scatter_grid_bottom_99_percent",
                      "chart": correlation_scatter_charts(
                          bottom_99_percent,
                          title="Trends for regions in the bottom 99%",
                      ),
                  },
              ]
          )
      return charts
  
imports: from typing import Dict, Sequence, List, Tuple, Text, Union
  from absl import app
  from absl import flags
  import altair
  import pandas
  import tensorflow
  from third_party.nucleus.io import sharded_file_utils
  from deepvariant import dashboard_utils
label_desc: Use image node_id 15 for calling a global function with example usage: make_all_charts(df, by_task) and returns: charts