Skip to content

Bar chart (horizontal)

Bar charts are suited to comparing numeric values for different categories. The categories can be ordered or unordered, numeric or non-numeric.

sszvis.bar

Data structure

This chart requires one variable used for categorization, and one variable for the horizontal extent of the bar. The extent variable must be numeric, while the categorization variable should be a set of unique values.

Configuration

The bar component generates SVG rect elements from arrays of data objects.

bar.x(x)

Specifies the x-values of the rectangles. Can be a value or a function.

bar.y(y)

Specifies the y-values of the rectangles. Can be a value or a function.

bar.width(width)

Specifies the width-values of the rectangles. Can be a value or a function.

bar.height(height)

Specifies the height-values of the rectangles. Can be a value or a function.

bar.fill([fill])

Specifies the fill-value of the rectangles. Can be a value or a function (default: black).

bar.stroke([stroke])

Specifies the stroke-value of the rectangles. Can be a value or a function (default: black).

Chart

Horizontal Bar Chart
Loading the chart…

Interaction

Horizontal Bar Chart — Interactive
Loading the chart…