feat: horizontal canvas bar charts by placing the measure on x - #9911
nishantmonu51 wants to merge 3 commits into
Conversation
AdityaHegde
left a comment
There was a problem hiding this comment.
Any reason to not update the yaml spec and just transposing at the end? Feels weird when x & y in yaml remains the same for horizontal charts.
How about we swap x & y directly in yaml? We will need to rename X-axis to Dimension and Y-axis to Measure in the sidebar editor. We can show what axis they are beside them and add a button to toggle x/y.
|
Kept the keys fixed on purpose: x/y roles are baked into the provider (top-N query, limit, temporal detection, multi-measure fields), the sort semantics (-y = by measure, including delta sort), the Go validators in the reconciler and create_chart, and the explore/TDD/pivot link builders. Swapping them means resolving roles from field types in all of those plus normalizing keys on chart-type switch, while the rendering side stays the same. That is a much bigger change than this PR, so i intentionally chose a path with minimal change |
A bar chart is horizontal when its measure sits on `x` (quantitative) and its dimension on `y`, replacing the `orientation` property. The provider and the spec builders normalize to the vertical layout and transpose the rendered spec; the inspector shows Dimension/Measure pickers with an axis badge and an Orientation switcher that swaps the keys. The reconciler accepts a quantitative `x` only for the three bar renderers.
orientation: horizontal to canvas bar chartsx
Resolves conflicts in the chart docs and i18n catalogs, and passes the final channel to the axis label layout so horizontal bars keep upright category labels.
Adds horizontal bar charts to canvas dashboards for
bar_chart,stacked_barandstacked_bar_normalized.xandyalways name the field drawn on that axis, so a horizontal chart puts the measure onxand the dimension ony; there is no separate orientation property.-xony= by measure);x_delta/-x_deltaadded for delta sorts on x.toVerticalSpec, so queries, sorting, tooltips and comparison logic are untouched. Builders still emit the vertical spec and a singletransposeCartesianSpecpass swaps x/y, xOffset/yOffset, band sizes, hover encodings,axis.orientand sort strings, pinning grid lines to the measure axis.rill_measures) and time-comparison modes. Brushing is disabled when horizontal since brush signal discovery is x-only.x/yblocks in the YAML (rewriting sort and axis placement). Switching a horizontal bar to a line, area or non-bar chart swaps back to the vertical layout first.validateCartesianChartresolves roles fromx.typeand accepts a quantitativexonly for the three bar renderers;create_chartvalidatesx.fields. Chart JSON schema, AI instructions, canvas generator guidance and docs updated. New i18n keys inenandes.The first commit implemented this as an
orientationproperty; the second replaces it with the swappedx/ylayout per review.Checklist: