Update CoreDraw.py

This commit is contained in:
Redsandy 2022-03-05 23:49:17 +03:00 committed by GitHub
parent 33848db972
commit ca55e55aed

View File

@ -28,6 +28,36 @@ init_notebook_mode()
import CoreTraidMath import CoreTraidMath
import plotly.express as px import plotly.express as px
class agrigateFig():
def __init__(self,data=[],needDraw=False ,subplot_titles=None):
self.data=data
self.ans=self.getAgrPlt()
if needDraw:
self.subplot_titles=subplot_titles
self.fig=coreDraw(self.ans,True,self.subplot_titles)
def getAgrPlt(self):
count=0
ans=[]
for i in self.data:
count=count+1
if type(i)==list:
for g in i:
for j in g.figDict:
ans.append(j)
ans[-1]['row']=count
else:
for j in i.figDict:
ans.append(j)
ans[-1]['row']=count
return ans
class corePlt(): class corePlt():
def __init__(self, params={ def __init__(self, params={
'vtype':'', 'vtype':'',
@ -47,9 +77,10 @@ class corePlt():
class coreDraw(): class coreDraw():
def __init__(self, data=[],needShow=False): def __init__(self, data=[], needShow=False,subplot_titles={}):
self.data=self.getPlts(data) self.data=self.getPlts(data)
self.needShow=needShow self.needShow=needShow
self.subplot_titles=subplot_titles
self.ans=self.getAns() self.ans=self.getAns()
@ -101,10 +132,11 @@ class coreDraw():
rows=maxRow, rows=maxRow,
cols=maxCol, cols=maxCol,
shared_xaxes=True, shared_xaxes=True,
vertical_spacing=0.02, #vertical_spacing=0.2,
shared_yaxes=True, shared_yaxes=True,
horizontal_spacing=0.02, #horizontal_spacing=0.2,
#column_widths=[] #column_widths=[]
subplot_titles=self.subplot_titles
) )