mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-18 19:14:54 +00:00
kpi_csv_sq.py : update for write_html
Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import pandas as pd
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
import argparse
|
import argparse
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import base64
|
||||||
|
|
||||||
# Any style components can be used
|
# Any style components can be used
|
||||||
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
|
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
|
||||||
@@ -120,21 +121,31 @@ class csv_sqlite_dash():
|
|||||||
xaxis = {'type' : 'date'}
|
xaxis = {'type' : 'date'}
|
||||||
)
|
)
|
||||||
# save the figure - figures will be over written png
|
# save the figure - figures will be over written png
|
||||||
if self.png:
|
# for testing
|
||||||
if self.png_generated:
|
#png_path = ''
|
||||||
pass
|
#if self.png:
|
||||||
else:
|
#if self.png_generated:
|
||||||
self.png_generated = True
|
#pass
|
||||||
print("generating png files")
|
#else:
|
||||||
print("kpi_path:{}".format(df_tmp['kpi_path']))
|
self.png_generated = True
|
||||||
png_path = os.path.join(kpi_path_list[-1],"{}_{}_{}_{}_kpi.png".format(test_id_list[-1], group, test_tag, test_rig))
|
print("generating png files")
|
||||||
html_path = os.path.join(kpi_path_list[-1],"{}_{}_{}_{}_kpi.html".format(test_id_list[-1], group, test_tag, test_rig))
|
print("kpi_path:{}".format(df_tmp['kpi_path']))
|
||||||
print("png_path {}".format(png_path))
|
png_path = os.path.join(kpi_path_list[-1],"kpi.png") # use simple names {}_{}_{}_{}_kpi.png".format(test_id_list[-1], group, test_tag, test_rig))
|
||||||
kpi_fig.write_image(png_path,scale=1,width=1200,height=350)
|
html_path = os.path.join(kpi_path_list[-1],"kpi.html") # use simple names {}_{}_{}_{}_kpi.html".format(test_id_list[-1], group, test_tag, test_rig))
|
||||||
kpi_fig.write_html(html_path,scale=1,width=1200,height=350)
|
print("png_path {}".format(png_path))
|
||||||
|
kpi_fig.write_image(png_path,scale=1,width=1200,height=350)
|
||||||
|
#https://plotly.com/python/interactive-html-export/
|
||||||
|
# kpi_fig.write_html(html_path,width=1200,height=3500)
|
||||||
|
kpi_fig.write_html(html_path)
|
||||||
|
|
||||||
|
# https://community.plotly.com/t/png-image-not-showing/15713/2
|
||||||
|
#test_png = png_path
|
||||||
|
#print("test_png {}".format(test_png))
|
||||||
|
#test_base64 = base64.b64encode(open(test_png, 'rb').read()).decode('ascii')
|
||||||
|
self.children_div.append(html.Img(src=png_path))
|
||||||
|
|
||||||
# use image from above to creat html display
|
# use image from above to creat html display
|
||||||
self.children_div.append(dcc.Graph(figure=kpi_fig))
|
#self.children_div.append(dcc.Graph(figure=kpi_fig))
|
||||||
|
|
||||||
|
|
||||||
#TODO the link must be to a server to display html
|
#TODO the link must be to a server to display html
|
||||||
|
|||||||
Reference in New Issue
Block a user