Refactor AxisSpec to be more aware of which domain it is representative #242
Labels
:axis
Axis related issue
discuss
To be discussed
enhancement
New feature or request
meta
...meta issue
@markov00 @nickofthyme here's an issue for us to discuss refactoring the AxisSpec.
Is your feature request related to a problem? Please describe.
Currently the way that the AxisSpec is implemented, it privileges the Position of the Axis, not the domain (x or y) to which the axis belongs. This causes a couple of problems already:
getAxesSpecForSpecId
which is called within annotations, legend, and crosshairs computations) but always need to calculate based on rotationLet's use this issue to discuss more how the current implementation may be impacting us, what we may need in the future, and take these into consideration as we develop a new API for defining an AxisSpec.
Describe the solution you'd like
TBD, would love to hear more from y'all
One thing that I think needs to happen is for us to make more explicit the relationship between an axis and a domain. This would help significantly with some of the other issues mentioned above. We could just add a
domainType
toAxisSpec
, but we could also be more specific and create more specificXAxisSpec
andYAxisSpec
components which extend the basicAxisSpec
(similar then to how we handle the SeriesSpecs).Something else I've been thinking about is changing the name from
AxisSpec
toDomainSpec
, thus we are privileging Domain as a important piece, not the Axis itself. One reason to possibly do this is that sometimes the user may want to configure something concerning a specific Domain (for example custom min/max DomainRange), but they may not want to render an Axis; the current workaround for this is to define an Axis with these domain configurations with thehide
prop equal totrue
to not render the Axis. Another time that this comes up is that sometimes we need a formatter for values outside of the Axis (crosshair & annotation tooltips and the legend display value) but need to go through the Axis to get the tickFormatter. Changing fromAxisSpec
toDomainSpec
would allow the user to define both a domain formatter as well as a tickFormatter for the Axis if they want separate formatters.Our current
AxisSpec
definition:If we move to defining the top-level spec as
DomainSpec
, that might look something like:If the user defines no explicit X or Y domains, then we could fallback to the internal computed scale (xScale and yScales) configurations.
Describe alternatives you've considered
Additional context
Kibana Cross Issues
N/A
Checklist
- [ ] every related Kibana issue is listed underKibana Cross Issues
list- [ ]kibana cross issue
tag is associated to the issue if any kibana cross issue is presentThe text was updated successfully, but these errors were encountered: