Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: default missing values to zero on area chart #8678

Merged
merged 3 commits into from
Dec 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,7 @@ class NVD3TimeSeriesViz(NVD3Viz):
verbose_name = _("Time Series - Line Chart")
sort_series = False
is_timeseries = True
pivot_fill_value: Optional[int] = None

def to_series(self, df, classed="", title_suffix=""):
cols = []
Expand Down Expand Up @@ -1158,7 +1159,10 @@ def process_data(self, df, aggregate=False):
)
else:
df = df.pivot_table(
index=DTTM_ALIAS, columns=fd.get("groupby"), values=self.metric_labels
index=DTTM_ALIAS,
columns=fd.get("groupby"),
values=self.metric_labels,
fill_value=self.pivot_fill_value,
)

rule = fd.get("resample_rule")
Expand Down Expand Up @@ -1444,6 +1448,7 @@ class NVD3TimeSeriesStackedViz(NVD3TimeSeriesViz):
viz_type = "area"
verbose_name = _("Time Series - Stacked")
sort_series = True
pivot_fill_value = 0


class DistributionPieViz(NVD3Viz):
Expand Down