-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
Get pivot table working in explore v2 #1432
Changes from 1 commit
09e5f9c
b9cf952
9b49e6b
a03608d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import $ from 'jquery'; | ||
import React, { PropTypes } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { Panel } from 'react-bootstrap'; | ||
|
@@ -14,6 +15,13 @@ const propTypes = { | |
}; | ||
|
||
class ChartContainer extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
selector: `#${this.props.sliceContainerId}`, | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
this.renderVis(); | ||
} | ||
|
@@ -27,8 +35,9 @@ class ChartContainer extends React.Component { | |
jsonEndpoint: () => this.props.jsonEndpoint, | ||
|
||
container: { | ||
html: () => { | ||
html: (data) => { | ||
// this should be a callback to clear the contents of the slice container | ||
$(this.state.selector).html(data); | ||
}, | ||
|
||
css: () => { | ||
|
@@ -37,17 +46,25 @@ class ChartContainer extends React.Component { | |
// should call callback to adjust height of chart | ||
}, | ||
height: () => parseInt(this.props.height, 10) - 100, | ||
|
||
find: (classname) => ($(this.state.selector).find(classname)), | ||
|
||
}, | ||
|
||
width: () => this.chartContainerRef.getBoundingClientRect().width, | ||
|
||
height: () => parseInt(this.props.height, 10) - 100, | ||
|
||
selector: `#${this.props.sliceContainerId}`, | ||
selector: this.state.selector, | ||
|
||
done: () => { | ||
// finished rendering callback | ||
}, | ||
|
||
error: () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when does this get called? should we surface an error to the user at this point? how are we currently handling this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is called when getJSON failed for json endpoint in pivot_table.js, I copied some lines from our original error callback function and added them to new commit :) |
||
// rendering error callback | ||
}, | ||
|
||
d3format: (col, number) => { | ||
// mock d3format function in Slice object in caravel.js | ||
const format = this.props.columnFormats[col]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this is the same change as in https://github.com/airbnb/caravel/pull/1443/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I created the world_map branch on top of this branch since there are some functions needed from here. I'll merge this first then rebase on the world_map one