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

Beta XYChart Component #309

Merged
merged 112 commits into from
Jul 6, 2018
Merged

Beta XYChart Component #309

merged 112 commits into from
Jul 6, 2018

Conversation

mattapperson
Copy link
Contributor

@mattapperson mattapperson commented Jan 16, 2018

Resolves #536

screen shot 2018-01-02 at 5 21 57 pm

Items out of scope of current PR

Docs:

Nice to haves

  • Add a stream series component
  • Determine long-term a11y approach
  • support aria description and/or described by (@chandlerprall)
  • auto-color series based on EUI color options
  • add empty state
  • add tests for user interactions (@chandlerprall)
  • add a DefaultAxis component (@markov00)

Overall todo

  • Add better documentation and examples (@sqren )
  • Add render tests (@chandlerprall)
  • Fix before and after each to patch random (@chandlerprall)
  • Code cleanup/comments (@mattapperson)
  • rename to XYChart (@mattapperson)
  • convert remaining UI elements to use SASS (@sqren)
  • re-add selection UI and prop to enable
  • util for auto generating axises
  • Add ability to set crosshair position (@mattapperson)
  • Expose API for creating custom vis component (@mattapperson)
  • Series need to somehow ensure data array is buffered with empty to ensure array indexes match
  • Resize XYChart margins based on axis values and titles spacings

General series todo

  • is clickable option to each data point (@markov00 )
  • add clickable prop
  • Fix hover when series data on x axis are not identical
  • Add stacked series

Chart component todo list

  • fix crosshair displaying (sometimes) outside of chart
  • add show axis (x and y) prop
  • add axis position (x and y) prop
  • add mode prop (liner, time...)

@mattapperson
Copy link
Contributor Author

Jenkins test this

@sorenlouv
Copy link
Member

Nice work on this @chandlerprall and @mattapperson ! I've been busy with APM stuff this week - will try to make time next week to take a stab at this.

@markov00
Copy link
Member

markov00 commented May 31, 2018

@mattapperson I think we need to rewrite the EUIBarSeries component and split it into 4 different components to correctly handle either bar charts and histograms, in vertical or horizontal mode.

From a DataViz perspective there is a difference between bar charts and histograms:
bar charts are used for discrete/categorical visualization of bars where histograms are used for continuous data inside an interval.
This leads to:

  • different axis visualization for the two categories:
    • bar charts have a discrete x-axis and show 1 tick per x value.
    • histograms have a continuous x-axis and can display intermediate ticks between values
  • different bar width dimensions:
    • bar charts have fixed width with padding between bars and aligned with their tick value
    • histograms usually have the width depending on their bin dimension, but small-to-zero padding is involved and bars are aligned between their bin range.

I'm looking through the Kibana issues but seems that no one noticed that creating a bar histogram like the following shows misunderstanding ticks in the x-axis (seems that the ranges are -500 bytes to 500 bytes, 500b to 1500b and so on, when the correct values are 0 - 1000, 1000 - 2000) (@timroes @ppisljar)
screen shot 2018-05-31 at 13 11 37

react-vis has two main type of bars: Bars and Rects, bars for bar chart and rects for histograms (they also specify the needs to use Rects for histograms instead of bars).
Each abstract component is split into Vertical and Horizontal.

I think we can extend them having 4 EUIBars components or find a way for one configurable component.

What do you think?

@mattapperson
Copy link
Contributor Author

@markov00 it seems to me it’s not about splitting the bar series, but simply adding 3 more?

@markov00
Copy link
Member

@mattapperson yes 3 more component and renaming the current one respecting its "vertical nature". So something like EUIVerticalBar, EUIHorizontalBar, EUIVerticalRect, EUIHorizontalRect

@mattapperson
Copy link
Contributor Author

@markov00 Then yes, I fully support this

@markov00
Copy link
Member

markov00 commented May 31, 2018

Ok I will create a PR with these 4 components. I think we can also take this circumstance to fix exports and components naming (currently they are named EUIBarSeries exported as EuiBar)
@mattapperson Do you think we need to add a "chart" prefix?

@mattapperson
Copy link
Contributor Author

@markov00 That would be great! it was on my todo list for tomorrow :)

@markov00
Copy link
Member

@chandlerprall @mattapperson I've updated my PR here. I think it's in a good shape and it's time to review it a bit before merging.
As already specified with @mattapperson the EUI charts can be flagged as beta, some of the API may change a bit in the future (like align props naming, merge few components into simplified ones etc.).
I also need to add tests on most of the components because I prefer to have a good shape of the API/Components before start working with tests.

package.json Outdated
@@ -47,6 +47,8 @@
"react-datepicker": "v1.4.1",
"react-input-autosize": "^2.2.1",
"react-virtualized": "^9.18.5",
"react-vis": "^1.9.3",
Copy link
Member

Choose a reason for hiding this comment

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

1.10.1 was released yesterday. Should we upgrade?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, strange that the package.json is not updated. I've upgraded react-vis and it's reflected into the yarn.lock.
@mattapperson could you please check and upgrade correctly?

@mattapperson mattapperson changed the title WIP chart component Beta XYChart Component Jul 6, 2018
@mattapperson mattapperson requested review from snide and removed request for timroes and ppisljar July 6, 2018 11:29
@mattapperson
Copy link
Contributor Author

@sqren @markov00 @snide Ready for final PR review

@mattapperson
Copy link
Contributor Author

I pulled Marko's latest updates and it LGTM

@cchaos
Copy link
Contributor

cchaos commented Jul 6, 2018

We'll do a separate design PR. @chandlerprall Can you take a quick review of this?

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

Needs an entry to CHANGELOG.md , otherwise code and docs LGTM

@markov00
Copy link
Member

markov00 commented Jul 6, 2018

@chandlerprall I've updated the CHANGELOG. After the CI pass I will merge this ok?

@mattapperson mattapperson merged commit 5bef1c7 into elastic:master Jul 6, 2018
@cchaos cchaos mentioned this pull request Jul 10, 2018
stroke-opacity: 0.3;
// support a clean mouse over when grids is above elements
pointer-events: none;
}
Copy link
Member

@sorenlouv sorenlouv Aug 15, 2018

Choose a reason for hiding this comment

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

@mattapperson @markov00 This rule caused some (minor) issues for the APM graphs so @formgeist overwrote this in:
elastic/kibana#21723

Not sure if the css is scoped by plugin or will affect all of kibana. Anyway, it seems suboptimal to overwrite styles like this. Any ideas for a better solution?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, these kinds of styles should be scoped with some .eui--- classname. We haven't yet done a design audit of the new chart component. Sorry for the override, we'll make sure not to have generic library selectors after the audit.

Copy link
Member

Choose a reason for hiding this comment

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

No worries. Just an fyi.
And sounds good with no generic library selectors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a chart component
5 participants