Skip to content

Commit

Permalink
revert for legend scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsondrew committed Mar 28, 2024
1 parent cf5b161 commit f6265d0
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions superset/common/query_context_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,36 +250,13 @@ def get_query_result(self, query_object: QueryObject) -> QueryResult:

query += ";\n\n".join(queries)
query += ";\n\n"
timeseries_limit_metric = None
x_axis_index = None
sort_order = None
# Here we extract the x axis as its being used as index
# in the pivot operation
if self._query_context and self._query_context.form_data:
x_axis_index = self._query_context.form_data.get("x_axis")
if isinstance(x_axis_index, dict):
x_axis_index = x_axis_index.get("label")
timeseries_limit_metric = self._query_context.form_data.get(
"timeseries_limit_metric"
)
if timeseries_limit_metric and x_axis_index is not None:
sort_order = df[x_axis_index].unique().tolist()
sort_order = [item for item in sort_order if item is not None]

# Re-raising QueryObjectValidationError
try:
df = query_object.exec_post_processing(df)
except InvalidPostProcessingError as ex:
raise QueryObjectValidationError(ex.message) from ex
if (
timeseries_limit_metric
and x_axis_index is not None
and sort_order is not None
):
df[x_axis_index] = pd.Categorical(
df[x_axis_index], categories=sort_order, ordered=True
)
df = df.sort_values(x_axis_index)
df = df.reset_index(drop=True)

result.df = df
result.query = query
result.from_dttm = query_object.from_dttm
Expand Down

0 comments on commit f6265d0

Please sign in to comment.