Skip to content

Web [Charts]: Add categorical bar chart component

Warren Gifford requested to merge vk/create-bar-chart into main

Created by: vovakulikov

Closes https://github.com/sourcegraph/sourcegraph/issues/32940 Closes https://github.com/sourcegraph/sourcegraph/issues/32942 Closes https://github.com/sourcegraph/sourcegraph/issues/32943

This PR adds a new chart component - the bar chart. This chart represents categorical-like data (it's different from series-like data where the x-axis acts as a timeframe, in categorical-like data x-axis is a set of different categories)

Chart type Example
Regular categories Screenshot 2022-06-13 at 23 45 48
Categories with sub groups Screenshot 2022-06-13 at 23 45 55
Categories with stacked groups Screenshot 2022-06-13 at 23 46 04

This component also reuses the tooltip that we implemented during the line chart development.

A few things to notice that are not implemented/covered by this PR

  • This PR doesn't add a new bar chart for series-like (through time) data
  • This PR's bar chart doesn't cover all corner cases around label positioning

Test plan

  • Make sure that the chart has the right Y/X labels and correctly represents data sets in storybook stories
  • Make sure that the tooltip works correctly in all modern browsers (Firefox, Safari, Chrome)

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading