evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
4.39k stars 210 forks source link

Drill into viz elements with anchor tags #497

Open archiewood opened 1 year ago

archiewood commented 1 year ago

Feature Description

Goal of Feature

hughess commented 1 year ago

This looks like it would be achievable within echarts by using events (echarts docs)

At first glance, some things I think we'd need to figure out are:

archiewood commented 1 year ago

Great ideas!

My take is that the names of the x axis should be clickable yes.

In the situation where there are multiple series, eg stacked bar, we may want to have a different behaviour when clicking the name vs one of the series.

I think we'd probably want to make the links configurable with props?

<BarChart
  data={my_query}
  x=year
  y=sales_usd
  series=channel
  xAxisLinks=year
  seriesLinks={["channel","year"]}
/>

That way the user has control over whether there are links or not. It's explicit which is nice.

archiewood commented 1 year ago

For non standard URL paths, you could perhaps pass a js expression as a prop? XAxisLink={"marketing/"+channel} or similar? Though I guess channel is not a js variable here...