Flip bar chart
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -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,
|
||||||
|
|||||||