evidence icon indicating copy to clipboard operation
evidence copied to clipboard

Documented sort default is not applied

Open develar opened this issue 1 year ago • 3 comments
trafficstars

Steps To Reproduce

Sample data: sample-data.csv

SQL:

select run, coalesce(failure, kind, cast(level as varchar)) as category, round(sum(duration) / 1000) as duration
from tasks
where duration > 0
group by run, category
order by run, category

Environment

  • Node version (node -v): 20.11.0
  • npm version (npm -v): 10.2.4
  • OS: macOS 14.2.1 (23C71)
  • Browser: Chrome 120.0.6099.216 (Official Build) (arm64).
  • Database: DuckDB

Expected Behavior

The order of categories on the X-axis doesn't match the data order.

17 (1), 17 (2), 17 (3), 21 (1), 21 (2), 21 (3)

Actual Behaviour

21 (3), 21 (2), 21 (1), 17 (3), 17 (2), 17 (1)

Screenshot 2024-01-15 at 11 33 07

Workarounds

I am sure I can find a workaround using the ECharts custom options :) Thanks for using this library.

develar avatar Jan 15 '24 10:01 develar

By default series are ordered by size on the y axis. If you want to disable this behaviour, use

<BarChart 
     ...
     sort=false
/>

archiewood avatar Jan 15 '24 21:01 archiewood

If you want to disable this behaviour, use

It is false by default, according to docs :) Screenshot 2024-01-16 at 09 18 15

Also, if the documentation is incorrect and true is the default, I would consider it an unusual default. Metabase uses data order, which is also the expected behavior. In my case, run represents a scenario name (with a suffix such as (N)). Consequently, I expect all my charts to maintain a consistent order that aligns with the data domain.

develar avatar Jan 16 '24 08:01 develar

You are correct that the sort is true by default, and the docs are wrong.

I would consider it an unusual default

Thanks for this feedback, and I do agree - I think we have gone back and forth on this a bit

  • https://github.com/evidence-dev/evidence/pull/542
  • https://github.com/evidence-dev/evidence/issues/1134

I think it's slightly difficult to find a default that works as expected in all cases

archiewood avatar Jan 16 '24 14:01 archiewood