@@ -620,7 +620,7 @@ def load(self, header=True, convert_float=True, nb_axes=None, index_col=None, fi
620
620
else :
621
621
return Array (list_data )
622
622
623
- def make_plot (self , position : str , width : int = 427 , height : int = 230 , title : str = None , template : str = None ,
623
+ def make_plot (self , data_source : str , width : int = 427 , height : int = 230 , title : str = None , template : str = None ,
624
624
min_y : Union [int , float ]= None , max_y : Union [int , float ]= None ,
625
625
xticks_spacing : Union [int , float ]= None , customize_func : Callable = None ,
626
626
customize_kwargs : Dict [str , str ]= None ) -> Any :
@@ -632,7 +632,7 @@ def make_plot(self, position: str, width: int=427, height: int=230, title: str=N
632
632
raise ValueError (f"Could not find template file { template } " )
633
633
title = str (title ) if title is not None else None
634
634
sheet = self .sheet .xw_sheet .api
635
- data_range = self . xw_range . api
635
+ data_range = sheet . Range ( data_source )
636
636
top_left_cell = data_range .Cells (1 , 1 )
637
637
# expand if current range is one cell
638
638
if data_range .Count == 1 :
@@ -644,12 +644,11 @@ def make_plot(self, position: str, width: int=427, height: int=230, title: str=N
644
644
top_left_cell .Value = ''
645
645
# start chart
646
646
sheet_charts = sheet .ChartObjects ()
647
- position = sheet . Range ( position )
648
- left , top = position .Left , position .Top
647
+ range_chart = self . xw_range . api
648
+ left , top = range_chart .Left , range_chart .Top
649
649
obj = sheet_charts .Add (left , top , width , height )
650
650
obj_chart = obj .Chart
651
- source = data_range
652
- obj_chart .SetSourceData (source )
651
+ obj_chart .SetSourceData (data_range )
653
652
obj_chart .ChartType = ChartType .xlLine
654
653
# title
655
654
if title is not None :
0 commit comments