evidence icon indicating copy to clipboard operation
evidence copied to clipboard

Support Dual Y-Axes

Open archiewood opened this issue 3 years ago • 1 comments

Feature Description Dual Axis support, for <Chart> components: <BarChart>, <LineChart>, <AreaChart>

image

Goal of Feature What would this feature help you accomplish? Increase the density of information you can display. Often combines a bar chart with a line chart, for example.

Current Solution Two charts with separate axes

Alternative Ideas Support Side by side - two charts in one row, would also allow for higher information density

archiewood avatar Sep 15 '22 15:09 archiewood

Man my memory is bad

archiewood avatar Sep 21 '22 21:09 archiewood

Syntax ideas:

Into BarChart, LineChart, AreaChart directly


<BarChart 
  data={orders} 
  y=number_of_orders
  y2=AOV
/>

(Or y1, y2?)

If there are exactly 3 columns, could infer y and y2?

<BarChart 
  data={orders} 
  dualAxis=true
/>

In mixed type charts

<Chart 
  data={orders}
  dualAxis=true
>
  <Bar y=number_of_orders/>
  <Line y=aov/>
</Chart>

archiewood avatar Feb 25 '23 19:02 archiewood

There are some tricky parts to make this feature generalizable, but overall it should be feasible!

Here's a rough working example of what we could do:

<LineChart 
   data={orders_by_month} 
   x=month 
   y="sales_usd0k" 
   y2="num_orders_num0"
   yAxisTitle=true
   y2AxisTitle=true
/>
CleanShot 2023-05-13 at 18 03 40@2x

hughess avatar May 13 '23 22:05 hughess

+1 for this feature

gamezober avatar Oct 11 '23 00:10 gamezober

@gamezober which chart types would you use with a secondary axis?

hughess avatar Oct 11 '23 00:10 hughess

Closed by https://github.com/evidence-dev/evidence/pull/1236

archiewood avatar Dec 22 '23 18:12 archiewood