-
Notifications
You must be signed in to change notification settings - Fork 122
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
Specifying a groupId prop breaks x-axis tick formatting #134
Comments
Hey @sulemanof the elastic-charts/src/state/utils.ts Lines 425 to 442 in 56b173d
@emmacunningham I can for sure fix this having the <BarSpec xGroupId="xgroup" yGroupId="yId1" />
<BarSpec xGroupId="xgroup" yGroupId="yId2" />
<Axis groupId="xgroup" position="bottom" />
<Axis groupId="ygroup1" position="left" />
<Axis groupId="ygroup2" position="left" />
// or using a default xgroupId
<BarSpec yGroupId="yId1" />
<BarSpec yGroupId="yId2" />
<Axis position="bottom" />
<Axis groupId="ygroup1" position="left" />
<Axis groupId="ygroup2" position="left" />
// or we can just keep the groupId, limit to only 1 x axis group and have something like
// this that doesn't change the API
<BarSpec groupId="yId1" />
<BarSpec groupId="yId2" />
<Axis position="bottom" /> // when not specified and the position is bottom or top we are on x axis
<Axis groupId="ygroup1" position="left" />
<Axis groupId="ygroup2" position="left" /> |
Yes, I think the related issue is what an axis position means in terms of the chart. Currently, when a user specifies an axis and they specify the position, we infer what should be on the axis based on other factors in the chart (mostly chartRotation). This means that the meaning of the axis will change depending on the rotation. For a 0-degree rotated chart, a left axis will correspond with a yDomain and a bottom axis will correspond with an xDomain (that is, they will show the tick labels corresponding to values of those domains); for a 90-degree rotated chart, this changes such that the left axis will correspond with the xDomain and the bottom axis with a yDomain. I wonder if this is intuitive to users as usually when we think about axes and domains, we don't define them in terms of position but rather what we want them to represent (i.e. I don't refer to a left axis of a 0-degree rotated chart for a graph but I refer to the yAxis of a chart). In our current system, it's easy to get confused about what the Axis represents because we define it in terms of Position, which then requires us to consider chartRotation and then think about what the meaning of the Axis could be. Considering some of the options mentioned... Specify x & y group IDs.
This would still possibly allow a combination of props that should not be possible; for example, an xGroup ID for a vertical axis (where verticality is itself dependent on chartRotation). It's also not clear to me what the associated groupIDs mean (this is a carryover from our current implementation): once we rotate the chart, the groupId associations don't hold, by which I mean that for the above spec components, if we rotate the chart 90 degrees, then the left axes would show values belonging to the xDomain, while the bottom axis would show values corresponding to a yDomain. For example, see below: Default xGroup ID.
This seems preferable to the above at least because it locks in the default xGroupId; then perhaps Limiting to 1-to-1 group-to-axis definition.
I think we still run into the same issues with rotation. Further, there is another problem currrently where, if there are two specs with different yScales and the chart is rotated, we lose the split axes. This then leads to some series not being represented fully (the line series below has a max value of 10, but we lose that in the rotation): I wonder if, given that we can see how position and rotation interact currently, we might want to think about axis position slightly differently (and how it corresponds to a scale defined by a groupId).
Rather than specify position as one of the directions, we give them a binary value so for an xScale type, the axis will either be at the Top ('start') or Bottom ('end') when the chart has a horizontal rotation; when rotated vertically, then the axis will either be Left ('start') or Right ('end'). Thus we have a way to rotate the axis and maintain the association with the scale. An axis is always defined relative to a scaleType (& groupId for yDomains) and the domain values for an axis are independent of its position. |
Duplicate of #676 |
Describe the bug

The chart shows a tooltip when hovering, which convert a time string in milliseconds into a readable time string via
tickFormat
prop in x-axis component.It works fine unless I specify a

groupId
prop in a series.The full code implementation could be found in this PR.
Expected behavior
X-axis formatting should not rely on a
groupId
field, or should have a possibility to switch this mode.Screenshots

Take a look on the tooltip, time string isn't formatted anymore
Version (please complete the following information):
Kibana Cross Issues
Add any Kibana related issues here.
Checklist
Kibana Cross Issues
listkibana cross issue
tag is associated to the issue if any kibana cross issue is presentThe text was updated successfully, but these errors were encountered: