Skip to content

Commit cb004a0

Browse files
authored
Merge pull request #2 from AndroidPoet/animation-newcharts
README.md file fixed
2 parents 504ff6d + 2f04aa8 commit cb004a0

File tree

6 files changed

+27
-22
lines changed

6 files changed

+27
-22
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Add the dependency below to your **module**'s `build.gradle` file:
3333

3434
```gradle
3535
dependencies {
36-
implementation("io.github.androidpoet.drafter:$drafter_version")
36+
implementation("io.github.androidpoet:drafter:$drafter_version")
3737
}
3838
```
3939

@@ -43,7 +43,7 @@ For Kotlin Multiplatform, add the dependency below to your **module**'s `build.g
4343
sourceSets {
4444
val commonMain by getting {
4545
dependencies {
46-
implementation("io.github.androidpoet.drafter:$drafter_version")
46+
implementation("io.github.androidpoet:drafter:$drafter_version")
4747
}
4848
}
4949
}

app/src/main/kotlin/io/androidpoet/drafterdemo/ChartTitle.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ import androidx.compose.ui.Modifier
2323
import androidx.compose.ui.unit.dp
2424

2525
@Composable
26-
fun ChartTitle(text: String) {
26+
fun ChartTitle(
27+
text: String,
28+
modifier: Modifier = Modifier,
29+
) {
2730
Text(
2831
text = text,
29-
modifier = Modifier.padding(horizontal = 16.dp),
32+
modifier = modifier.padding(horizontal = 16.dp),
3033
style = MaterialTheme.typography.titleLarge,
3134
)
3235
}

app/src/main/kotlin/io/androidpoet/drafterdemo/bars/GroupedBarChartExample.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ fun GroupedBarChartExample() {
3232
labels = listOf("Q1", "Q2", "Q3", "Q4"),
3333
itemNames = listOf("Product A", "Product B"),
3434
groupedValues =
35-
listOf(
36-
listOf(10f, 15f),
37-
listOf(20f, 25f),
38-
listOf(15f, 10f),
39-
listOf(25f, 20f),
40-
),
35+
listOf(
36+
listOf(10f, 15f),
37+
listOf(20f, 25f),
38+
listOf(15f, 10f),
39+
listOf(25f, 20f),
40+
),
4141
colors = listOf(Color.Cyan, Color.Magenta),
4242
)
4343
val renderer = GroupedBarChartRenderer()

app/src/main/kotlin/io/androidpoet/drafterdemo/bars/HistogramChartExample.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
package io.androidpoet.drafterdemo.bars
17+
1718
import androidx.compose.foundation.layout.fillMaxSize
1819
import androidx.compose.runtime.Composable
1920
import androidx.compose.ui.Modifier
@@ -23,11 +24,11 @@ import io.androidpoet.drafterdemo.ChartContainer
2324
import io.androidpoet.drafterdemo.ChartTitle
2425

2526
@Composable
26-
fun HistogramChartExample() {
27+
fun HistogramChartExample(modifier: Modifier = Modifier) {
2728
ChartTitle(text = "Histogram Chart")
2829
val dataPoints = listOf(1f, 2f, 2f, 3f, 3f, 3f, 4f, 4f, 5f, 5f, 5f, 5f)
2930
val binCount = 5
30-
ChartContainer {
31+
ChartContainer(modifier = modifier) {
3132
HistogramChart(
3233
dataPoints = dataPoints,
3334
binCount = binCount,

app/src/main/kotlin/io/androidpoet/drafterdemo/bars/StackedBarChartExample.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
package io.androidpoet.drafterdemo.bars
17+
1718
import androidx.compose.foundation.layout.fillMaxSize
1819
import androidx.compose.runtime.Composable
1920
import androidx.compose.ui.Modifier
@@ -25,22 +26,22 @@ import io.androidpoet.drafterdemo.ChartContainer
2526
import io.androidpoet.drafterdemo.ChartTitle
2627

2728
@Composable
28-
fun StackedBarChartExample() {
29+
fun StackedBarChartExample(modifier: Modifier = Modifier) {
2930
ChartTitle(text = "Stacked Bar Chart")
3031
val data =
3132
StackedBarChartData(
3233
labels = listOf("Jan", "Feb", "Mar", "Apr"),
3334
stacks =
34-
listOf(
35-
listOf(5f, 5f, 2f),
36-
listOf(7f, 3f, 4f),
37-
listOf(6f, 4f, 3f),
38-
listOf(8f, 2f, 5f),
39-
),
35+
listOf(
36+
listOf(5f, 5f, 2f),
37+
listOf(7f, 3f, 4f),
38+
listOf(6f, 4f, 3f),
39+
listOf(8f, 2f, 5f),
40+
),
4041
colors = listOf(Color.Blue, Color.Red, Color.Green),
4142
)
4243
val renderer = StackedBarChartRenderer()
43-
ChartContainer {
44+
ChartContainer(modifier = modifier) {
4445
BarChart(
4546
data = data,
4647
renderer = renderer,

app/src/main/kotlin/io/androidpoet/drafterdemo/bars/WaterfallChartExample.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import io.androidpoet.drafterdemo.ChartContainer
2828
import io.androidpoet.drafterdemo.ChartTitle
2929

3030
@Composable
31-
fun WaterfallChartExample() {
31+
fun WaterfallChartExample(modifier: Modifier = Modifier) {
3232
ChartTitle(text = "Waterfall Chart")
3333
val data =
3434
WaterfallChartData(
@@ -38,7 +38,7 @@ fun WaterfallChartExample() {
3838
initialValue = 1000f,
3939
)
4040
val renderer = WaterfallChartRenderer()
41-
ChartContainer(modifier = Modifier.height(300.dp)) {
41+
ChartContainer(modifier = modifier.height(300.dp)) {
4242
BarChart(
4343
data = data,
4444
renderer = renderer,

0 commit comments

Comments
 (0)