Commit 51d25297 authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Adding color on the legend

parent 71856b08
......@@ -674,6 +674,13 @@ def panda_color_mapping(v):
return ''
def panda_legend_color_mapping(v):
try:
return panda_color_mapping(models.GlobalViralHostResponseValue.objects.get(name=v).value)
except ValueError:
return ""
def download_responses(request):
form = forms.BrowseForm(
user=request.user,
......@@ -767,6 +774,7 @@ def download_responses(request):
df_data = df_data.style.applymap(func=panda_color_mapping)
df_data.to_excel(writer)
df_legend = df_legend.style.applymap(func=panda_legend_color_mapping)
df_legend.to_excel(writer, startcol=0, startrow=len(row_header) + 3)
if len(options) > 0:
df_options.to_excel(writer, startcol=0, startrow=len(row_header) + 3 + len(legend_name) + 3, index=None)
......@@ -971,6 +979,7 @@ def host_or_virus_download(request, is_host, instance):
df_data = df_data.style.applymap(func=panda_color_mapping)
df_data.to_excel(writer, startcol=0, startrow=2)
df_legend = df_legend.style.applymap(func=panda_legend_color_mapping)
df_legend.to_excel(writer, startcol=0, startrow=len(row_header) + 3 + 2)
if len(options) > 0:
df_options.to_excel(writer, startcol=0, startrow=len(row_header) + 3 + len(legend_name) + 3 + 2,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment