-
Notifications
You must be signed in to change notification settings - Fork 525
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
When using custom axis the timestamps don't get formatted #2902
Comments
9 tasks
Victory uses d3 in the background for this feature. In custom axis you can use the d3 functionality like this. // import * as d3 from 'd3'
const domain = {
x: [Math.min(...data.map(d => d.x)), Math.max(...data.map(d => d.x))] as DomainTuple<Date>
}
var timeScaledomain = d3.scaleTime().domain(domain.x) // or zoomDomain.x, if you're using ZoomContainer
const ticks = timeScaledomain.ticks(5)
const formatter = timeScaledomain.tickFormat()
return (
<VictoryAxis
tickValues={ticks}
tickFormat={formatter}
offsetY={50}
/>
<VictoryAxis
crossAxis={false}
dependentAxis
/>
) i will not close the issue.as I don't know whether requiring this workaround is a intended functionality of Victory |
Closing for now, as this is by design, but will add notes to our documentation. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there an existing issue for this?
Code of Conduct
Victory version
latest
Code Sandbox link
https://codesandbox.io/p/sandbox/victory-starter-forked-5yzzn2
Bug report
When using custom axes the timestamps don't get formatted. The default axes pick good tick values, and tickformat is very nice with major value changes getting more attention. However in my application I need to adjust the axes a bit (namely offsetY={50}) and thus I lose access to those nice features.
Steps to reproduce
In the sandbox there are two graphs that I except to render same thing.
Expected behavior
I think expected behavior is to render the same axis in both scenarios. Alternatively provide a functions that default exis uses for selecting and formatting ticks, so that I can pass then on.
Actual behavior
Chart using custom axes doesn't format or pick good timestamp values
Environment
The text was updated successfully, but these errors were encountered: