### Gradle Command for Building Project Source: https://github.com/hi-manshu/charty/blob/main/CONTRIBUTING.md Execute this command to build the entire Charty project. This is a standard step after setup or before testing. ```bash ./gradlew build ``` -------------------------------- ### Unit Test Example in Kotlin Source: https://github.com/hi-manshu/charty/blob/main/CONTRIBUTING.md An example of a unit test following the Arrange-Act-Assert pattern. Use descriptive names for your tests. ```kotlin @Test fun `test line chart renders with correct number of points`() { // Arrange val dataPoints = listOf( PointData(0f, 10f), PointData(1f, 20f), PointData(2f, 15f) ) // Act val result = calculateChartPoints(dataPoints) // Assert assertEquals(3, result.size) } ``` -------------------------------- ### PieChart / Donut Chart Example Source: https://context7.com/hi-manshu/charty/llms.txt Create interactive Pie or Donut charts with customizable styles, animations, legends, and slice labels. Configure hole ratio, animation duration, and slice interaction effects. ```kotlin import com.himanshoe.charty.pie.PieChart import com.himanshoe.charty.pie.config.PieChartConfig import com.himanshoe.charty.pie.config.PieChartStyle import com.himanshoe.charty.pie.config.LabelConfig import com.himanshoe.charty.pie.config.InteractionConfig import com.himanshoe.charty.pie.data.PieData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.common.config.Animation import androidx.compose.material3.Text import androidx.compose.ui.graphics.Color // Donut chart with interactive slices and center text composable PieChart( data = { listOf( PieData("Product A", 45f), PieData("Product B", 30f), PieData("Product C", 15f), PieData("Product D", 10f, color = Color(0xFFFFEB3B)), // per-slice override ) }, color = ChartyColor.Gradient( listOf(Color(0xFF2196F3), Color(0xFF4CAF50), Color(0xFFFF9800), Color(0xFFE91E63)) ), config = PieChartConfig( style = PieChartStyle.DONUT, donutHoleRatio = 0.55f, animation = Animation.Enabled(duration = 900), labelConfig = LabelConfig(shouldShowPercentage = true, shouldShowValue = false), interactionConfig = InteractionConfig( selectedScaleMultiplier = 1.1f, selectedSlicePullOutDistance = 12f, unselectedSliceOpacity = 0.6f, ), sliceSpacingDegrees = 2f, ), onSliceClick = { slice, index -> println("Clicked slice $index: ${slice.label} = ${slice.value}") }, centerContent = { Text("Total\n${listOf(45, 30, 15, 10).sum()}", style = androidx.compose.material3.MaterialTheme.typography.titleMedium) }, ) ``` -------------------------------- ### CandlestickChart Example Source: https://context7.com/hi-manshu/charty/llms.txt Render financial OHLC data using CandlestickChart. Customize candle and wick appearance, colors for bullish/bearish candles, and enable animations. ```kotlin import com.himanshoe.charty.candlestick.CandlestickChart import com.himanshoe.charty.candlestick.config.CandlestickChartConfig import com.himanshoe.charty.candlestick.data.CandleData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.common.config.Animation import com.himanshoe.charty.common.config.CornerRadius import androidx.compose.ui.graphics.Color CandlestickChart( data = { listOf( CandleData("09:00", open = 100f, high = 112f, low = 97f, close = 108f), CandleData("10:00", open = 108f, high = 118f, low = 104f, close = 115f), CandleData("11:00", open = 115f, high = 116f, low = 105f, close = 107f), CandleData("12:00", open = 107f, high = 110f, low = 98f, close = 99f), CandleData("13:00", open = 99f, high = 108f, low = 96f, close = 106f), ) }, bullishColor = ChartyColor.Solid(Color(0xFF4CAF50)), // green for up bearishColor = ChartyColor.Solid(Color(0xFFF44336)), // red for down candlestickConfig = CandlestickChartConfig( candleWidthFraction = 0.7f, wickWidthFraction = 0.1f, showWicks = true, cornerRadius = CornerRadius.Small, animation = Animation.Enabled(duration = 800), ), ) ``` -------------------------------- ### Clone Repository Command Source: https://github.com/hi-manshu/charty/blob/main/CONTRIBUTING.md Use this command to clone the Charty repository locally. Navigate into the cloned directory to proceed with setup. ```bash git clone https://github.com/hi-manshu/charty.git cd charty ``` -------------------------------- ### StackedAreaChart Example Source: https://context7.com/hi-manshu/charty/llms.txt Use StackedAreaChart to display multiple series as stacked areas, showing individual values and cumulative totals. Configure line properties and fill transparency. ```kotlin import com.himanshoe.charty.line.StackedAreaChart import com.himanshoe.charty.line.config.LineChartConfig import com.himanshoe.charty.line.data.LineGroup import com.himanshoe.charty.color.ChartyColor import androidx.compose.ui.graphics.Color StackedAreaChart( data = { listOf( LineGroup("Mon", listOf(20f, 15f, 10f)), LineGroup("Tue", listOf(45f, 28f, 12f)), LineGroup("Wed", listOf(30f, 22f, 18f)), LineGroup("Thu", listOf(70f, 30f, 15f)), ) }, colors = ChartyColor.Gradient( listOf(Color(0xFF2196F3), Color(0xFF4CAF50), Color(0xFFFF9800)) ), lineConfig = LineChartConfig(lineWidth = 2f, smoothCurve = true), fillAlpha = 0.7f, onAreaClick = { point -> println("Series ${point.seriesIndex}: ${point.label} = ${point.value}") }, ) ``` -------------------------------- ### Conventional Commit Message Examples Source: https://github.com/hi-manshu/charty/blob/main/CONTRIBUTING.md Examples of commit messages following the Conventional Commits specification, used for categorizing changes like features, fixes, documentation, and chores. ```text feat: add candlestick chart component fix: resolve animation timing issue on iOS docs: update README with new chart examples ``` -------------------------------- ### CircularProgressIndicator - Activity Rings Source: https://context7.com/hi-manshu/charty/llms.txt Displays multiple concentric progress rings. Customize gap, start angle, shadows, animation, and interaction. Use `centerContent` to display custom composables. ```kotlin import com.himanshoe.charty.circular.CircularProgressIndicator import com.himanshoe.charty.circular.config.CircularProgressConfig import com.himanshoe.charty.circular.data.CircularRingData import com.himanshoe.charty.common.config.Animation import androidx.compose.material3.Text import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.foundation.layout.size import androidx.compose.ui.unit.dp CircularProgressIndicator( rings = { listOf( CircularRingData(label = "Move", progress = 450f, maxValue = 600f, color = Color(0xFFFF3B58)), CircularRingData(label = "Exercise", progress = 25f, maxValue = 30f, color = Color(0xFFACFF3D)), CircularRingData(label = "Stand", progress = 10f, maxValue = 12f, color = Color(0xFF34D5FF)), ) }, modifier = Modifier.size(300.dp), config = CircularProgressConfig( gapBetweenRings = 10f, startAngleDegrees = -90f, enableShadows = true, animation = Animation.Enabled(duration = 1200), interactionEnabled = true, rotationEnabled = false, ), onRingClick = { ring, index -> println("Ring $index: ${ring.label} — ${ring.progress}/${ring.maxValue}") }, centerContent = { Text(text = "75%") }, ) ``` -------------------------------- ### SpanChart - Horizontal Span/Range Chart Source: https://context7.com/hi-manshu/charty/llms.txt Displays horizontal bars with explicit start and end values per category. Useful for Gantt-style timelines, temperature ranges, or score ranges. Configure bar width and handle click events. ```kotlin import com.himanshoe.charty.bar.SpanChart import com.himanshoe.charty.bar.config.BarChartConfig import com.himanshoe.charty.bar.data.SpanData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors SpanChart( data = { listOf( SpanData("Task A", startValue = 0f, endValue = 5f), SpanData("Task B", startValue = 3f, endValue = 9f), SpanData("Task C", startValue = 7f, endValue = 14f), SpanData("Task D", startValue = 10f, endValue = 20f), ) }, colors = ChartyColors.CoolPalette, barConfig = BarChartConfig(barWidthFraction = 0.5f), onSpanClick = { span -> println("${span.label}: ${span.startValue}–${span.endValue}") }, ) ``` -------------------------------- ### Gradle Commands for Formatting and Checks Source: https://github.com/hi-manshu/charty/blob/main/CONTRIBUTING.md Run these Gradle tasks to format your Kotlin code and check for code quality issues using Detekt. These should be run before committing. ```bash ./gradlew ktlintFormat ./gradlew detekt ``` -------------------------------- ### Gradle Command for Running Tests Source: https://github.com/hi-manshu/charty/blob/main/CONTRIBUTING.md Use this command to execute all unit tests in the project. Ensure tests are written for new features. ```bash ./gradlew test ``` -------------------------------- ### Running Specific Module or Platform Tests Source: https://github.com/hi-manshu/charty/blob/main/CONTRIBUTING.md These Gradle commands allow you to run tests for a specific module or a particular platform (e.g., Android). ```bash # Run all tests ./gradlew test # Run tests for specific module ./gradlew :charty:test # Run tests for specific platform ./gradlew :charty:testDebugUnitTest # Android ``` -------------------------------- ### Configure Tooltip Appearance Source: https://context7.com/hi-manshu/charty/llms.txt Customize the look and feel of tap-to-reveal tooltips using TooltipConfig. Set background, border, text style, padding, and arrow properties. ```kotlin import com.himanshoe.charty.common.tooltip.TooltipConfig import com.himanshoe.charty.common.tooltip.TooltipPadding import com.himanshoe.charty.common.tooltip.TooltipPosition import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp val tooltip = TooltipConfig( backgroundColor = Color(0xFF2D2D2D), borderColor = Color.White, borderWidth = 1.dp, textStyle = TextStyle(color = Color.White, fontSize = 13.sp), padding = TooltipPadding(horizontal = 12.dp, vertical = 8.dp), showArrow = true, arrowSize = 8.dp, offsetY = 8.dp, minDistanceFromEdge = 16.dp, shape = RoundedCornerShape(8.dp) ) // TooltipPosition.AUTO (default), ABOVE, or BELOW ``` -------------------------------- ### LineChart - Basic Line Chart Source: https://context7.com/hi-manshu/charty/llms.txt Connects data points with straight line segments. Supports reference lines, tooltips, and animated point markers. Customize line width, point visibility, and animation. ```kotlin import com.himanshoe.charty.line.LineChart import com.himanshoe.charty.line.config.LineChartConfig import com.himanshoe.charty.line.data.LineData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors import com.himanshoe.charty.common.config.Animation import com.himanshoe.charty.common.config.ReferenceLineConfig import androidx.compose.ui.graphics.StrokeCap LineChart( data = { listOf( LineData("Mon", 20f), LineData("Tue", 45f), LineData("Wed", 30f), LineData("Thu", 70f), LineData("Fri", 55f), ) }, color = ChartyColor.Solid(ChartyColors.Blue), lineConfig = LineChartConfig( lineWidth = 3f, showPoints = true, pointRadius = 6f, pointAlpha = 1f, strokeCap = StrokeCap.Round, smoothCurve = false, animation = Animation.Default, referenceLine = ReferenceLineConfig(value = 50f, label = "Average"), tooltipFormatter = { d -> "${d.label}: ${d.value.toInt()}" }, ), onPointClick = { data -> println("Point: ${data.label} = ${data.value}") }, ) ``` -------------------------------- ### Comparison Bar Chart Implementation Source: https://context7.com/hi-manshu/charty/llms.txt Renders multiple bars side-by-side for each group, facilitating direct series comparison within a category. ```kotlin import com.himanshoe.charty.bar.ComparisonBarChart import com.himanshoe.charty.bar.config.ComparisonBarChartConfig import com.himanshoe.charty.bar.data.BarGroup import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors import androidx.compose.ui.graphics.Color ComparisonBarChart( data = { listOf( BarGroup("Q1", listOf(45f, 52f, 38f)), BarGroup("Q2", listOf(58f, 63f, 50f)), BarGroup("Q3", listOf(72f, 68f, 65f)), BarGroup("Q4", listOf(90f, 85f, 78f)), ) }, comparisonConfig = ComparisonBarChartConfig( colors = ChartyColor.Gradient( listOf(Color(0xFFE91E63), Color(0xFF2196F3), Color(0xFF4CAF50)) ), ), onBarClick = { segment -> println("Series ${segment.segmentIndex}: ${segment.value}") }, ) ``` -------------------------------- ### Create a Multi-Dataset Radar Chart Source: https://context7.com/hi-manshu/charty/llms.txt Use MultipleRadarChart to overlay datasets. Configure legends, animations, and click callbacks for interactive analysis. ```kotlin import com.himanshoe.charty.radar.MultipleRadarChart import com.himanshoe.charty.radar.config.MultipleRadarChartConfig import com.himanshoe.charty.radar.config.LegendPosition import com.himanshoe.charty.radar.data.RadarDataSet import com.himanshoe.charty.radar.data.RadarAxisData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors MultipleRadarChart( dataSets = { listOf( RadarDataSet( label = "Team Alpha", axes = listOf( RadarAxisData("Attack", 85f, maxValue = 100f), RadarAxisData("Defense", 70f, maxValue = 100f), RadarAxisData("Speed", 90f, maxValue = 100f), RadarAxisData("Magic", 60f, maxValue = 100f), ), color = ChartyColor.Solid(ChartyColors.Blue), fillAlpha = 0.25f, ), RadarDataSet( label = "Team Beta", axes = listOf( RadarAxisData("Attack", 60f, maxValue = 100f), RadarAxisData("Defense", 88f, maxValue = 100f), RadarAxisData("Speed", 55f, maxValue = 100f), RadarAxisData("Magic", 95f, maxValue = 100f), ), color = ChartyColor.Solid(ChartyColors.Pink), fillAlpha = 0.25f, ), ) }, config = MultipleRadarChartConfig( showLegend = true, legendPosition = LegendPosition.BOTTOM, staggerAnimation = true, staggerDelay = 0.2f, ), onDataSetClick = { label, axisIndex -> println("Clicked $label axis $axisIndex") }, ) ``` -------------------------------- ### LollipopBarChart Implementation Source: https://context7.com/hi-manshu/charty/llms.txt LollipopBarChart offers a minimalist alternative to bar charts, using stems topped with circles. Configure stem thickness, circle radius, and animation for a modern look. ```kotlin import com.himanshoe.charty.bar.LollipopBarChart import com.himanshoe.charty.bar.config.LollipopBarChartConfig import com.himanshoe.charty.bar.data.BarData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors import androidx.compose.ui.unit.dp LollipopBarChart( data = { listOf( BarData("A", 80f), BarData("B", 130f), BarData("C", 60f), BarData("D", 170f), ) }, colors = ChartyColor.Solid(ChartyColors.Indigo), config = LollipopBarChartConfig( stemThickness = 3.dp, circleRadius = 8.dp, animation = com.himanshoe.charty.common.config.Animation.Default, ), onBarClick = { bar -> println("${bar.label}: ${bar.value}") }, ) ``` -------------------------------- ### BlockBarChart Implementation Source: https://context7.com/hi-manshu/charty/llms.txt Displays a horizontal bar segmented into blocks with widths proportional to their values. Ideal for showing composition breakdowns like progress bars with multiple categories. Requires data and configuration for appearance. ```kotlin import com.himanshoe.charty.block.BlockBarChart import com.himanshoe.charty.block.config.BlockBarChartConfig import com.himanshoe.charty.block.data.BlockData import com.himanshoe.charty.color.ChartyColor import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp BlockBarChart( data = { listOf( BlockData(value = 1f, color = ChartyColor.Solid(Color(0xFFFF6B81))), BlockData(value = 2f, color = ChartyColor.Solid(Color(0xFFFFE066))), BlockData(value = 5f, color = ChartyColor.Solid(Color(0xFF5BE37D))), BlockData(value = 3f, color = ChartyColor.Solid(Color(0xFF74B9FF))), ) }, modifier = Modifier.fillMaxWidth(), blockBarConfig = BlockBarChartConfig( barHeight = 24.dp, cornerRadius = com.himanshoe.charty.common.config.CornerRadius.Medium, spacing = 2.dp, ), ) ``` -------------------------------- ### ChartyColor Configuration Source: https://context7.com/hi-manshu/charty/llms.txt Configure chart colors using ChartyColor.Solid for a single color or ChartyColor.Gradient for multi-stop gradients. Pre-built palettes like ModernPalette, BusinessPalette, and FinancialGradient are available, or define custom colors. ```kotlin import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors import androidx.compose.ui.graphics.Color // Solid single colour val solidBlue: ChartyColor = ChartyColor.Solid(ChartyColors.Blue) // #2196F3 // Gradient across two stops val twoStopGradient: ChartyColor = ChartyColor.Gradient( listOf(ChartyColors.Blue, ChartyColors.BlueAlpha30) ) // Use a pre-built palette for multi-series charts val modernPalette: ChartyColor = ChartyColors.ModernPalette // Blue→Cyan→Purple→Pink→Orange val businessPalette: ChartyColor = ChartyColors.BusinessPalette val financialGradient: ChartyColor = ChartyColors.FinancialGradient // Red→Orange→Amber→Green // Custom colours val custom: ChartyColor = ChartyColor.Gradient( listOf(Color(0xFFFF6B81), Color(0xFFFFE066), Color(0xFF5BE37D)) ) ``` -------------------------------- ### Mosaic (100% Stacked) Bar Chart Implementation Source: https://context7.com/hi-manshu/charty/llms.txt Normalizes all segment values to fill 100% of each bar's height, ideal for showing proportional composition across categories. ```kotlin import com.himanshoe.charty.bar.MosiacBarChart import com.himanshoe.charty.bar.config.MosiacBarChartConfig import com.himanshoe.charty.bar.data.BarGroup import com.himanshoe.charty.color.ChartyColors MosiacBarChart( data = { listOf( BarGroup("Jan", listOf(10f, 40f, 50f)), BarGroup("Feb", listOf(20f, 30f, 50f)), BarGroup("Mar", listOf(15f, 55f, 30f)), ) }, config = MosiacBarChartConfig( colors = ChartyColors.VibrantPalette, animation = com.himanshoe.charty.common.config.Animation.Default, ), onSegmentClick = { segment -> println("${segment.groupLabel} seg${segment.segmentIndex}: ${segment.value}") }, ) ``` -------------------------------- ### Animation Configuration Source: https://context7.com/hi-manshu/charty/llms.txt Control chart enter animations using the Animation sealed interface. Options include Disabled, Fast (400ms), Default (800ms), Slow (1200ms), or a custom duration. ```kotlin import com.himanshoe.charty.common.config.Animation val noAnim = Animation.Disabled val fast = Animation.Fast // 400 ms val standard = Animation.Default // 800 ms — same as Animation.Enabled() val slow = Animation.Slow // 1200 ms val custom = Animation.Enabled(duration = 1500) // must be > 0 ``` -------------------------------- ### Bug Report Template Source: https://github.com/hi-manshu/charty/blob/main/CONTRIBUTING.md Use this markdown template when reporting bugs to provide detailed information about the issue, including steps to reproduce, expected behavior, and environment details. ```markdown **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Environment:** - Platform: [e.g. Android, iOS, Web, Desktop] - Kotlin Version: [e.g. 2.0.0] - Charty Version: [e.g. 3.0.0] - OS: [e.g. Android 14, iOS 17, macOS 14] **Additional context** Add any other context about the problem here. ``` -------------------------------- ### ChartScaffoldConfig Styling Source: https://context7.com/hi-manshu/charty/llms.txt Configure the shared scaffold layer for all charts, including axes, grid lines, and labels. Customize visibility, colors, thickness, label rotation, and text style. ```kotlin import com.himanshoe.charty.common.config.ChartScaffoldConfig import com.himanshoe.charty.common.axis.LabelRotation import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.sp val scaffoldConfig = ChartScaffoldConfig( showAxis = true, showGrid = true, showLabels = true, axisColor = Color.Black, gridColor = Color.LightGray, axisThickness = 2f, gridThickness = 1f, leftLabelRotation = LabelRotation.Straight, // or LabelRotation.Rotated labelTextStyle = TextStyle(color = Color.DarkGray, fontSize = 11.sp), ) ``` -------------------------------- ### BubbleBarChart Implementation Source: https://context7.com/hi-manshu/charty/llms.txt BubbleBarChart represents bars as columns of stacked bubbles, where bubble count and size are proportional to the value. Customize bar width, bubble radius, spacing, and animation. ```kotlin import com.himanshoe.charty.bar.BubbleBarChart import com.himanshoe.charty.bar.config.BubbleBarChartConfig import com.himanshoe.charty.bar.data.BarData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors import androidx.compose.ui.unit.dp BubbleBarChart( data = { listOf( BarData("Mon", 100f), BarData("Tue", 140f), BarData("Wed", 80f), BarData("Thu", 200f), BarData("Fri", 160f), ) }, color = ChartyColor.Solid(ChartyColors.Purple), bubbleConfig = BubbleBarChartConfig( barWidthFraction = 0.6f, bubbleRadius = 6.dp, bubbleSpacing = 3.dp, animation = com.himanshoe.charty.common.config.Animation.Default, ), onBarClick = { bar -> println("Bar clicked: ${bar.label}") }, ) ``` -------------------------------- ### Add Charty to Project Source: https://context7.com/hi-manshu/charty/llms.txt Add this single Gradle line to pull the Charty library from Maven Central into your KMP or Android Compose project. ```kotlin // build.gradle.kts (commonMain or Android module) dependencies { implementation("com.himanshoe:charty:") } ``` -------------------------------- ### Create a Single-Dataset Radar Chart Source: https://context7.com/hi-manshu/charty/llms.txt Use RadarChart to plot multivariate data on radial axes. Configure grid styles, fill, and data point visibility. ```kotlin import com.himanshoe.charty.radar.RadarChart import com.himanshoe.charty.radar.config.RadarChartConfig import com.himanshoe.charty.radar.config.RadarGridConfig import com.himanshoe.charty.radar.config.RadarGridStyle import com.himanshoe.charty.radar.data.RadarDataSet import com.himanshoe.charty.radar.data.RadarAxisData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors RadarChart( data = { listOf( RadarDataSet( label = "Player Stats", axes = listOf( RadarAxisData("Speed", 80f, maxValue = 100f), RadarAxisData("Power", 90f, maxValue = 100f), RadarAxisData("Defense", 70f, maxValue = 100f), RadarAxisData("Skill", 85f, maxValue = 100f), RadarAxisData("Stamina", 75f, maxValue = 100f), ), color = ChartyColor.Solid(ChartyColors.Blue), fillAlpha = 0.3f, ) ) }, config = RadarChartConfig( gridConfig = RadarGridConfig( gridStyle = RadarGridStyle.POLYGON, numberOfGridLevels = 5, showGridLines = true, showAxisLines = true, ), showDataPoints = true, ), ) ``` -------------------------------- ### WaterfallChart Implementation Source: https://context7.com/hi-manshu/charty/llms.txt Use WaterfallChart to visualize sequential positive and negative values where each bar builds upon the previous one. Configure colors, animation, and corner radius. ```kotlin import com.himanshoe.charty.bar.WaterfallChart import com.himanshoe.charty.bar.config.WaterfallChartConfig import com.himanshoe.charty.bar.data.BarData WaterfallChart( data = { listOf( BarData("Start", value = 1000f), BarData("Sales", value = 500f), BarData("Refunds", value = -150f), BarData("Costs", value = -200f), BarData("End", value = 0f), // auto computed if 0 ) }, config = WaterfallChartConfig( positiveColor = com.himanshoe.charty.color.ChartyColor.Solid(androidx.compose.ui.graphics.Color(0xFF4CAF50)), negativeColor = com.himanshoe.charty.color.ChartyColor.Solid(androidx.compose.ui.graphics.Color(0xFFF44336)), animation = com.himanshoe.charty.common.config.Animation.Default, cornerRadius = com.himanshoe.charty.common.config.CornerRadius.Small, ), onBarClick = { bar -> println("${bar.label}: ${bar.value}") }, ) ``` -------------------------------- ### ComboChart - Combined Bar and Line Chart Source: https://context7.com/hi-manshu/charty/llms.txt Overlays bar and line charts on the same axes. Each data entry includes both a bar value and a line value. Customize bar width, line width, point visibility, and animation. ```kotlin import com.himanshoe.charty.combo.ComboChart import com.himanshoe.charty.combo.config.ComboChartConfig import com.himanshoe.charty.combo.data.ComboChartData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors import androidx.compose.ui.graphics.Color ComboChart( data = { listOf( ComboChartData("Jan", barValue = 100f, lineValue = 80f), ComboChartData("Feb", barValue = 150f, lineValue = 120f), ComboChartData("Mar", barValue = 120f, lineValue = 140f), ComboChartData("Apr", barValue = 180f, lineValue = 160f), ComboChartData("May", barValue = 200f, lineValue = 190f), ) }, barColor = ChartyColor.Solid(Color(0xFF2196F3)), lineColor = ChartyColor.Solid(Color(0xFFF44336)), comboConfig = ComboChartConfig( barWidthFraction = 0.5f, lineWidth = 3f, showPoints = true, animation = com.himanshoe.charty.common.config.Animation.Default, ), onDataClick = { data -> println("${data.label}: bar=${data.barValue} line=${data.lineValue}") }, ) ``` -------------------------------- ### Stacked Bar Chart Implementation Source: https://context7.com/hi-manshu/charty/llms.txt Displays multiple values stacked vertically within a single bar per category using BarGroup. Supports per-segment click callbacks. ```kotlin import com.himanshoe.charty.bar.StackedBarChart import com.himanshoe.charty.bar.config.StackedBarChartConfig import com.himanshoe.charty.bar.data.BarGroup import com.himanshoe.charty.color.ChartyColors import com.himanshoe.charty.common.config.Animation import com.himanshoe.charty.common.config.CornerRadius StackedBarChart( data = { listOf( BarGroup("Q1", listOf(20f, 30f, 15f)), BarGroup("Q2", listOf(25f, 35f, 20f)), BarGroup("Q3", listOf(30f, 25f, 25f)), BarGroup("Q4", listOf(40f, 20f, 30f)), ) }, colors = ChartyColors.DefaultGradient, // Blue, Green, Orange per segment stackedConfig = StackedBarChartConfig( barWidthFraction = 0.7f, cornerRadius = CornerRadius.Medium, animation = Animation.Default, ), onSegmentClick = { segment -> println("Group=${segment.groupLabel}, segIndex=${segment.segmentIndex}, value=${segment.value}") }, ) ``` -------------------------------- ### Horizontal Bar Chart Implementation Source: https://context7.com/hi-manshu/charty/llms.txt Renders bars horizontally, suitable for long category labels. Uses BarData and BarChartConfig. ```kotlin import com.himanshoe.charty.bar.HorizontalBarChart import com.himanshoe.charty.bar.data.BarData import com.himanshoe.charty.bar.config.BarChartConfig import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors import com.himanshoe.charty.common.config.CornerRadius import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp HorizontalBarChart( data = { listOf( BarData("Category A", 120f), BarData("Category B", 80f), BarData("Category C", 200f), BarData("Category D", 55f), ) }, modifier = Modifier.fillMaxWidth().height(250.dp), color = ChartyColor.Solid(ChartyColors.Teal), barConfig = BarChartConfig( barWidthFraction = 0.6f, cornerRadius = CornerRadius.Medium, ), onBarClick = { bar -> println("Tapped: ${bar.label}") }, ) ``` -------------------------------- ### Pull Request Template Source: https://github.com/hi-manshu/charty/blob/main/CONTRIBUTING.md This markdown template should be filled out when submitting a pull request. It helps ensure all necessary information is provided for review, including the type of change, testing performed, and a checklist of requirements. ```markdown ## Description Brief description of what this PR does. ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update ## How Has This Been Tested? Describe the tests you ran and on which platforms. ## Checklist - [ ] My code follows the style guidelines - [ ] I have performed a self-review - [ ] I have commented my code where necessary - [ ] I have updated the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix/feature works - [ ] New and existing tests pass locally ## Screenshots (if applicable) Add screenshots here. ``` -------------------------------- ### PointChart - Scatter Plot Source: https://context7.com/hi-manshu/charty/llms.txt Plots individual data points as circles. Supports click interactions for tooltips and an optional reference line. Customize point radius, alpha, and animation. ```kotlin import com.himanshoe.charty.point.PointChart import com.himanshoe.charty.point.config.PointChartConfig import com.himanshoe.charty.point.data.PointData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors import com.himanshoe.charty.common.config.Animation PointChart( data = { listOf( PointData("A", 45f), PointData("B", 80f), PointData("C", 30f), PointData("D", 95f), PointData("E", 60f), ) }, color = ChartyColor.Solid(ChartyColors.Orange), pointConfig = PointChartConfig( pointRadius = 8f, pointAlpha = 0.9f, animation = Animation.Default, ), onPointClick = { point -> println("${point.label}: ${point.value}") }, ) ``` -------------------------------- ### AreaChart - Area Chart with Gradient Fill Source: https://context7.com/hi-manshu/charty/llms.txt Similar to a line chart but fills the area beneath the line with a color or gradient. Emphasizes magnitude and trends. Customize line width, point visibility, and fill alpha. ```kotlin import com.himanshoe.charty.line.AreaChart import com.himanshoe.charty.line.config.LineChartConfig import com.himanshoe.charty.line.data.LineData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors import androidx.compose.ui.graphics.Color AreaChart( data = { listOf( LineData("Jan", 20f), LineData("Feb", 45f), LineData("Mar", 30f), LineData("Apr", 70f), LineData("May", 85f), ) }, color = ChartyColor.Gradient( listOf(ChartyColors.Blue, ChartyColors.BlueAlpha30) ), lineConfig = LineChartConfig( lineWidth = 2.5f, showPoints = true, smoothCurve = true, ), fillAlpha = 0.3f, onPointClick = { data -> println("Tapped: ${data.label}") }, ) ``` -------------------------------- ### Configure Reference Line Source: https://context7.com/hi-manshu/charty/llms.txt Add a horizontal or vertical reference line to charts using ReferenceLineConfig. Customize its visibility, value, color, stroke style, and label. ```kotlin import com.himanshoe.charty.common.config.ReferenceLineConfig import com.himanshoe.charty.common.config.ReferenceLineStrokeStyle import com.himanshoe.charty.common.config.ReferenceLineLabelPosition import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.sp val targetLine = ReferenceLineConfig( isEnabled = true, value = 100f, // drawn at this Y value color = Color.Red, strokeWidth = 2f, strokeStyle = ReferenceLineStrokeStyle.DASHED, dashIntervals = null, // null → default dash pattern label = "Target", showValueInLabelWhenNoText = true, labelPosition = ReferenceLineLabelPosition.ABOVE, labelOffset = 4f, labelTextStyle = TextStyle(fontSize = 12.sp) ) ``` -------------------------------- ### MultilineChart - Multi-Series Line Chart Source: https://context7.com/hi-manshu/charty/llms.txt Draws multiple data series as separate colored lines on the same axes. Uses `LineGroup` where each group's `values` list holds one value per series. Customize line styles and handle point clicks. ```kotlin import com.himanshoe.charty.line.MultilineChart import com.himanshoe.charty.line.config.LineChartConfig import com.himanshoe.charty.line.data.LineGroup import com.himanshoe.charty.color.ChartyColors MultilineChart( data = { listOf( LineGroup("Mon", listOf(20f, 35f, 15f)), LineGroup("Tue", listOf(45f, 28f, 38f)), LineGroup("Wed", listOf(30f, 52f, 25f)), LineGroup("Thu", listOf(70f, 40f, 55f)), LineGroup("Fri", listOf(60f, 48f, 42f)), ) }, colors = ChartyColors.DefaultMultiline, // Pink, Blue, Green lineConfig = LineChartConfig( lineWidth = 2.5f, showPoints = true, smoothCurve = true, ), onPointClick = { point -> println("Series ${point.seriesIndex} at ${point.label}: ${point.value}") }, ) ``` -------------------------------- ### Create Vertical Bar Chart Source: https://context7.com/hi-manshu/charty/llms.txt Display categorical data with vertical bars using the BarChart composable. Supports positive/negative values, custom colors, animations, tooltips, and reference lines. ```kotlin import com.himanshoe.charty.bar.BarChart import com.himanshoe.charty.bar.config.BarChartConfig import com.himanshoe.charty.bar.config.NegativeValuesDrawMode import com.himanshoe.charty.bar.data.BarData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors import com.himanshoe.charty.common.config.Animation import com.himanshoe.charty.common.config.ChartScaffoldConfig import com.himanshoe.charty.common.config.CornerRadius import com.himanshoe.charty.common.config.ReferenceLineConfig import androidx.compose.ui.Modifier import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.ui.unit.dp BarChart( data = { listOf( BarData(label = "Jan", value = 120f), BarData(label = "Feb", value = -45f), // negative → extends below axis BarData(label = "Mar", value = 200f), BarData(label = "Apr", value = 160f, color = ChartyColor.Solid(ChartyColors.Orange)) ) }, modifier = Modifier.fillMaxWidth().height(300.dp), color = ChartyColor.Gradient(listOf(ChartyColors.Blue, ChartyColors.Cyan)), barConfig = BarChartConfig( barWidthFraction = 0.6f, barSpacing = 0f, cornerRadius = CornerRadius.Large, negativeValuesDrawMode = NegativeValuesDrawMode.BELOW_AXIS, animation = Animation.Default, referenceLine = ReferenceLineConfig(value = 150f, label = "Target"), tooltipFormatter = { bar -> "${bar.label}: ${bar.value.toInt()}" }, ), scaffoldConfig = ChartScaffoldConfig(showGrid = true), onBarClick = { barData -> println("Clicked: ${barData.label} = ${barData.value}") }, ) ``` -------------------------------- ### Kotlin Data Class and Composable Function Source: https://github.com/hi-manshu/charty/blob/main/CONTRIBUTING.md Defines a data structure for chart points and a Composable function to render a line chart. Ensure KDoc comments are used for public APIs. ```kotlin /** * Represents a data point in a line chart. * * @property x The x-coordinate value * @property y The y-coordinate value * @property label Optional label for the data point */ data class PointData( val x: Float, val y: Float, val label: String? = null, ) /** * Draws a line chart with the given data points. * * @param dataPoints List of points to display * @param modifier Modifier to apply to the chart * @param config Configuration for chart appearance */ @Composable fun LineChart( dataPoints: List, modifier: Modifier = Modifier, config: LineChartConfig = LineChartConfig(), ) { // Implementation } ``` -------------------------------- ### WavyChart Implementation Source: https://context7.com/hi-manshu/charty/llms.txt WavyChart animates bars as continuous sine waves for a fluid appearance. Customize bar width, wave amplitude, segments, stroke width, animation duration, and phase offset for cascading effects. ```kotlin import com.himanshoe.charty.bar.WavyChart import com.himanshoe.charty.bar.config.WavyChartConfig import com.himanshoe.charty.bar.data.BarData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors WavyChart( data = { listOf( BarData("Mon", 80f), BarData("Tue", 120f), BarData("Wed", 60f), BarData("Thu", 150f), BarData("Fri", 100f), ) }, color = ChartyColor.Solid(ChartyColors.Cyan), wavyConfig = WavyChartConfig( barWidthFraction = 0.6f, waveAmplitudeFractionOfBarWidth = 0.3f, waveSegments = 20, strokeWidthDp = 3f, animationDurationMillis = 1200, phaseOffsetPerBar = 0.5f, // cascading wave effect ), ) ``` -------------------------------- ### BubbleChart - 3-Variable Scatter Plot Source: https://context7.com/hi-manshu/charty/llms.txt Extends PointChart to include a third data dimension (size) encoded as bubble radius. Each bubble has a label, y-value, and size. Customize bubble radius and color palette. ```kotlin import com.himanshoe.charty.point.BubbleChart import com.himanshoe.charty.point.config.PointChartConfig import com.himanshoe.charty.point.data.BubbleData import com.himanshoe.charty.color.ChartyColor import com.himanshoe.charty.color.ChartyColors BubbleChart( data = { listOf( BubbleData("Product A", yValue = 50f, size = 100f), BubbleData("Product B", yValue = 75f, size = 250f), BubbleData("Product C", yValue = 60f, size = 150f), BubbleData("Product D", yValue = 90f, size = 80f), ) }, color = ChartyColors.ModernPalette, config = PointChartConfig(pointRadius = 40f), minBubbleRadius = 10f, onBubbleClick = { bubble -> println("${bubble.label}: y=${bubble.yValue} size=${bubble.size}") }, ) ``` -------------------------------- ### CornerRadius Configuration Source: https://context7.com/hi-manshu/charty/llms.txt Specify rounded corners for bar chart elements using the CornerRadius sealed class. Predefined constants like None, Small, Medium, Large, and ExtraLarge are available, along with a Custom option. ```kotlin import com.himanshoe.charty.common.config.CornerRadius val none = CornerRadius.None // 0 dp val small = CornerRadius.Small // 4 dp val medium = CornerRadius.Medium // 8 dp (default) val large = CornerRadius.Large // 12 dp val extraLarge = CornerRadius.ExtraLarge // 16 dp val custom = CornerRadius.Custom(radius = 20f) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.