Skip to content

Adding docs for elastic-charts#2209

Merged
cchaos merged 74 commits intoelastic:masterfrom
cchaos:docs-elastic-charts
Sep 5, 2019
Merged

Adding docs for elastic-charts#2209
cchaos merged 74 commits intoelastic:masterfrom
cchaos:docs-elastic-charts

Conversation

@cchaos
Copy link
Copy Markdown
Contributor

@cchaos cchaos commented Aug 8, 2019

This PR will add docs pages for 4 main topics surrounding elastic-charts (and charts in general).

The sections will show the ideal version of the specified chart type. They talk more about how to represent your data correctly than how elastic-charts works. That's what their docs are for. However, it does also provide code to produce the resulting chart so it's easy for consumers to copy/paste these ideal charts.

1. Using elastic-charts and EUI together

Main topic is how to use the EUI produced themes that work with elastic-charts and then a broader topic on best uses for color when creating charts.

2. Time series charts

This is probably the most used chart type in Kibana and will then probably be the most consumed version of elastic-charts.

3. Categorical charts

This is a type of chart that usually gets misrepresented because consumers don't adjust their data properly.

4. Sizing/Sparklines

There isn't always room to show all the details of a chart depending on the size of the chart itself. The sizing section showcases some examples.

Most of the issues that stem around the creation of sparklines is forgetting to remove interactions and extraneous markings.

Checklist

  • Checked in dark mode
  • Checked in mobile
  • Checked in IE11 and Firefox
  • [ ] Props have proper autodocs
  • Added documentation examples
  • [ ] Added or updated jest tests
  • [ ] Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@markov00
Copy link
Copy Markdown
Contributor

markov00 commented Aug 8, 2019

Thanks @cchaos for this, it looks awesome.

I have some small comments on the code, but I think I can go through them and fix them directly, like some code strings instead of the Position object, some snippet code has the xScaleType on the Axis.

I think we should also include an example to hide the markers on the line if the line contains many points (100 or more).

My last remark: the font size seems very small for all the labels on the chart, don't you think? Compared to the basic font size (14px)?

@cchaos
Copy link
Copy Markdown
Contributor Author

cchaos commented Aug 12, 2019

Thanks @markov00. Yeah I went through a pass to clean up those extra objects but must have missed some.

I think we should also include an example to hide the markers on the line if the line contains many points (100 or more).

Do you think this should just be a part of elastic-charts? Something it does automatically so that the marker only exists on hover?

the font size seems very small for all the labels on the chart, don't you think?

Agreed. I originally set it that small to sort of get them out of the way because charts should just be a quick glance of noticing trends and differences and then the user should rely on the tooltips for actual values.

The current problem right now is that elastic-charts doesn't allow for good spacing between the tick labels causing a jam up of text.

So reducing the font size helped to keep the user from getting distracted by these values. I do realize, however, that the font size is too small for categorical charts where reading the category names are important for that glance. And there still needs to be better vertical spacing.

Compared to the basic font size (14px)?

The base font size for charts has never been as large as 14px.

But I'm thinking a good compromise is increasing both ticks and labels by just a couple pixels.

Copy link
Copy Markdown
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

It's hard to test this without the theming system being released. I've done some review with @cchaos in zoom's and my general comments were as follows:

  • Label sizing was likely a tad too small
  • We will need some sort of guidance around chart sizing. AKA, what makes a good panel view chart and what should and should not be dropping in those sorts of views. Then, what makes a good sparkline / tiny chart. Those three usages are going to be the most common.
  • Possibly some more instruction on the palette services (chroma) being used. Just something that says... to build charts that look like this. Import this theme, use this service, and then use this chart configuration. Some of that is lost in the doc examples at the moment.

My comments are more toward the charting system in general. Right now it seems it doesn't do well scaling detail down based upon the containers it sits within. I think that's something we need to focus on in general since it's blocking our ability to deliver reliable, adaptive solutions to folks.

I think that outside of the theme service this content is all just documentation so we should be a little more open with just merging this and seeing how it helps, it's something that we can iterate on over time.

@markov00
Copy link
Copy Markdown
Contributor

@cchaos

Do you think this should just be a part of elastic-charts? Something it does automatically so that the marker only exists on hover?

Do we want to hardcode that max number of markers on a specific size or do we want to add that to the theme itself? I think the last should provide all a better configurability of the chart

For the axis labels: we have a ticket to fix too many labels specifying the number of ticks for each axis.
You can also use the padding style of the tickLabelStyle to allow more space between labels

@cchaos cchaos marked this pull request as ready for review August 14, 2019 14:26
@cchaos
Copy link
Copy Markdown
Contributor Author

cchaos commented Aug 14, 2019

This PR is now ready for review 🎉

@cchaos cchaos requested a review from markov00 August 14, 2019 14:27
@cchaos
Copy link
Copy Markdown
Contributor Author

cchaos commented Aug 14, 2019

@markov00

Do we want to hardcode that max number of markers on a specific size or do we want to add that to the theme itself? I think the last should provide all a better configurability of the chart

I was thinking that since the chart is already doing all that math and plotting of points that it should be able to determine a minimum distance between points and if that minimum is not met, it would turn off the points. Of course this could be a boolean style prop or setting that just turns the logic on or off but is on by default.

I'm not sure any other good way to do it through the theme (at least with the current configurations that are available now).

@cchaos cchaos requested review from gchaps, snide and thompsongl August 19, 2019 19:39
@cchaos
Copy link
Copy Markdown
Contributor Author

cchaos commented Aug 19, 2019

@snide

Possibly some more instruction on the palette services (chroma) being used. Just something that says... to build charts that look like this. Import this theme, use this service, and then use this chart configuration. Some of that is lost in the doc examples at the moment.

This is currently not the final way I'd like to be able to support more color schemes/palettes. We can either provide a better service with our own functions (pulling the chroma one out of docs) on top of our named palettes. Or Elastic-charts needs to create a color service for creating palettes.

Either way, there's no good way to describe the way I'm creating these extra palettes at the moment. My biggest goal right now is to get the base EUI chart themes into Kibana so that all the charts can start to look a bit better. I don't think many are using custom color schemes, or if they are they're already providing these hex values directly.

@snide
Copy link
Copy Markdown
Contributor

snide commented Aug 19, 2019

Yes. I agree. It should be handled on the ECharts side.

@thompsongl
Copy link
Copy Markdown
Contributor

The panels and configuration toggles with built-in best practices is a very cool and very helpful way to do this.
These look to be some of the best examples we have

@cchaos cchaos force-pushed the docs-elastic-charts branch from 138782e to a2a9269 Compare August 19, 2019 21:45
Copy link
Copy Markdown
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Lots of small docs changes. Mostly to change to active voice / fix typos (which coming from me you might want to double check). Kind of a big question about the delivery of the themes, but I think the resolution should be pretty simple. We should check with the engineers.

Overall. This is fantastic and what we should strive to do when providing usage documentation for our design work. Nice work. 🥇

<Fragment>
<EuiTitle size="xxs">
<h3>
Number of GitHub issues per visualization type
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like the legend has a small bug. It's reporting the hover values rather than an aggregation?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is no "aggregation" value on the legend to be applied.
We for sure have to remove the value when not on hover (it's used on tsvb to show the last bucket but for time series, for ordinal values is not useful).

@thompsongl
Copy link
Copy Markdown
Contributor

PR adding the chart themes to dist: cchaos#23

].map(example => createExample(example)),
},
{
name: 'Elastic-Charts',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it ok to use Elastic Charts (no hyphen) in the TOC? Also, suggest this organization:

Elastic Charts

  • Creating charts
    • Theming via EUI
    • Coloring charts
    • Sizing charts
  • Time series charts
  • Categorical charts
  • Sparklines

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I kept Sparklines with sizing but moved it to the second item just below Creating charts

@ryankeairns
Copy link
Copy Markdown
Contributor

Just stopping by to say that I pulled this down and it is awesome. Really great work @cchaos !

@cchaos cchaos force-pushed the docs-elastic-charts branch from d00792c to 0aa4b73 Compare August 21, 2019 23:00
@cchaos
Copy link
Copy Markdown
Contributor Author

cchaos commented Aug 23, 2019

Thanks @markov00, for reference, I've addressed most of your bullet points.

the copy/paste code will not work 100% on TS because of some missing types. From a JS prospective seems fine except the missing imports of all the components and the formatters

I converted the theme to TS, not too worried about the C/P code at the moment for TS users. Hopefully they'll get their own warnings in order to fix that and the imports.

each <Chart size={[undefined, 200]}> and similar props can be rewritten in a more “nice” way as size={{height:200}}

Fixed

it’s better to use enums for the following props: xScaleType, yScaleType, on every Position (left, right, top, bottom), AnnotationDomainType and TooltipType

I only found one instance that wasn't using an enum which was for a xScaleType prop. Do you see more?

we will change in some future version but all the ids needs to be created with getSpecId, getAxisId, getAnnotationId on TS world

I saw in your Storybook that you're just using straight strings for id's. You may want to then look into your documentation around that.

on the copied code the data is always written as data={TIME_DATA=[[0,1],[1,2]]} is that intentional?

Fixed

I think it's missing the histogram chart, that is best suited for all our time series in kibana as we are, most of the time, showing buckets of aggregated values...

I didn't realize there was a particular chart type for that use case. I'll agree it would be good to have a documentation example solely for that. I think it's out of scope right now, but created a github issue to follow up on. #2254

@cchaos cchaos requested a review from thompsongl August 23, 2019 17:20
@cchaos
Copy link
Copy Markdown
Contributor Author

cchaos commented Aug 23, 2019

Jenkins, test this

@thompsongl
Copy link
Copy Markdown
Contributor

thompsongl commented Aug 23, 2019

Looking back, I don't think a single CI run has succeeded. Before the lint errors were resolved, CI was failing before it even got to eslint.

14:08:17 error @elastic/charts@10.1.1: The engine "node" is incompatible with this module. Expected version "10.15.2". Got "8.16.1"
14:08:17 error Found incompatible module

Removes the need for `mergeWithDefaultTheme`
@thompsongl
Copy link
Copy Markdown
Contributor

@chandlerprall Does the CI include devDeps when it installs?

Copy link
Copy Markdown
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

🚀

@thompsongl thompsongl mentioned this pull request Aug 29, 2019
@chandlerprall
Copy link
Copy Markdown
Contributor

@cchaos pushed fix for the duplicate react versions, however elastic-charts is entering an infinite loop in IE11, both in these docs and in their published storyboard at elastic.github.com/elastic-charts , looks like the loop is caused by the resize observer /cc @markov00 @nickofthyme

@nickofthyme
Copy link
Copy Markdown
Contributor

Thanks @chandlerprall I'll take a look

@cchaos
Copy link
Copy Markdown
Contributor Author

cchaos commented Sep 3, 2019

Thanks @chandlerprall !

@cchaos cchaos dismissed thompsongl’s stale review September 4, 2019 15:13

Has been addressed

@chandlerprall
Copy link
Copy Markdown
Contributor

chandlerprall commented Sep 5, 2019

@cchaos I've updated the @elastic/elastic-charts dependency to latest version and made a change that I expect will let CI run against this branch.

@cchaos
Copy link
Copy Markdown
Contributor Author

cchaos commented Sep 5, 2019

Thank you to all who made this possible 🥇

@cchaos cchaos merged commit d4a2fb6 into elastic:master Sep 5, 2019
thompsongl pushed a commit to thompsongl/eui that referenced this pull request Sep 10, 2019
@cchaos cchaos deleted the docs-elastic-charts branch October 22, 2019 20:03
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.

8 participants