mirror of https://github.com/apache/superset.git
fix: default missing values to zero on area chart (#8678)
* Add fill_value to area chart pivot * Only fill for area chart * Linting
This commit is contained in:
parent
b2633a51d4
commit
bd91f334d9
|
@ -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 = []
|
||||
|
@ -1158,7 +1159,10 @@ class NVD3TimeSeriesViz(NVD3Viz):
|
|||
)
|
||||
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")
|
||||
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue