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

[ML] Explorer Chart Tweaks #22955

Merged
merged 14 commits into from
Sep 12, 2018

Conversation

walterra
Copy link
Contributor

Fixes #18067.

This tweaks the design of the Anomaly Explorer Charts as discussed in the issue mentioned above.

The aim of this is to more clearly visualize how the timerange of the cell selected in the swimlane relates to the time span shown in the charts.

Here's a comparison showing the previous layout (left) vs the updated on (right):

image

  • The most important change is that the vertical date axis ticks no longer are randomly positioned by d3. Instead they are aligned with the cell interval of the swimlane. This way, the date information shown in the swimlane tooltip will always align with the date tick shown left of the emphasized area in the chart.
  • The highlighted area now features a gray rounded border to resemble the styling of the selected cell in the swimlane.

The time span shown in the charts is chosen dynamically and can differ, here's another comparison:

image

The new version shows more vertical ticks now, again, they correspond to the interval in the swimlane. Only certain ticks are highlighted with date labels to avoid label overlap, but it's made sure the label at the start of the highlighted area is shown to correspond with the tooltip information of the swimlane. The density of the vertical ticks provides some context about how the shown time span relates to the amount of represented cells in the swimlane. The right chart also shows a fix where to long chart headers would wrap the "View" link to a new line. The x/y axis labels blackness has been reduced to reduce emphasis on the labels.

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

let addAnotherTick;

switch (operator) {
case 'previous':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the TICK_DIRECTION constant could be used here

const newTickData = getTickData(getNeighourTick(ts));

if (
newTickData !== false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this style with just one condition looks a bit odd.

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments, otherwise LGTM

.tickFormat(d => moment(d).format(xAxisTickFormat));

// With tooManyBuckets the chart would end up with no x-axis labels
// because the ticks are based on the span of the emphasis section,
// but that one spans the whole chart width with tooManyBuckets.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand what this is saying. Maybe something like 'and the highlighted area would span the entire chart'?

// ones where we remove the label in the next steps.
axis.selectAll('g.tick').select('line').classed('ml-tick-emphasis', true);

function getNeighourTickFactory(operator) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the function name. Should be getNeighbourTickFactory or I suppose getNeighborTickFactory if we are sticking with American English ;)

}

function getTickDataFactory(operator) {
const getNeighourTick = getNeighourTickFactory(operator);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same typos here. Should be 'Neighbor' / 'Neighbour'.

// that is required/wanted to show up. The code then traverses to both sides along the axis
// and decides which labels to keep or remove. All vertical tick lines will be kept visible,
// but those which still have their text label will be emphasized using the ml-tick-emphasis class.
export function removeLabelOverlap(axis, startTs, tickInterval, width) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 'startTimestamp' would be a clearer name for this argument, assuming 'Ts' is a timestamp?

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@walterra walterra merged commit 2b03a43 into elastic:master Sep 12, 2018
@walterra walterra deleted the ml-explorer-chart-tweaks-18067 branch September 12, 2018 11:28
walterra added a commit to walterra/kibana that referenced this pull request Sep 12, 2018
- The aim of this is to more clearly visualize how the timerange of the cell selected in the swimlane relates to the time span shown in the charts.
- The most important change is that the vertical date axis ticks no longer are randomly positioned by d3. Instead they are aligned with the cell interval of the swimlane. This way, the date information shown in the swimlane tooltip will always align with the date tick shown left of the emphasized area in the chart.
- The highlighted area now features a gray rounded border to resemble the styling of the selected cell in the swimlane.
- The chart also fixes where to long chart headers would wrap the "View" link to a new line.
- The x/y axis labels blackness has been reduced to reduce emphasis on the labels.
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

walterra added a commit that referenced this pull request Sep 12, 2018
- The aim of this is to more clearly visualize how the timerange of the cell selected in the swimlane relates to the time span shown in the charts.
- The most important change is that the vertical date axis ticks no longer are randomly positioned by d3. Instead they are aligned with the cell interval of the swimlane. This way, the date information shown in the swimlane tooltip will always align with the date tick shown left of the emphasized area in the chart.
- The highlighted area now features a gray rounded border to resemble the styling of the selected cell in the swimlane.
- The chart also fixes where to long chart headers would wrap the "View" link to a new line.
- The x/y axis labels blackness has been reduced to reduce emphasis on the labels.
@lcawl lcawl added the enhancement New value added to drive a business result label Oct 29, 2018
@sophiec20 sophiec20 added the Feature:Anomaly Detection ML anomaly detection label Jun 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Anomaly Detection ML anomaly detection Feature:ml-results legacy - do not use :ml v6.5.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ML] Explorer Chart Tweaks
6 participants