Skip to content

Commit

Permalink
[hotfix] load selectors in render
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Jan 19, 2017
1 parent 4a98881 commit 0807a8d
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]),
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/visualizations/cal_heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions superset/assets/visualizations/directed_force.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ 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) {
if (error !== null) {
slice.error(error.responseText, error);
return;
}
console.log(json);
const linkLength = json.form_data.link_length || 200;
const charge = json.form_data.charge || -500;

Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions superset/assets/visualizations/filter_box.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion superset/assets/visualizations/histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/visualizations/mapbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/visualizations/sankey.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/visualizations/sunburst.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/visualizations/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion superset/assets/visualizations/treemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/visualizations/word_cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions superset/assets/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 1 addition & 4 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,7 @@ def get_payload(self, force=False):
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,
Expand Down

0 comments on commit 0807a8d

Please sign in to comment.