Skip to content

Commit 5ac9247

Browse files
committed
feat: hide x-axis from legend and use x-axis label to actually set the plot x-axis label
1 parent bcd29b9 commit 5ac9247

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/plot.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ def get_pen(self, index):
2626

2727
def set_header(self, header_names):
2828
self.trace_names = header_names
29-
for i, name in enumerate(self.trace_names):
29+
# the first trace is the x axis, so take it out and use it to set the x
30+
# axis label
31+
self.plot_item.setLabel("bottom", text=self.trace_names[0])
32+
for i, name in enumerate(self.trace_names[1:]):
3033
if name in self.traces:
3134
pass
3235
else:
@@ -60,13 +63,13 @@ def update_raw(self, data):
6063

6164
for row in data:
6265
print("row len: {}".format(len(row)))
63-
for i in range(0, len(self.trace_names)):
66+
for i in range(1, len(self.trace_names)):
6467
print("updating data for {} - {}".format(i, self.trace_names[i]))
6568
self.data[self.trace_names[i]]["x"].append(row[i*2])
6669
self.data[self.trace_names[i]]["y"].append(row[i*2+1])
6770

6871
# now actually plot the data
69-
for i, name in enumerate(self.trace_names):
72+
for i, name in enumerate(self.trace_names[1:]):
7073
self.set_plotdata(name, self.data[name]["x"], self.data[name]["y"])
7174

7275
def set_plotdata(self, name, data_x, data_y):

0 commit comments

Comments
 (0)