> ## Documentation Index
> Fetch the complete documentation index at: https://anvil.servicetitan.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bar Charts

export const DoDont = ({text, type, children}) => {
  return <>
      {type === "do" && <div className="do-dont do">
          {children && <div className="do-dont-content">{children}</div>}
          <Check>
            <p>
              <strong>Do</strong>
              {text && <span className="m-inline-start-1">{text}</span>}
            </p>
          </Check>
        </div>}
      {type === "dont" && <div className="do-dont dont">
          {children && <div className="do-dont-content">{children}</div>}
          <Danger>
            <p>
              <strong>Don't</strong>
              {text && <span className="m-inline-start-1">{text}</span>}
            </p>
          </Danger>
        </div>}
      {type === "caution" && <div className="do-dont caution">
          {children && <div className="do-dont-content">{children}</div>}
          <Warning>
            <p>
              <strong>Caution</strong>
              {text && <span className="m-inline-start-1">{text}</span>}
            </p>
          </Warning>
        </div>}
    </>;
};

<Columns cols={2}>
  <img src="https://mintcdn.com/servicetitan/H6IrrYy_BHqQ84Cc/images/docs/web/data-visualization/typography/typography-redlines.png?fit=max&auto=format&n=H6IrrYy_BHqQ84Cc&q=85&s=8f843d9218b0c8b476fe2bc723571585" alt="different types of data viz typography options outlined in the ordered list" width="1118" height="970" data-path="images/docs/web/data-visualization/typography/typography-redlines.png" />

  <div>
    <ol>
      <li>Headline</li>
      <li>Body text or subtitle</li>
      <li>Axis label</li>
      <li>Legend label</li>
      <li>Hover state tooltip</li>
    </ol>
  </div>
</Columns>

## Rules on the usage of Bar Charts

Grouped bar charts are best for showing a distribution of data points or making
comparisons across different categories of data. This chart shows a division of
data points across three different categorical variables (months), not just one.

**Note:** If comparing the totals for a categorical variable are important, then
a different chart type like a standard bar chart or stacked bar chart will be
better at performing the task.

## Rules on the usage of Grouped Bar Charts

Grouped bar charts are best for showing a distribution of data points or making
comparisons across different categories of data. This chart shows a division of
data points across three different categorical variables (months), not just one.

**Note:** If comparing the totals for a categorical variable are important, then
a different chart type like a standard bar chart or stacked bar chart will be
better at performing the task.

<Columns cols={2}>
  <DoDont type="do" text="arrange bars and their segments intentionally, sorting by descending total value when no natural order exists, and grouping related categories by importance or magnitude to enhance readability and clarity.">
    <img src="https://mintcdn.com/servicetitan/mzb8vUC8QRJt2y_W/images/docs/web/data-visualization/bar-charts/bar-charts-do-arrange.png?fit=max&auto=format&n=mzb8vUC8QRJt2y_W&q=85&s=0c130b6f2f2402addeb421c43dd0a822" alt="bar chart using 3 variables for each bar" className="m-block-0" width="936" height="778" data-path="images/docs/web/data-visualization/bar-charts/bar-charts-do-arrange.png" />
  </DoDont>

  <DoDont type="dont" text="stack bar segments in a random or inconsistent order, as it makes the chart hard to interpret and reduces its effectiveness by obscuring patterns and data significance.">
    <img src="https://mintcdn.com/servicetitan/mzb8vUC8QRJt2y_W/images/docs/web/data-visualization/bar-charts/bar-charts-dont-stack-randomly.png?fit=max&auto=format&n=mzb8vUC8QRJt2y_W&q=85&s=f35d2cff1a11286caa65e499e22ad142" alt="bar chart with 3 variables where each group is displayed in a random order" className="m-block-end-0 m-block-start-5" width="936" height="774" data-path="images/docs/web/data-visualization/bar-charts/bar-charts-dont-stack-randomly.png" />
  </DoDont>
</Columns>

## Rules on the usage of Stacked Bar Charts

Used to compare numeric values between levels of a categorical variable.

We use a stacked bar chart when we want to see how each main bar is broken down
into parts based on a second or third category. Each bar is split into sections
that represent the levels of the other categories. The total length of the bar
stays the same, but now we can see how the parts add up to the total.

<Columns cols={2}>
  <DoDont type="do" text="arrange bars and their segments intentionally, sorting by descending total value when no natural order exists, and grouping related categories by importance or magnitude to improve readability and insights.">
    <img src="https://mintcdn.com/servicetitan/X7UCc5xRXSxfS9Y-/images/docs/web/data-visualization/bar-charts/bar-charts-do-arrange-intentionally.png?fit=max&auto=format&n=X7UCc5xRXSxfS9Y-&q=85&s=a75c85f4171cc13f8f92405688c089ea" alt="stacked bar chart using 3 variables for each bar" className="m-block-0" width="936" height="866" data-path="images/docs/web/data-visualization/bar-charts/bar-charts-do-arrange-intentionally.png" />
  </DoDont>

  <DoDont type="dont" text="stack bar segments randomly or inconsistently, as it makes the chart harder to interpret, obscures patterns, and reduces its effectiveness.">
    <img src="https://mintcdn.com/servicetitan/mzb8vUC8QRJt2y_W/images/docs/web/data-visualization/bar-charts/bar-charts-dont-arrange-randomly.png?fit=max&auto=format&n=mzb8vUC8QRJt2y_W&q=85&s=74456dfa0ce2a911c7336dc16f3b98ca" alt="stacked bar chart with 3 variables where each group is displayed in a random order" className="m-block-end-0 m-block-start-5" width="936" height="866" data-path="images/docs/web/data-visualization/bar-charts/bar-charts-dont-arrange-randomly.png" />
  </DoDont>
</Columns>

### Real Example

The stacked bar chart shown below demonstrates the correct application of a
monochrome color palette. This visualization compares leads generated, jobs
booked, and new customers over time, making it an ideal candidate for a
monochromatic approach to maintain clarity and reduce cognitive load.

In this chart, the highest (tallest) value segment utilizes the lightest shade
with a pattern, outlined with a 1px stroke for definition. The mid-range value
is represented using the default blue, while the lowest value is displayed in
the darkest shade of blue. To preserve visual consistency and readability, apply
a 4px corner radius to the top of each bar and maintain a 4px vertical
separation between each stacked segment.

<img src="https://mintcdn.com/servicetitan/eSZwLejs8pME2ERY/images/docs/web/data-visualization/bar-charts/bar-charts-dontreal-example-2.png?fit=max&auto=format&n=eSZwLejs8pME2ERY&q=85&s=d33646f31343919ee620ec2995ba508f" alt="stacked bar chart with monochrome color palette showing leads generated, jobs booked, and new customers over time" width="1781" height="1557" data-path="images/docs/web/data-visualization/bar-charts/bar-charts-dontreal-example-2.png" />

<Card title="Questions? Challenges?" icon="link" href="https://servicetitan.enterprise.slack.com/archives/C0881LFTGDR" arrow="true" cta="Click here">
  Contact the Visual Design team on the #ask-vizd channel
</Card>
