Skip to content

Commit

Permalink
refactor arc.get_data
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh committed Jan 4, 2018
1 parent 1614b22 commit 8d01b2a
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -2075,20 +2075,13 @@ def query_obj(self):
return d

def get_data(self, df):
fd = self.form_data
start_lat = df[fd.get('start_spatial').get('latCol')]
start_lon = df[fd.get('start_spatial').get('lonCol')]
end_lat = df[fd.get('end_spatial').get('latCol')]
end_lon = df[fd.get('end_spatial').get('lonCol')]
source_pos = list(zip(start_lon, start_lat))
target_pos = list(zip(end_lon, end_lat))

data = []
for pos in list(zip(source_pos, target_pos)):
for item in self.process_spatial_data_obj(df):
pos = item.get('position')
data.append({
'sourcePosition': pos[0],
'targetPosition': pos[1],
})
'sourcePosition': pos[0],
'targetPosition': pos[1],
})

return {
'arcs': data,
Expand Down

0 comments on commit 8d01b2a

Please sign in to comment.