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

[explore] new visualization that adds a paired t-test table to linechart #3006

Closed
wants to merge 5 commits into from

Conversation

aayushshah15
Copy link

@aayushshah15 aayushshah15 commented Jun 20, 2017

A table located below the line chart displays the paired t-test and lift values of all time-series’ with respect to a set “control” (which, by default, is the first time-series represented in the table). The user can click on any of the rows to set that particular row as the “control” and all the values will be recomputed and the table, re-rendered. The table will be disabled when more than one metric is selected.

The paired t-test values that are > 0.05 are colored red to indicate that they are not statistically significant.

superset_1

The table is also recomputed and re-rendered after each query triggered by the user. The chart and the table are placed inside a scrollable div and the height of the line chart is reduced dynamically based on the height of the table, up to a set minimum of 500 pixels.

superset_2

Supervised by @joshwalters

};
}

statsPairedTTest(aa, bb) {
// this function calculates the paired t-test values between two arraysß
Copy link
Contributor

Choose a reason for hiding this comment

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

A ß at the EOL?

@aayushshah15 aayushshah15 force-pushed the paired-ttest-viz branch 2 times, most recently from f2d2109 to 87e994d Compare June 20, 2017 18:27
Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

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

Please fix the build.

@@ -302,7 +303,7 @@ function nvd3Vis(slice, payload) {
chart.height(height);
slice.container.css('height', height + 'px');

if ((vizType === 'line' || vizType === 'area') && fd.rich_tooltip) {
if (((vizType === 'line' || vizType === 'area') || vizType === 'line_ttest') && fd.rich_tooltip) {
Copy link
Member

Choose a reason for hiding this comment

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

At this point let's to with:

(['line', 'area', 'line_ttest'].indexOf(vizType) >= 0)

};
}

statsPairedTTest(aa, bb) {
Copy link
Member

Choose a reason for hiding this comment

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

This does not belong in ExploreViewContainer, I think it is specific to nvd3.jsx at this point and should probably be defined there.

This PR shouldn't touch ExploreViewContainer at all.

@@ -15,6 +15,51 @@
margin-right: 0px;
}

.table-container {
Copy link
Member

Choose a reason for hiding this comment

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

should be in nvd3.css and the css should be namespaced to only affect what is under .nvd3

.then((results) => {
const data = results.data;
this.setState({ data: data });
this.computePairedTTest(0);
Copy link
Member

Choose a reason for hiding this comment

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

0 seems arbitrary. It seems like you should be able to define what you want the control to be (?)

Copy link
Author

Choose a reason for hiding this comment

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

0 is just the default index. The user can select any stream to be the control by clicking on the stream's row in the table.

.gitignore Outdated
@@ -10,6 +10,7 @@ _static
_images
_modules
superset/bin/supersetc
superset/assets/backendSync.json
Copy link
Contributor

Choose a reason for hiding this comment

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

are you sure?

@xrmx
Copy link
Contributor

xrmx commented Jun 20, 2017

Please fix the linter errors :)

@aayushshah15 aayushshah15 changed the title [explore] new vizualization that adds a paired t-test table to linechart [explore] new visualization that adds a paired t-test table to linechart Jun 20, 2017
@aayushshah15 aayushshah15 force-pushed the paired-ttest-viz branch 2 times, most recently from 256b27b to 7eb9140 Compare June 23, 2017 19:57
@aayushshah15
Copy link
Author

aayushshah15 commented Jun 23, 2017

I made the changes that were requested. The paired t-test logic is now all in the PairedTTestTableContainer. The ExploreViewContainer is mostly untouched except some logic to calculate the chart height based on the height of the paired t-test table.
@mistercrunch @xrmx

@joshwalters
Copy link
Contributor

Tested locally, and verified that it works.

@coveralls
Copy link

coveralls commented Jul 21, 2017

Coverage Status

Coverage increased (+0.01%) to 69.265% when pulling 528f2d7c2bff06143284917a86db91f8a9e32b50 on aayushshah15:paired-ttest-viz into a141695 on apache:master.

1 similar comment
@coveralls
Copy link

coveralls commented Jul 21, 2017

Coverage Status

Coverage increased (+0.01%) to 69.265% when pulling 528f2d7c2bff06143284917a86db91f8a9e32b50 on aayushshah15:paired-ttest-viz into a141695 on apache:master.

@coveralls
Copy link

coveralls commented Jul 21, 2017

Coverage Status

Coverage increased (+0.01%) to 69.265% when pulling 7bfa4c1 on aayushshah15:paired-ttest-viz into a141695 on apache:master.

@coveralls
Copy link

coveralls commented Jul 31, 2017

Coverage Status

Coverage increased (+0.1%) to 69.363% when pulling a6ed521 on aayushshah15:paired-ttest-viz into a141695 on apache:master.

1 similar comment
@coveralls
Copy link

coveralls commented Jul 31, 2017

Coverage Status

Coverage increased (+0.1%) to 69.363% when pulling a6ed521 on aayushshah15:paired-ttest-viz into a141695 on apache:master.

@coveralls
Copy link

coveralls commented Jul 31, 2017

Coverage Status

Coverage increased (+0.1%) to 69.363% when pulling 0383041 on aayushshah15:paired-ttest-viz into a141695 on apache:master.

@coveralls
Copy link

coveralls commented Aug 2, 2017

Coverage Status

Coverage increased (+0.01%) to 69.315% when pulling 21d1b0f on aayushshah15:paired-ttest-viz into 163f4e3 on apache:master.

</Panel>
</div>
{this.props.viz_type === 'line_ttest' &&
<PairedTTestTableContainer />}
Copy link
Member

Choose a reason for hiding this comment

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

New visualizations should not live here. You probably want to call ReactDom.render from within nvd3.jsx. No need to touch this file at all.

standalone: PropTypes.bool.isRequired,
triggerQuery: PropTypes.bool.isRequired,
queryResponse: PropTypes.object,
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn't have to touch this file at all. queryResponse will be available in your visualization context in nvd3.jsx

Copy link
Author

Choose a reason for hiding this comment

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

Do you mean nvd3_vis.js?

import dist from 'distributions';

import { connect } from 'react-redux';
import { Table } from 'react-bootstrap';
Copy link
Member

Choose a reason for hiding this comment

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

We've been using reactable, it offers good features out of the box (sorting, filtering)

@@ -940,6 +945,8 @@ export const visTypes = {
},
},
};
visTypes.line_ttest.controlPanelSections = visTypes.line.controlPanelSections;
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this would be easy to miss. I'd prefer defining const lineVis = {...} at the top and then

line: lineVis,
line_ttest: Object.assign({}, lineVis, {'label': '...'}),

background-color: white;
}

h4.nvd3-paired-ttest-table .message-outline {
Copy link
Member

Choose a reason for hiding this comment

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

Would rather you use bootstrap CSS classes in your JSX as opposed to custom css

@joshwalters
Copy link
Contributor

joshwalters commented Sep 15, 2017

@mistercrunch @aayushshah15 finished his internship, and we are continuing the development of this feature in a new pull request: #3473

@mistercrunch
Copy link
Member

Notice: this issue has been closed because it has been inactive for 219 days. Feel free to comment and request for this issue to be reopened.

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.

5 participants