Skip to content

Commit 92176c9

Browse files
committed
Added ability to maintain ASR
1 parent 9372e93 commit 92176c9

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Grapher.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@ def Main():
5353

5454
#sets the preview pane to see the preview portion
5555
Preview = [ [sg.Menu(menu_def)],
56-
[sg.Column(columm_layout, size=(410,100), scrollable=True),sg.Table(values=data, )]]
56+
[sg.Column(columm_layout, size=(410,100), scrollable=True)]]
5757
#sets the layout for the graph settings on the box
58-
Setting = [[sg.Slider(range=(1,650), default_value=650, size=(10,10), orientation='horizontal', key = 'height',font=('Helvetica', 12)),
58+
Setting = [[sg.Slider(range=(1,1500), default_value=610, size=(10,10), orientation='horizontal', key = 'height',font=('Helvetica', 12)),
5959
sg.Text(' Name: ', size=(10,1)), sg.InputText(key='graphtitle', size=(15,1)), sg.Text(' Title of x-axis ', size = (14,1)),
6060
sg.InputText(key='xlabel', size=(15,1))],
6161
[sg.Text('Enter graph Height')],
62-
[sg.Slider(range=(1,1500), default_value=1500, size=(10,10), orientation='horizontal', key = 'width', font=('Helvetica', 12)),
62+
[sg.Slider(range=(1,1500), default_value=650, size=(10,10), orientation='horizontal', key = 'width', font=('Helvetica', 12)),
6363
sg.Text(' '),sg.Text(' Legend Location '), sg.InputCombo(['Top Left','Top Right','Bottom Left', 'Bottom Right'], key = 'legendloc'),
6464
sg.Text(' Title of y-axis ', size=(13,1)), sg.InputText(key='ylabel',size=(15,1))],
6565
[sg.Text('Enter graph Width')],
6666
[sg.Text(' ')],
6767
[sg.Text('Select the X axis'), sg.Text(' Select the y axis(s)')],
68-
[sg.Listbox(['Load CSV to See available headers'], key = 'xheaders', size=(30,6)),sg.Listbox(['Load CSV to See available headers'],select_mode='multiple',key = 'yheaders', size=(30,6))]]
68+
[sg.Listbox(['Load CSV to See available headers'], key = 'xheaders', size=(30,6)),sg.Listbox(['Load CSV to See available headers'],select_mode='multiple',key = 'yheaders', size=(30,6)), sg.Checkbox('Maintain ASR',default = False,key='ASR')]]
6969

7070
#general layout bringing all the smaller frames together
7171
layout = [[sg.Text('use open to load the csv')],
@@ -97,11 +97,7 @@ def Main():
9797
#opens up a window to choose a file with the extension .csv
9898
filename = sg.PopupGetFile('filename to open', no_window=True, file_types=(("CSV Files","*.csv"),))
9999

100-
if filename is not None:
101-
df = pd.read_csv(filename, sep=',',engine='python', header=None)
102-
data = df.values.tolist()
103-
104-
100+
105101

106102
#populates the first box for choosing the x axis
107103
if filename is not None:
@@ -141,7 +137,7 @@ def Main():
141137
#let the user know they tried to load a bad file
142138
sg.PopupError('Error reading file')
143139
continue
144-
140+
'''
145141
# clear the table
146142
[window.FindElement((i,j)).Update('') for j in range(MAX_COL) for i in range(MAX_ROWS)]
147143
@@ -164,6 +160,7 @@ def Main():
164160
#no work no do
165161
except:
166162
pass
163+
'''
167164
#TODO fix the save function to allow a user to change a field and save it as a csv
168165
#FIXME saves in an unreadable corrupt CSV
169166
elif event == 'Save':
@@ -205,7 +202,10 @@ def Main():
205202
colorar = ['green','blue','red','orange','aqua','black', 'pink', 'cyan']
206203

207204
#headers.Update(header_list)
208-
p = figure(title = name, plot_width=plotwidth, plot_height=plotheight)
205+
if values['ASR'] == True:
206+
p = figure(title = name, plot_width=plotwidth, plot_height=plotheight, match_aspect=True)
207+
if values['ASR'] == False:
208+
p = figure(title = name, plot_width=plotwidth, plot_height=plotheight)
209209

210210
p.xaxis.axis_label = xaxisname
211211
p.yaxis.axis_label = yaxisname
@@ -227,6 +227,8 @@ def Main():
227227
var = weight[yhead[i]]
228228
print(var)
229229
#creates the lines
230+
231+
230232
p.circle(xx,var, legend=yhead[i],fill_color=ccolor,line_color=ccolor)
231233
p.line(xx,var, legend=yhead[i],line_color=ccolor)
232234
#testing...

0 commit comments

Comments
 (0)