mirror of
https://github.com/apache/superset.git
synced 2026-06-07 16:49:17 +00:00
Bugfix in line chart where the series name is an empty string (#434)
This commit is contained in:
@@ -551,14 +551,16 @@ class Caravel(BaseView):
|
||||
return redirect(error_redirect)
|
||||
if request.args.get("json") == "true":
|
||||
status = 200
|
||||
try:
|
||||
if config.get("DEBUG"):
|
||||
# Allows for nice debugger stack traces in debug mode
|
||||
payload = obj.get_json()
|
||||
except Exception as e:
|
||||
logging.exception(e)
|
||||
if config.get("DEBUG"):
|
||||
raise e
|
||||
payload = str(e)
|
||||
status = 500
|
||||
else:
|
||||
try:
|
||||
payload = obj.get_json()
|
||||
except Exception as e:
|
||||
logging.exception(e)
|
||||
payload = str(e)
|
||||
status = 500
|
||||
resp = Response(
|
||||
payload,
|
||||
status=status,
|
||||
|
||||
@@ -909,6 +909,15 @@ class NVD3TimeSeriesViz(NVD3Viz):
|
||||
return df
|
||||
|
||||
def to_series(self, df, classed='', title_suffix=''):
|
||||
cols = []
|
||||
for col in df.columns:
|
||||
if col == '':
|
||||
cols.append('N/A')
|
||||
elif col == None:
|
||||
cols.append('NULL')
|
||||
else:
|
||||
cols.append(col)
|
||||
df.columns = cols
|
||||
series = df.to_dict('series')
|
||||
|
||||
chart_data = []
|
||||
@@ -931,7 +940,10 @@ class NVD3TimeSeriesViz(NVD3Viz):
|
||||
d = {
|
||||
"key": series_title,
|
||||
"classed": classed,
|
||||
"values": [{'x': ds, 'y': ys[ds]} for ds in df.timestamp],
|
||||
"values": [
|
||||
{'x': ds, 'y': ys[ds] if ds in ys else None}
|
||||
for ds in df.timestamp
|
||||
],
|
||||
}
|
||||
chart_data.append(d)
|
||||
return chart_data
|
||||
|
||||
Reference in New Issue
Block a user