GSS-Cogs / chart-builder

The Chart Builder is a proof-of-concept app to understand the feasibility of using a CSV file (or SPARQL query) to generate and customise a chart or data visualisation
https://chart-builder-no4vxskx7a-nw.a.run.app
2 stars 0 forks source link

Issue 149/compact horizontal bar charts #164

Closed charlesons closed 2 years ago

charlesons commented 2 years ago

Implementation of a new 'compact bar chart' type that can be used when category labels are particularly long. The chart positions category labels above each bar rather than beside them which leaves more horizontal space to display the bars themselves.

The implementation is semi bespoke and is loosely based on this solution that uses the Python version of Plotly and Dash. Unfortunately some of the useful helper functions available in the Python version are not available in Plotly.JS.

The implementation uses two Plotly capabilities, subplots and annotations. In a nutshell we create one subplot for each bar to display and create an annotation to show the category label. Most of the standard plot features are hidden such as the axes, legend, zeroline, ticklabels, etc.

There are further explanatory comments in compactBarChart.ts

Closes #149