Skip to content

Commit

Permalink
A few bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Sep 27, 2016
1 parent b67906c commit 1a29163
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions caravel/assets/visualizations/directed_force.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -169,7 +170,6 @@ function directedForceVis(slice) {
return d.name;
});


slice.done(json);
});
};
Expand Down
8 changes: 4 additions & 4 deletions caravel/assets/visualizations/heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion caravel/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions caravel/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1599,9 +1599,7 @@ def sqllab_viz(self):
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)
Expand Down
4 changes: 3 additions & 1 deletion caravel/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def get_url(self, for_cache_key=False, **kwargs):
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()
Expand Down Expand Up @@ -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': (
Expand Down

0 comments on commit 1a29163

Please sign in to comment.