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

Add option to display category labels above bar in horizontal bar charts #149

Closed charlesons closed 1 year ago

charlesons commented 2 years ago

For horizontal bar charts with long category labels the labels themselves tend to take up most of the available chart space as shown below:

image.png

A solution is to create sub-plots within the main plot for each bar:

https://dkane.net/2020/better-horizontal-bar-charts-with-plotly/

charlesons commented 1 year ago

The implementation outlined in https://dkane.net/2020/better-horizontal-bar-charts-with-plotly/ uses Plotly Express (Python) and the useful helper functions for creating subplots are not available in Plotly.Js.

Some relevant resources for implementing the same thing in Plotly.JS are here:

https://stackoverflow.com/questions/51592730/how-to-add-title-to-each-subplot-in-plotly-js

https://github.com/plotly/plotly.js/issues/2746#issuecomment-810195118