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

added hack to make time pivot chart working #5928

Closed
wants to merge 1 commit into from
Closed

added hack to make time pivot chart working #5928

wants to merge 1 commit into from

Conversation

srggrs
Copy link
Contributor

@srggrs srggrs commented Sep 19, 2018

guys

I noticed there is a bug in the chart time periodicity pivot. For example if you use the example birth data as the datasource/table ("birth_names), the chart return and error

'NoneType' object is not iterable

so I went down and dig in the code and realised there is some issue in getting the metrics values from metric. So I added that line below that make the chart working (try to use another data source with data time resolution of weeks or day to see the overlapping of all the lines as all the example data are with year minimum resolution hence can overlap them as there is no frequecy option higher than year).

I think the problem is that in the class NVD3TimePivotViz, the method query_obj can't override the default method that is in the base class BaseViz.

Am I right?

@mistercrunch
Copy link
Member

Can you share the full stack trace you hit prior to this fix? At first sight I don't understand why your fix works.

@srggrs
Copy link
Contributor Author

srggrs commented Sep 19, 2018

2018-09-19 16:44:44,467:DEBUG:root:�[36m[stats_logger] (incr) loaded_from_source�[0m
2018-09-19 16:44:44,467:ERROR:root:'NoneType' object is not iterable
Traceback (most recent call last):
  File "/home/serg/miniconda3/lib/python3.5/site-packages/superset/views/core.py", line 1105, in generate_json
    payload = viz_obj.get_payload()
  File "/home/serg/miniconda3/lib/python3.5/site-packages/superset/viz.py", line 359, in get_payload
    payload['data'] = self.get_data(df)
  File "/home/serg/miniconda3/lib/python3.5/site-packages/superset/viz.py", line 1381, in get_data
    df = self.process_data(df)
  File "/home/serg/miniconda3/lib/python3.5/site-packages/superset/viz.py", line 1147, in process_data
    values=utils.get_metric_names(fd.get('metrics')))
  File "/home/serg/miniconda3/lib/python3.5/site-packages/superset/utils.py", line 840, in get_metric_names
    return [get_metric_name(metric) for metric in metrics]
TypeError: 'NoneType' object is not iterable

error at line 44. Step to reproduce the error:
1 - from Sources >> Tables, select birth_names table
2 - after the query/explore page load, select TIme Series - Periodicity Pivot as the Visualization Type

@mistercrunch
Copy link
Member

#5931 is a better fix

@srggrs
Copy link
Contributor Author

srggrs commented Sep 19, 2018

@mistercrunch thank you for reviewing this. That was my first contribution in github and now I learned more how to post issues and pull request.

cheers,
serg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants