Skip to content

Commit

Permalink
fixing bar
Browse files Browse the repository at this point in the history
  • Loading branch information
jposada202020 committed Jul 29, 2023
1 parent 8769026 commit 0b90425
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions circuitpython_uplot/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,17 @@ def __init__(
self._projection = projection
self._filled = fill

self._y = [i * plot.scale for i in y]

if max_value is None:
y_max = max(y)
y_max = max(self._y)
else:
y_max = max_value

self._y = [i * plot.scale for i in y]

self._bar_space = int(bar_space / plot.scale)

xstart = int(xstart / plot.scale)

self._graphx = plot.scale * ceil(
abs(plot._newxmax - plot._newxmin) / (len(x) + 4)
)
Expand Down Expand Up @@ -120,7 +123,7 @@ def __init__(
xstart + (i * self._graphx) + self._graphx // 2,
plot._newymin,
)
xstart = xstart + self._bar_space
xstart = xstart + self._bar_space // plot.scale
plot._index_colorused = plot._index_colorused + 1
self._color_index = self._color_index + 1
else:
Expand Down Expand Up @@ -164,11 +167,11 @@ def __init__(
plot._index_colorused,
)

xstart = xstart + bar_space
xstart = xstart + self._bar_space
plot._index_colorused = plot._index_colorused + 1
plot.show_text(
str(y[i]),
xstart + (i * self._graphx) - bar_space + self._graphx // 2,
xstart + (i * self._graphx) - self._bar_space + self._graphx // 2,
plot._newymin,
)

Expand Down

0 comments on commit 0b90425

Please sign in to comment.