A few bugfixes

This commit is contained in:
Maxime Beauchemin 2016-09-27 10:11:17 -07:00
parent b67906cfe1
commit 1a29163530
6 changed files with 14 additions and 13 deletions

View File

@ -11,13 +11,13 @@ function directedForceVis(slice) {
const width = slice.width(); const width = slice.width();
const height = slice.height() - 25; const height = slice.height() - 25;
d3.json(slice.jsonEndpoint(), function (error, json) { d3.json(slice.jsonEndpoint(), function (error, json) {
const linkLength = json.form_data.link_length || 200;
const charge = json.form_data.charge || -500;
if (error !== null) { if (error !== null) {
slice.error(error.responseText, error); slice.error(error.responseText, error);
return; return;
} }
const linkLength = json.form_data.link_length || 200;
const charge = json.form_data.charge || -500;
const links = json.data; const links = json.data;
const nodes = {}; const nodes = {};
// Compute the distinct nodes from the links. // Compute the distinct nodes from the links.
@ -87,6 +87,7 @@ function directedForceVis(slice) {
.on('tick', tick) .on('tick', tick)
.start(); .start();
div.selectAll('*').remove();
const svg = div.append('svg') const svg = div.append('svg')
.attr('width', width) .attr('width', width)
.attr('height', height); .attr('height', height);
@ -169,7 +170,6 @@ function directedForceVis(slice) {
return d.name; return d.name;
}); });
slice.done(json); slice.done(json);
}); });
}; };

View File

@ -18,6 +18,10 @@ function heatmapVis(slice) {
}; };
d3.json(slice.jsonEndpoint(), function (error, payload) { d3.json(slice.jsonEndpoint(), function (error, payload) {
if (error) {
slice.error(error.responseText, error);
return;
}
const data = payload.data; const data = payload.data;
// Dynamically adjusts based on max x / y category lengths // Dynamically adjusts based on max x / y category lengths
function adjustMargins() { function adjustMargins() {
@ -56,10 +60,6 @@ function heatmapVis(slice) {
slice.container.html(''); slice.container.html('');
const matrix = {}; const matrix = {};
if (error) {
slice.error(error.responseText, error);
return;
}
const fd = payload.form_data; const fd = payload.form_data;
adjustMargins(); adjustMargins();

View File

@ -326,7 +326,7 @@ def load_world_bank_health_n_pop():
defaults, defaults,
since="1960-01-01", since="1960-01-01",
until="now", until="now",
whisker_options="Tukey", whisker_options="Min/max (no outliers)",
viz_type='box_plot', viz_type='box_plot',
groupby=["region"],)), groupby=["region"],)),
Slice( Slice(

View File

@ -107,6 +107,7 @@ def get_or_create_main_db(caravel):
logging.info(config.get("SQLALCHEMY_DATABASE_URI")) logging.info(config.get("SQLALCHEMY_DATABASE_URI"))
dbobj.set_sqlalchemy_uri(config.get("SQLALCHEMY_DATABASE_URI")) dbobj.set_sqlalchemy_uri(config.get("SQLALCHEMY_DATABASE_URI"))
dbobj.expose_in_sqllab = True dbobj.expose_in_sqllab = True
dbobj.allow_run_sync = True
db.session.add(dbobj) db.session.add(dbobj)
db.session.commit() db.session.commit()
return dbobj return dbobj

View File

@ -1599,9 +1599,7 @@ class Caravel(BaseCaravelView):
viz_type = data.get('chartType') viz_type = data.get('chartType')
table = db.session.query(models.SqlaTable).filter_by(table_name=table_name).first() table = db.session.query(models.SqlaTable).filter_by(table_name=table_name).first()
if not table: if not table:
table = models.SqlaTable( table = models.SqlaTable(table_name=table_name)
table_name=table_name,
)
table.database_id = data.get('dbId') table.database_id = data.get('dbId')
table.sql = data.get('sql') table.sql = data.get('sql')
db.session.add(table) db.session.add(table)

View File

@ -116,6 +116,8 @@ class BaseViz(object):
del d['json'] del d['json']
if 'action' in d: if 'action' in d:
del d['action'] del d['action']
if 'slice_id' in d:
del d['slice_id']
d.update(kwargs) d.update(kwargs)
# Remove unchecked checkboxes because HTML is weird like that # Remove unchecked checkboxes because HTML is weird like that
od = MultiDict() od = MultiDict()
@ -716,7 +718,7 @@ class BoxPlotViz(NVD3Viz):
viz_type = "box_plot" viz_type = "box_plot"
verbose_name = _("Box Plot") verbose_name = _("Box Plot")
sort_series = False sort_series = False
is_timeseries = False is_timeseries = True
fieldsets = ({ fieldsets = ({
'label': None, 'label': None,
'fields': ( 'fields': (