Calculating the bar thickness authored by Leonard Kupper's avatar Leonard Kupper
......@@ -60,3 +60,25 @@ This base size is the required size for all paddings. The required size can now
```
reqSize(thickness) = baseSize + b * tickness
```
Of course a limit for the total size by the available chart area `availableSize`. This means:
```
reqSize(thickness) <= availableSize
baseSize + b * tickness <= availableSize
// minus baseSize
b * tickness <= (availableSize - baseSize)
// divide by total amount of bars b
tickness <= (availableSize - baseSize) / b
// The maximum possible thickness is wanted. But it also must be a whole number.
thickness = floor((availableSize - baseSize) / b)
```
So the software will calculate the baseSize for the given `g, gpad, b, bpad` and then calculate the actual bar thickness complying with the user defined maximum:
`thickness = min(floor((availableSize - baseSize) / b), maxThickness)`
In the case of `thickness < minThickness` an exception will be thrown stating that there is not enough space available.
\ No newline at end of file