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

View File

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

View File

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

View File

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

View File

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

View File

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