Skip to content
Snippets Groups Projects
Commit 113bdf9a authored by Allen, Bruce (CIV)'s avatar Allen, Bruce (CIV)
Browse files

fix scale

parent dd07fe7f
No related branches found
No related tags found
No related merge requests found
Pipeline #5004 failed
...@@ -46,16 +46,18 @@ class GanttChart(QGraphicsItem): ...@@ -46,16 +46,18 @@ class GanttChart(QGraphicsItem):
bar_name_widths = list() bar_name_widths = list()
self.bar_starts = list() self.bar_starts = list()
self.bar_stops = list() self.bar_stops = list()
bar_starts_plus_stops = list()
for name, start, stop in bars: for name, start, stop in bars:
self.bar_names.append(name) self.bar_names.append(name)
bar_name_widths.append(_text_width(name)) bar_name_widths.append(_text_width(name))
self.bar_starts.append(start) self.bar_starts.append(start)
self.bar_stops.append(stop) self.bar_stops.append(stop)
bar_starts_plus_stops.append(start + stop)
self.max_bar_value = max(self.bar_stops) self.max_bar_value = max(self.bar_stops)
self.max_bar_name_w = max(bar_name_widths) + 4 self.max_bar_name_w = max(bar_name_widths) + 4
self.num_bars = len(bars) self.num_bars = len(bars)
if self.bar_stops: if self.bar_stops:
_max = max(self.bar_stops) _max = max(bar_starts_plus_stops)
if _max: if _max:
self.bar_scale = MAX_BAR_W / _max self.bar_scale = MAX_BAR_W / _max
else: else:
......
...@@ -46,7 +46,6 @@ def make_view(json_view, default_x, default_y): ...@@ -46,7 +46,6 @@ def make_view(json_view, default_x, default_y):
view = Graph(json_view, default_x, default_y) view = Graph(json_view, default_x, default_y)
elif json_view["type"] == "BAR_CHART": elif json_view["type"] == "BAR_CHART":
data = json_view["data"] data = json_view["data"]
print("data",data)
if data["ROTATE"] == 0: if data["ROTATE"] == 0:
view = BarChart(json_view, default_x, default_y) view = BarChart(json_view, default_x, default_y)
elif data["ROTATE"] == 1: elif data["ROTATE"] == 1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment