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

[APM] X-axis ticks overlap on small screen sizes #50888

Closed
sorenlouv opened this issue Nov 18, 2019 · 1 comment · Fixed by #50904
Closed

[APM] X-axis ticks overlap on small screen sizes #50888

sorenlouv opened this issue Nov 18, 2019 · 1 comment · Fixed by #50904
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Team:APM All issues that need APM UI Team support v7.6.0

Comments

@sorenlouv
Copy link
Member

sorenlouv commented Nov 18, 2019

What
On smaller screen size (13" and below) the x-axis tick marks overlap which makes them unreadable. This happens when the time range is set to 7 days or above.

image.png

How
#48355 added support for better timezone display but also changed the behaviour of x-axis tick marks. Previously the number of tick marks was dynamic (introduced in #44870) but after #48355 it became static due to the prop tickValues={xTickValues} which made tickTotal redundant:

image.png.

Suggestion

Currently xTickValues are declared in

const xTickValues = d3.time.scale
.utc()
.domain([xMinZone, xMaxZone])
.range([0, width])
.ticks()
.map(x => {
const time = x.getTime();
return new Date(time + getTimezoneOffsetInMs(time));
});
. By providing an argument to ticks() we can control the number of ticks.

const getXTickValues = numberOfTicks => d3.time.scale
    .utc()
    .domain([xMinZone, xMaxZone])
    .range([0, width])
    .ticks(numberOfTicks) // <----- this
    .map(x => {
      const time = x.getTime();
      return new Date(time + getTimezoneOffsetInMs(time));
    });

and instead of
https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/StaticPlot.js#L172-L178

const tickValues = getXTickValues(xTickTotal);

<XAxis
    type="time-utc"
    tickSize={0}
    tickFormat={tickFormatX}
    tickValues={tickValues}
/>
@sorenlouv sorenlouv added [zube]: (7.6) Planned for release bug Fixes for quality problems that affect the customer experience Team:APM All issues that need APM UI Team support v7.6.0 labels Nov 18, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

@dgieselaar dgieselaar self-assigned this Nov 18, 2019
dgieselaar added a commit to dgieselaar/kibana that referenced this issue Nov 18, 2019
dgieselaar added a commit to dgieselaar/kibana that referenced this issue Nov 19, 2019
@zube zube bot reopened this Nov 19, 2019
@zube zube bot closed this as completed Nov 19, 2019
@zube zube bot reopened this Nov 19, 2019
@zube zube bot closed this as completed Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:APM All issues that need APM UI Team support v7.6.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants