@@ -56,7 +56,7 @@ def to_dict(self):
56
56
Redefines DessiaObject's to_dict() in order to remove keys where
57
57
value is None.
58
58
"""
59
- dict_ = DessiaObject .to_dict (self )
59
+ dict_ = DessiaObject .to_dict (self , use_pointers = False )
60
60
del dict_ ['object_class' ]
61
61
new_dict_ = delete_none_from_dict (dict_ )
62
62
return new_dict_
@@ -167,21 +167,28 @@ class TextStyle(DessiaObject):
167
167
"ideographic" or "bottom". More info on \
168
168
https://www.w3schools.com/tags/canvas_textbaseline.asp
169
169
:type text_align_y: str
170
+ :param bold:
171
+ :type bold: bool
172
+ :param italic:
173
+ :type italic: bool
174
+ :param angle: Text angle in degrees. The angle is clockwise.
175
+ :type angle: float
170
176
"""
171
177
172
178
def __init__ (self , text_color : colors .Color = None ,
173
179
font_size : float = None ,
174
180
font_style : str = None ,
175
181
text_align_x : str = None , text_align_y : str = None ,
176
182
bold : bool = None , italic : bool = None ,
177
- name : str = '' ):
183
+ angle : float = None , name : str = '' ):
178
184
self .text_color = text_color
179
185
self .font_size = font_size
180
186
self .font_style = font_style
181
187
self .text_align_x = text_align_x
182
188
self .text_align_y = text_align_y
183
189
self .bold = bold
184
190
self .italic = italic
191
+ self .angle = angle
185
192
DessiaObject .__init__ (self , name = name )
186
193
187
194
@@ -876,14 +883,15 @@ def __init__(self, primitive_groups: List[PrimitiveGroup],
876
883
sizes = [sizes ] * len (primitive_groups )
877
884
self .sizes = sizes
878
885
self .coords = coords
879
- if x_variable or y_variable :
880
- attribute_names = []
881
- if x_variable :
882
- attribute_names .append (x_variable )
883
- if y_variable :
884
- attribute_names .append (y_variable )
885
- self .association = {'associated_elements' : associated_elements ,
886
- 'attribute_names' : attribute_names }
886
+ if associated_elements :
887
+ self .association = {'associated_elements' : associated_elements }
888
+ if x_variable or y_variable :
889
+ attribute_names = []
890
+ if x_variable :
891
+ attribute_names .append (x_variable )
892
+ if y_variable :
893
+ attribute_names .append (y_variable )
894
+ self .association ['attribute_names' ] = attribute_names
887
895
PlotDataObject .__init__ (self , type_ = 'primitivegroupcontainer' ,
888
896
name = name )
889
897
@@ -1027,7 +1035,8 @@ def __init__(self, plots: List[Subclass[PlotDataObject]],
1027
1035
def plot_canvas (plot_data_object : Subclass [PlotDataObject ],
1028
1036
debug_mode : bool = False , canvas_id : str = 'canvas' ,
1029
1037
force_version : str = None ,
1030
- width : int = 750 , height : int = 400 , page_name : str = None ):
1038
+ width : int = 750 , height : int = 400 , page_name : str = None ,
1039
+ display : bool = True ):
1031
1040
"""
1032
1041
Creates a html file and plots input data in web browser
1033
1042
@@ -1089,12 +1098,14 @@ def plot_canvas(plot_data_object: Subclass[PlotDataObject],
1089
1098
with open (temp_file , 'wb' ) as file :
1090
1099
file .write (s .encode ('utf-8' ))
1091
1100
1092
- webbrowser .open ('file://' + temp_file )
1101
+ if display :
1102
+ webbrowser .open ('file://' + temp_file )
1093
1103
print ('file://' + temp_file )
1094
1104
else :
1095
1105
with open (page_name + '.html' , 'wb' ) as file :
1096
1106
file .write (s .encode ('utf-8' ))
1097
- webbrowser .open ('file://' + os .path .realpath (page_name + '.html' ))
1107
+ if display :
1108
+ webbrowser .open ('file://' + os .path .realpath (page_name + '.html' ))
1098
1109
print (page_name + '.html' )
1099
1110
1100
1111
0 commit comments