Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in examples for columns and bars - sorting of date series. #54

Closed
mattlangeman opened this issue Oct 13, 2023 · 7 comments
Closed

Comments

@mattlangeman
Copy link
Contributor

The bar and column date series charts are sorting by the date string (day of week).

CleanShot 2023-10-13 at 17 17 06

@techniq
Copy link
Owner

techniq commented Oct 13, 2023

Awe, likely a regression from upgrading Layer Cake to 8.0.0 today...

https://github.com/mhkeller/layercake/releases/tag/v8.0.0

@mattlangeman
Copy link
Contributor Author

Awe, likely a regression from upgrading Layer Cake to 8.0.0 today...

https://github.com/mhkeller/layercake/releases/tag/v8.0.0

Yes. Changed my local Layer Cake back to 7.6.0 and the issue date sorting issue disappeared.

@mattlangeman
Copy link
Contributor Author

Wondering if these examples should be using scaleTime instead of scaleBand. That would fix the sorting issue, but doing so causes the bars to have width=0. I'm thinking changes are needed to createDimensionGetter.

A side benefit is that you could also set the number of ticks. Current the Axis uses the full domain for ticks if it is scaleBand and it gets a bit crowded.

$: tickVals = Array.isArray(ticks)
? ticks
: isScaleBand(scale)
? scale.domain()
: scale.ticks(typeof ticks === 'function' ? ticks(scale) : ticks);

@techniq
Copy link
Owner

techniq commented Oct 13, 2023

Possibly... I know using a band scale with dates isn't optimal (especially with gaps in the data).

Here is some Observable Plot examples, which has an interval option

I opened a LayerCake issue to discuss as well

@techniq
Copy link
Owner

techniq commented Oct 14, 2023

@mattlangeman Btw, improving date handling with band/bar charts was something I was tracking in #21 as well

techniq added a commit that referenced this issue Oct 14, 2023
@techniq
Copy link
Owner

techniq commented Oct 14, 2023

Updated to 8.0.1, but still seeing the issue (both in LayerChart, and the LayerCake REPL).

@techniq
Copy link
Owner

techniq commented Oct 15, 2023

Fixed by Layer Cake 8.0.2, and released as 0.24.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants