Flip bar chart

This commit is contained in:
2019-10-05 06:13:11 -05:00
parent 77a9701805
commit 105baf629a
6 changed files with 3 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -59,7 +59,7 @@ class BarChart(var theme: Theme,
canvas.fillRect(0.0, 0.0, width, height) canvas.fillRect(0.0, 0.0, width, height)
fun barGroupOffset(c: Int) = marginLeft + paddingLeft + fun barGroupOffset(c: Int) = marginLeft + paddingLeft +
(nColumns - c - 1) * barGroupWidth (c) * barGroupWidth
fun barOffset(c: Int, s: Int) = barGroupOffset(c) + fun barOffset(c: Int, s: Int) = barGroupOffset(c) +
barGroupMargin + barGroupMargin +
@@ -130,8 +130,8 @@ class BarChart(var theme: Theme,
val isLargeInterval = (axis[0].distanceTo(axis[1]) > 300) val isLargeInterval = (axis[0].distanceTo(axis[1]) > 300)
for (c in 0 until nColumns) { for (c in 0 until nColumns) {
val x = barGroupOffset(nColumns - c - 1) val x = barGroupOffset(c)
val date = axis[nColumns - c - 1] val date = axis[c]
if(isLargeInterval) { if(isLargeInterval) {
canvas.drawText(date.year.toString(), canvas.drawText(date.year.toString(),
x + barGroupWidth / 2, x + barGroupWidth / 2,