Skip to content

Commit 1c5e90a

Browse files
committed
add wave chart lables
1 parent 083f929 commit 1c5e90a

File tree

2 files changed

+41
-12
lines changed

2 files changed

+41
-12
lines changed

app/src/main/java/co/yml/ycharts/app/presentation/WaveChartActivity.kt

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ import androidx.activity.ComponentActivity
66
import androidx.activity.compose.setContent
77
import androidx.compose.foundation.layout.*
88
import androidx.compose.foundation.lazy.LazyColumn
9+
import androidx.compose.material.MaterialTheme
910
import androidx.compose.material.Scaffold
11+
import androidx.compose.material.Text
1012
import androidx.compose.runtime.Composable
1113
import androidx.compose.ui.Alignment
1214
import androidx.compose.ui.Modifier
1315
import androidx.compose.ui.graphics.Brush
1416
import androidx.compose.ui.graphics.Color
1517
import androidx.compose.ui.graphics.drawscope.Stroke
1618
import androidx.compose.ui.res.stringResource
19+
import androidx.compose.ui.text.font.FontWeight
1720
import androidx.compose.ui.unit.dp
1821
import co.yml.charts.axis.AxisData
1922
import co.yml.charts.common.extensions.formatToSinglePrecision
@@ -54,6 +57,12 @@ class WaveChartActivity : ComponentActivity() {
5457
items(3) { item ->
5558
when (item) {
5659
0 -> {
60+
Text(
61+
modifier = Modifier.padding(12.dp),
62+
text = getString(R.string.simple_wave_chart),
63+
style = MaterialTheme.typography.subtitle1,
64+
fontWeight = FontWeight.Bold
65+
)
5766
WaveGraph1(
5867
DataUtils.getWaveChartData(
5968
15.0,
@@ -62,21 +71,38 @@ class WaveChartActivity : ComponentActivity() {
6271
)
6372
)
6473
}
65-
1 -> WaveGraph2(
66-
DataUtils.getWaveChartData(
67-
15.0,
68-
50.0,
69-
0.2
74+
75+
1 -> {
76+
Text(
77+
modifier=Modifier.padding(12.dp),
78+
text = getString(R.string.sine_wave_chart),
79+
style = MaterialTheme.typography.subtitle1,
80+
fontWeight = FontWeight.Bold
81+
)
82+
WaveGraph2(
83+
DataUtils.getWaveChartData(
84+
15.0,
85+
50.0,
86+
0.2
87+
)
7088
)
71-
)
89+
}
7290

73-
2 -> WaveGraph3(
74-
DataUtils.getWaveChartData(
75-
20.0,
76-
5.0,
77-
1.0
91+
2 -> {
92+
Text(
93+
modifier = Modifier.padding(12.dp),
94+
text = getString(R.string.amplitude_wave_chart),
95+
style = MaterialTheme.typography.subtitle1,
96+
fontWeight = FontWeight.Bold
97+
)
98+
WaveGraph3(
99+
DataUtils.getWaveChartData(
100+
20.0,
101+
5.0,
102+
1.0
103+
)
78104
)
79-
)
105+
}
80106
}
81107
}
82108
})

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@
3030
<string name="horizontal_bar_chart">Horizontal Barchart</string>
3131
<string name="grouped_bar_chart">Grouped Barchart</string>
3232
<string name="stacked_barchart">Stacked Barchart</string>
33+
<string name="simple_wave_chart">Simple Wave Chart</string>
34+
<string name="sine_wave_chart">Sine-Wave Chart</string>
35+
<string name="amplitude_wave_chart">Amplitude Wave Chart</string>
3336

3437
</resources>

0 commit comments

Comments
 (0)