Skip to content

Commit e07a91f

Browse files
author
Robert Ehrhardt
committed
* update docs
1 parent 2461ec5 commit e07a91f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

compose-charts/src/commonMain/kotlin/ir/ehsannarmani/compose_charts/models/PopupProperties.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ data class PopupProperties(
1919
val contentHorizontalPadding: Dp = 4.dp,
2020
val contentVerticalPadding: Dp = 2.dp,
2121
val mode: Mode = Mode.Normal,
22+
@Deprecated(
23+
message = "Use contentBuilderNew instead for enhanced functionality",
24+
replaceWith = ReplaceWith("contentBuilderFunction: (dataIndex: Int, valueIndex: Int, value: Double)")
25+
)
2226
val contentBuilder: (value: Double) -> String = {
2327
it.format(1)
2428
},

document/docs/chart-properties/popups.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
| `contentHorizontalPadding` | Dp | `4.dp` | specifies popup horizontal padding |
1515
| `contentVerticalPadding` | Dp | `2.dp` | specifies popup vertical padding |
1616
| `mode` | PopupProperties.Mode | `Mode.Normal` | specifies popup visibility mode ( you can pass PointMode to make popup visible just on points ) |
17-
| `contentBuilder` | (Double)->String | `{ "%.2f".format(it) }` | specifies popup content creation template |
17+
| `contentBuilder` **(Deprecated)** | (Double)->String | `{ "%.2f".format(it) }` | specifies popup content creation template |
18+
| `contentBuilderFunction` | (String, Double)->String | `{ "%.2f".format(it) }` | specifies popup content creation template |
1819

1920
!!! tip "Tip"
2021
In line charts your can set specific popup properties for each line, for example you can disable one
@@ -32,8 +33,8 @@
3233
cornerRadius = 8.dp,
3334
contentHorizontalPadding = 4.dp,
3435
contentVerticalPadding = 2.dp,
35-
contentBuilder = { value->
36-
"%.1f".format(value)+"Million"
36+
contentBuilderFuntion = { label, value->
37+
label + ": %.1f".format(value)+" Million"
3738
}
3839
)
3940
```

0 commit comments

Comments
 (0)