Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.*
Expand Down Expand Up @@ -119,9 +118,7 @@ internal fun ChartContent(

}
} else {
if (linesParameters.size >= 2) {
clickedPoints.clear()
}
// Tooltips enabled for multi-line charts
linesParameters.forEach { line ->
if (line.lineType == LineType.DEFAULT_LINE) {

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.drawscope.clipRect
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.ExperimentalTextApi
Expand All @@ -31,6 +30,7 @@ internal fun DrawScope.drawDefaultLineWithShadow(
clickedPoints: MutableList<Pair<Float, Float>>,
textMeasure: TextMeasurer,
xRegionWidth: Dp,
xAxisData: List<String> = emptyList(),
) {

val strokePathOfDefaultLine = drawLineAsDefault(
Expand All @@ -41,7 +41,8 @@ internal fun DrawScope.drawDefaultLineWithShadow(
spacingY = spacingY,
clickedPoints = clickedPoints,
textMeasure = textMeasure,
xRegionWidth = xRegionWidth
xRegionWidth = xRegionWidth,
xAxisData = xAxisData
)

if (line.lineShadow) {
Expand Down Expand Up @@ -71,6 +72,7 @@ private fun DrawScope.drawLineAsDefault(
clickedPoints: MutableList<Pair<Float, Float>>,
textMeasure: TextMeasurer,
xRegionWidth: Dp,
xAxisData: List<String> = emptyList(),
) = Path().apply {
val height = size.height.toDp()
drawPathLineWrapper(
Expand Down Expand Up @@ -100,14 +102,15 @@ private fun DrawScope.drawLineAsDefault(
lastClickedPoint = null
} else {
lastClickedPoint = Pair(startXPoint.toPx(), startYPoint.toFloat())
circleWithRectAndText(
drawTooltipWithMarker(
x = startXPoint,
y = startYPoint,
textMeasure = textMeasure,
info = info,
stroke = Stroke(width = 2.dp.toPx()),
textMeasurer = textMeasure,
xIndex = index,
yValue = info,
line = lineParameter,
animatedProgress = animatedProgress
animatedProgress = animatedProgress,
xAxisData = xAxisData
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.drawscope.clipRect
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.ExperimentalTextApi
Expand All @@ -32,6 +31,7 @@ internal fun DrawScope.drawQuarticLineWithShadow(
clickedPoints: MutableList<Pair<Float, Float>>,
xRegionWidth: Dp,
textMeasurer: TextMeasurer,
xAxisData: List<String> = emptyList(),
) {
val strokePathOfQuadraticLine = drawLineAsQuadratic(
line = line,
Expand All @@ -42,7 +42,8 @@ internal fun DrawScope.drawQuarticLineWithShadow(
specialChart = specialChart,
clickedPoints = clickedPoints,
textMeasurer = textMeasurer,
xRegionWidth = xRegionWidth
xRegionWidth = xRegionWidth,
xAxisData = xAxisData
)

if (line.lineShadow && !specialChart) {
Expand Down Expand Up @@ -73,7 +74,8 @@ fun DrawScope.drawLineAsQuadratic(
specialChart: Boolean,
clickedPoints: MutableList<Pair<Float, Float>>,
textMeasurer: TextMeasurer,
xRegionWidth: Dp
xRegionWidth: Dp,
xAxisData: List<String> = emptyList(),
) = Path().apply {
var medX: Float
val height = size.height.toDp()
Expand Down Expand Up @@ -121,14 +123,15 @@ fun DrawScope.drawLineAsQuadratic(
lastClickedPoint = null
} else {
lastClickedPoint = Pair(xFirstPoint.toPx(), yFirstPoint.toFloat())
circleWithRectAndText(
drawTooltipWithMarker(
x = xFirstPoint,
y = yFirstPoint,
textMeasure = textMeasurer,
info = info,
stroke = Stroke(width = 2.dp.toPx()),
textMeasurer = textMeasurer,
xIndex = index,
yValue = info,
line = line,
animatedProgress = animatedProgress
animatedProgress = animatedProgress,
xAxisData = xAxisData
)
}

Expand Down
Loading