Skip to content

Commit

Permalink
Center axis title Strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
gsteckman committed Dec 2, 2023
1 parent 9dc1a94 commit efaf972
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/commonMain/kotlin/io/github/koalaplot/core/xygraph/XYGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.rotate
Expand Down Expand Up @@ -741,11 +742,13 @@ public fun <X, Y> XYGraph(
},
xAxisTitle = {
if (xAxisTitle != null)
Text(
xAxisTitle,
color = MaterialTheme.colorScheme.onBackground,
style = MaterialTheme.typography.titleMedium
)
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
Text(
xAxisTitle,
color = MaterialTheme.colorScheme.onBackground,
style = MaterialTheme.typography.titleMedium
)
}
},
yAxisStyle,
yAxisLabels = {
Expand All @@ -758,13 +761,15 @@ public fun <X, Y> XYGraph(
},
yAxisTitle = {
if (yAxisTitle != null) {
Text(
yAxisTitle,
color = MaterialTheme.colorScheme.onBackground,
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.rotateVertically(VerticalRotation.COUNTER_CLOCKWISE)
.padding(bottom = KoalaPlotTheme.sizes.gap),
)
Box(modifier = Modifier.fillMaxHeight(), contentAlignment = Alignment.Center) {
Text(
yAxisTitle,
color = MaterialTheme.colorScheme.onBackground,
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.rotateVertically(VerticalRotation.COUNTER_CLOCKWISE)
.padding(bottom = KoalaPlotTheme.sizes.gap),
)
}
}
},
horizontalMajorGridLineStyle,
Expand Down

0 comments on commit efaf972

Please sign in to comment.