Skip to main content
Version: 1.0.0

Bar Chart

Compares values across different categories using the length of bars. This provides a simple and effective way to visualize and compare the relative sizes of different categories. It is widely used for various purposes, such as comparing sales across different regions, analyzing survey results, or ranking teams based on their performance.

Chart:


Code:

  const { muze, getDataFromSearchQuery } = viz;
  
  const data = getDataFromSearchQuery();

  const ColumnField = "Maker";
  const RowField = "Miles_per_Gallon";

  muze
    .canvas()
    .columns([ColumnField])
    .rows([RowField])
    .layers([
      {
        mark: "bar",
      },
    ])
    .data(data)
    .mount("#chart"); // mount your chart