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

Get pivot table working in explore v2 #1432

Merged
merged 4 commits into from
Nov 3, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions caravel/assets/javascripts/explorev2/components/ChartContainer.jsx
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';
Expand All @@ -14,6 +15,13 @@ const propTypes = {
};

class ChartContainer extends React.Component {
constructor(props) {
super(props);
this.state = {
selector: `#${this.props.sliceContainerId}`,
Copy link

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

Copy link
Contributor Author

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

};
}

componentDidMount() {
this.renderVis();
}
Expand All @@ -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: () => {
Expand All @@ -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: () => {
Copy link

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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];
Expand Down