Skip to content

Commit 4ac1400

Browse files
committed
Merge branch 'main' of github-personal:yml-org/YGraphs into feature/OS-56
2 parents c4a319b + 7de155f commit 4ac1400

28 files changed

+182
-166
lines changed

YChartsLib/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id("com.android.library")
33
id("org.jetbrains.kotlin.android")
4+
id("org.jetbrains.dokka")
45
}
56

67
android {

YChartsLib/src/main/java/co/yml/charts/axis/XAxis.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ private fun DrawScope.drawXAxisLabel(
161161
calculatedXAxisHeight
162162
}
163163

164+
/**
165+
* Returns triple of Xmax, Xmin & scale for given list of points and steps
166+
* @param points: List of points in axis
167+
* @param steps: Total steps in axis
168+
*/
164169
fun getXAxisScale(
165170
points: List<Point>,
166171
steps: Int,

YChartsLib/src/main/java/co/yml/charts/axis/YAxis.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private fun DrawScope.drawAxisLabel(
179179

180180
@Preview(showBackground = true)
181181
@Composable
182-
fun YAxisPreview() {
182+
private fun YAxisPreview() {
183183
val yAxisData = AxisData.Builder()
184184
.steps(5)
185185
.bottomPadding(10.dp)

YChartsLib/src/main/java/co/yml/charts/chartcontainer/container/ScrollableCanvasContainer.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ import co.yml.charts.chartcontainer.gestures.detectZoomGesture
3434
* @param onDraw: Draw any canvas inside the onDraw scope using the input params in the lambda fxn
3535
* @param drawXAndYAxis: Draw the X and Y axis along with the drawing area.
3636
* @param containerBackgroundColor: Background color of the whole container.
37+
* @param isPinchZoomEnabled: True if user can zoom in and out else false
3738
* @param layoutDirection: Used to define the direction of scroll.
3839
* @param onPointClicked: Callback for tap detected along with offset for tap.
3940
* @param onScroll: Callback when user starts scrolling the graph.
41+
* @param onZoomInAndOut: Callback when user starts zoomIn and Out w.r.t to the graph
4042
*/
4143

4244
@Composable
@@ -105,6 +107,11 @@ fun ScrollableCanvasContainer(
105107
}
106108
}
107109

110+
/**
111+
* Returns the scroll state within the start and computed max scrollOffset & filters invalid scroll states.
112+
* @param currentScrollOffset: Current scroll offset when user trying to scroll the canvas.
113+
* @param computedMaxScrollOffset: Maximum calculated scroll offset for given data set.
114+
*/
108115
fun checkAndGetMaxScrollOffset(currentScrollOffset: Float, computedMaxScrollOffset: Float): Float {
109116
return when {
110117
currentScrollOffset < 0f -> 0f

YChartsLib/src/main/java/co/yml/charts/chartcontainer/gestures/GestureExtensions.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import androidx.compose.ui.input.pointer.PointerInputScope
88
import androidx.compose.ui.input.pointer.positionChanged
99
import kotlin.math.abs
1010

11+
/**
12+
* Gesture support to detect and filter pointer scopes to give a zoom start callback
13+
* @param isZoomAllowed: True if user is allowed to zoom.
14+
* @param onZoom: Callback when zoom gesture is detected.
15+
*/
1116
internal suspend fun PointerInputScope.detectZoomGesture(
1217
isZoomAllowed: Boolean = true,
1318
onZoom: (zoom: Float) -> Unit

YChartsLib/src/main/java/co/yml/charts/common/components/ItemDivider.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ import androidx.compose.ui.Modifier
99
import androidx.compose.ui.graphics.Color
1010
import androidx.compose.ui.unit.Dp
1111

12+
/**
13+
* Draws a horizontal line as a divider for given thickness and color
14+
* @param thickness: Defines the thickness of the divider.
15+
* @param dividerColor: Defines the color of the divider.
16+
*/
1217
@Composable
1318
fun ItemDivider(thickness: Dp, dividerColor: Color = Color.Black) {
1419
Box(

YChartsLib/src/main/java/co/yml/charts/common/components/Legends.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ import androidx.compose.ui.unit.dp
1414
import co.yml.charts.common.model.LegendLabel
1515
import co.yml.charts.common.model.LegendsConfig
1616

17+
/**
18+
* Renders the list of legends in a grid format for given given grid column count
19+
* @param modifier: Defines the arrangements of ui compositions.
20+
* @param legendsConfig: Defines the configurations required for rendering legends in [LegendsConfig]
21+
*/
1722
@Composable
1823
fun Legends(modifier: Modifier = Modifier, legendsConfig: LegendsConfig) {
1924
with(legendsConfig) {

YChartsLib/src/main/java/co/yml/charts/common/components/accessibility/AccessibilityBottomSheetDailog.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import androidx.compose.ui.semantics.semantics
1313
import androidx.compose.ui.unit.dp
1414
import kotlinx.coroutines.launch
1515

16+
/**
17+
* Bottom sheet to show items in vertical list view with a close button at top
18+
*/
1619
@ExperimentalMaterialApi
1720
@Composable
1821
fun AccessibilityBottomSheetDialog(

YChartsLib/src/main/java/co/yml/charts/common/components/accessibility/BarInfo.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import androidx.compose.ui.semantics.semantics
1212
import androidx.compose.ui.unit.dp
1313
import androidx.compose.ui.unit.sp
1414

15+
/**
16+
* Composable to display each bar item for given bar chart
17+
* @param axisLabelDescription: Axis label description
18+
* @param barDescription: Bar description
19+
*/
1520
@Composable
1621
fun BarInfo(
1722
axisLabelDescription: String,

YChartsLib/src/main/java/co/yml/charts/common/components/accessibility/CombinedChartInfo.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ import co.yml.charts.ui.barchart.models.GroupBar
1717
import co.yml.charts.common.components.ItemDivider
1818
import co.yml.charts.common.model.Point
1919

20+
/**
21+
* Composable to display each combined chart item for given combined chart.
22+
* @param pointsList: List of points in each item.
23+
* @param lineColor: List of colors of lines as per line chart.
24+
* @param groupBar: Details of each group bar.
25+
* @param axisLabelDescription: Axis label description.
26+
* @param barColorPaletteList: List of each bar colors for a given group bar.
27+
* @param dividerColor: Divider color between each point items.
28+
*/
2029
@Composable
2130
fun CombinedChartInfo(
2231
pointsList: List<Point>,

0 commit comments

Comments
 (0)