[hotfix] load selectors in render

This commit is contained in:
Maxime Beauchemin 2017-01-19 15:27:01 -08:00
parent 4a9888157e
commit 0807a8d016
13 changed files with 22 additions and 23 deletions

View File

@ -7,7 +7,7 @@ const propTypes = {
label: PropTypes.string,
description: PropTypes.string,
onChange: PropTypes.func,
value: PropTypes.oneOf([
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),

View File

@ -8,9 +8,9 @@ require('../node_modules/cal-heatmap/cal-heatmap.css');
const CalHeatMap = require('cal-heatmap');
function calHeatmap(slice) {
const div = d3.select(slice.selector);
const render = function () {
const div = d3.select(slice.selector);
d3.json(slice.jsonEndpoint(), function (error, json) {
const data = json.data;
if (error !== null) {

View File

@ -5,9 +5,8 @@ require('./directed_force.css');
/* Modified from http://bl.ocks.org/d3noob/5141278 */
function directedForceVis(slice) {
const div = d3.select(slice.selector);
const render = function () {
const div = d3.select(slice.selector);
const width = slice.width();
const height = slice.height() - 25;
d3.json(slice.jsonEndpoint(), function (error, json) {
@ -15,6 +14,7 @@ function directedForceVis(slice) {
slice.error(error.responseText, error);
return;
}
console.log(json);
const linkLength = json.form_data.link_length || 200;
const charge = json.form_data.charge || -500;
@ -92,6 +92,7 @@ function directedForceVis(slice) {
.attr('width', width)
.attr('height', height);
// build the arrow.
svg.append('svg:defs').selectAll('marker')
.data(['end']) // Different link/path types can be defined here

View File

@ -110,9 +110,8 @@ FilterBox.propTypes = propTypes;
FilterBox.defaultProps = defaultProps;
function filterBox(slice) {
const d3token = d3.select(slice.selector);
const refresh = function () {
const d3token = d3.select(slice.selector);
d3token.selectAll('*').remove();
// filter box should ignore the dashboard's filters

View File

@ -4,7 +4,7 @@ import d3 from 'd3';
require('./histogram.css');
function histogram(slice) {
const div = d3.select(slice.selector);
let div;
const draw = function (data, numBins) {
// Set Margins
@ -128,6 +128,7 @@ function histogram(slice) {
};
const render = function () {
div = d3.select(slice.selector);
d3.json(slice.jsonEndpoint(), function (error, json) {
if (error !== null) {
slice.error(error.responseText, error);

View File

@ -276,10 +276,10 @@ MapboxViz.propTypes = {
function mapbox(slice) {
const DEFAULT_POINT_RADIUS = 60;
const DEFAULT_MAX_ZOOM = 16;
const div = d3.select(slice.selector);
let clusterer;
const render = function () {
const div = d3.select(slice.selector);
d3.json(slice.jsonEndpoint(), function (error, json) {
if (error !== null) {
slice.error(error.responseText);

View File

@ -7,8 +7,8 @@ d3.sankey = require('d3-sankey').sankey;
require('./sankey.css');
function sankeyVis(slice) {
const div = d3.select(slice.selector);
const render = function () {
const div = d3.select(slice.selector);
const margin = {
top: 5,
right: 5,

View File

@ -7,9 +7,9 @@ require('./sunburst.css');
// Modified from http://bl.ocks.org/kerryrodden/7090426
function sunburstVis(slice) {
const container = d3.select(slice.selector);
const render = function () {
const container = d3.select(slice.selector);
// vars with shared scope within this function
const margin = { top: 10, right: 5, bottom: 10, left: 5 };
const containerWidth = slice.width();

View File

@ -13,9 +13,9 @@ dt(window, $);
function tableVis(slice) {
const fC = d3.format('0,000');
let timestampFormatter;
const container = $(slice.selector);
function refresh() {
const container = $(slice.selector);
function onError(xhr) {
slice.error(xhr.responseText, xhr);
return;

View File

@ -6,7 +6,7 @@ require('./treemap.css');
/* Modified from http://bl.ocks.org/ganeshv/6a8e9ada3ab7f2d88022 */
function treemap(slice) {
const div = d3.select(slice.selector);
let div;
const _draw = function (data, eltWidth, eltHeight, formData) {
const margin = { top: 0, right: 0, bottom: 0, left: 0 };
@ -227,6 +227,7 @@ function treemap(slice) {
};
const render = function () {
div = d3.select(slice.selector);
d3.json(slice.jsonEndpoint(), function (error, json) {
if (error !== null) {
slice.error(error.responseText, error);

View File

@ -4,9 +4,9 @@ import cloudLayout from 'd3-cloud';
import { category21 } from '../javascripts/modules/colors';
function wordCloudChart(slice) {
const chart = d3.select(slice.selector);
function refresh() {
const chart = d3.select(slice.selector);
d3.json(slice.jsonEndpoint(), function (error, json) {
if (error !== null) {
slice.error(error.responseText, error);

View File

@ -14,13 +14,13 @@ const config = {
entry: {
'css-theme': APP_DIR + '/javascripts/css-theme.js',
common: APP_DIR + '/javascripts/common.js',
dashboard: ['babel-polyfill', APP_DIR + '/javascripts/dashboard/Dashboard.jsx'],
explore: ['babel-polyfill', APP_DIR + '/javascripts/explore/explore.jsx'],
//dashboard: ['babel-polyfill', APP_DIR + '/javascripts/dashboard/Dashboard.jsx'],
//explore: ['babel-polyfill', APP_DIR + '/javascripts/explore/explore.jsx'],
explorev2: ['babel-polyfill', APP_DIR + '/javascripts/explorev2/index.jsx'],
sqllab: ['babel-polyfill', APP_DIR + '/javascripts/SqlLab/index.jsx'],
standalone: ['babel-polyfill', APP_DIR + '/javascripts/standalone.js'],
welcome: ['babel-polyfill', APP_DIR + '/javascripts/welcome.js'],
profile: ['babel-polyfill', APP_DIR + '/javascripts/profile/index.jsx'],
//sqllab: ['babel-polyfill', APP_DIR + '/javascripts/SqlLab/index.jsx'],
//standalone: ['babel-polyfill', APP_DIR + '/javascripts/standalone.js'],
//welcome: ['babel-polyfill', APP_DIR + '/javascripts/welcome.js'],
//profile: ['babel-polyfill', APP_DIR + '/javascripts/profile/index.jsx'],
},
output: {
path: BUILD_DIR,

View File

@ -357,10 +357,7 @@ class BaseViz(object):
if not payload:
is_cached = False
cache_timeout = self.cache_timeout
try:
data = self.get_data()
except Exception as e:
data = None
data = self.get_data()
payload = {
'cache_key': cache_key,