diff --git a/content/2.3.0/breaking-changes.md b/content/2.3.0/breaking-changes.md new file mode 100644 index 0000000..3edfa1e --- /dev/null +++ b/content/2.3.0/breaking-changes.md @@ -0,0 +1,77 @@ +# Breaking Changes + +## charts-core + +### Do I need to update call sites? +- No, if you already call `ChartViewDefaults.style(...)` and keep the default square chart area. +- Yes, if you want a non-square chart area; pass the new `modifierChart` argument. + +### What changed +- `ChartViewDefaults.style(...)` now includes `modifierChart: Modifier` (default `Modifier.aspectRatio(1f)`) and threads it through `ChartViewStyle`. + +### Migration (only if required) +```kotlin +// Before +val chartViewStyle = ChartViewDefaults.style() + +// After +val chartViewStyle = ChartViewDefaults.style( + modifierChart = Modifier.aspectRatio(16f / 9f), +) +``` + +- Recommended: Prefer named arguments when calling style factory functions. + +## charts-bar + +### Do I need to update call sites? +- No, if you call `BarChartDefaults.style(...)` with named arguments only. +- Yes, if you pass `BarChartDefaults.style(...)` arguments positionally after `barColor`, or if you call internal `validateBarData(...)` directly. + +### What changed +- `BarChartDefaults.style(...)` adds `barColors: List = emptyList()` immediately after `barColor`. +- `validateBarData(...)` now accepts `colorsSize` to validate `barColors` length against data points. + +### Migration (only if required) +```kotlin +// Before +val barStyle = BarChartDefaults.style( + MaterialTheme.colorScheme.primary, + 0.4f, + 10.dp, +) + +// After +val barStyle = BarChartDefaults.style( + barColor = MaterialTheme.colorScheme.primary, + barAlpha = 0.4f, + space = 10.dp, +) +``` + +- Recommended: Use named arguments for `BarChartDefaults.style(...)` to stay resilient to future parameter additions. + +## charts-pie + +### Do I need to update call sites? +- No, if you never passed `innerPadding` to `PieChartDefaults.style(...)`. +- Yes, if you previously passed `innerPadding`; move that value into `chartViewStyle`. + +### What changed +- `PieChartDefaults.style(...)` removed `innerPadding`. +- Pie content padding now comes from `chartViewStyle.innerPadding`. + +### Migration (only if required) +```kotlin +// Before +val pieStyle = PieChartDefaults.style( + innerPadding = 24.dp, +) + +// After +val pieStyle = PieChartDefaults.style( + chartViewStyle = ChartViewDefaults.style(innerPadding = 24.dp), +) +``` + +- Recommended: Keep pie container spacing and chart-view spacing aligned through one `ChartViewStyle` instance. diff --git a/content/snapshot/changes/363-api-compatibility-checks.md b/content/2.3.0/changes/363-api-compatibility-checks.md similarity index 100% rename from content/snapshot/changes/363-api-compatibility-checks.md rename to content/2.3.0/changes/363-api-compatibility-checks.md diff --git a/content/snapshot/changes/365-release-compatibility-migration-docs.md b/content/2.3.0/changes/365-release-compatibility-migration-docs.md similarity index 100% rename from content/snapshot/changes/365-release-compatibility-migration-docs.md rename to content/2.3.0/changes/365-release-compatibility-migration-docs.md diff --git a/content/snapshot/changes/394-chart-aspect-ratio-toggle.md b/content/2.3.0/changes/394-chart-aspect-ratio-toggle.md similarity index 100% rename from content/snapshot/changes/394-chart-aspect-ratio-toggle.md rename to content/2.3.0/changes/394-chart-aspect-ratio-toggle.md diff --git a/content/snapshot/changes/395-improve-style-details-view.md b/content/2.3.0/changes/395-improve-style-details-view.md similarity index 100% rename from content/snapshot/changes/395-improve-style-details-view.md rename to content/2.3.0/changes/395-improve-style-details-view.md diff --git a/content/snapshot/changes/406-bar-chart-per-bar-colors.md b/content/2.3.0/changes/406-bar-chart-per-bar-colors.md similarity index 100% rename from content/snapshot/changes/406-bar-chart-per-bar-colors.md rename to content/2.3.0/changes/406-bar-chart-per-bar-colors.md diff --git a/content/snapshot/changes/411-line-chart-drag-point-default-color.md b/content/2.3.0/changes/411-line-chart-drag-point-default-color.md similarity index 100% rename from content/snapshot/changes/411-line-chart-drag-point-default-color.md rename to content/2.3.0/changes/411-line-chart-drag-point-default-color.md diff --git a/content/snapshot/changes/413-add-histogram-chart.md b/content/2.3.0/changes/413-add-histogram-chart.md similarity index 100% rename from content/snapshot/changes/413-add-histogram-chart.md rename to content/2.3.0/changes/413-add-histogram-chart.md diff --git a/content/2.3.0/wiki/assets/bar_default.gif b/content/2.3.0/wiki/assets/bar_default.gif new file mode 100644 index 0000000..2d49b97 Binary files /dev/null and b/content/2.3.0/wiki/assets/bar_default.gif differ diff --git a/content/2.3.0/wiki/assets/demo.png b/content/2.3.0/wiki/assets/demo.png new file mode 100644 index 0000000..8b2e279 Binary files /dev/null and b/content/2.3.0/wiki/assets/demo.png differ diff --git a/content/2.3.0/wiki/assets/histogram_default.gif b/content/2.3.0/wiki/assets/histogram_default.gif new file mode 100644 index 0000000..47e9ad6 Binary files /dev/null and b/content/2.3.0/wiki/assets/histogram_default.gif differ diff --git a/content/2.3.0/wiki/assets/line_default.gif b/content/2.3.0/wiki/assets/line_default.gif new file mode 100644 index 0000000..30037d3 Binary files /dev/null and b/content/2.3.0/wiki/assets/line_default.gif differ diff --git a/content/2.3.0/wiki/assets/logo.png b/content/2.3.0/wiki/assets/logo.png new file mode 100644 index 0000000..8525301 Binary files /dev/null and b/content/2.3.0/wiki/assets/logo.png differ diff --git a/content/2.3.0/wiki/assets/multi_line_default.gif b/content/2.3.0/wiki/assets/multi_line_default.gif new file mode 100644 index 0000000..9a6b7e4 Binary files /dev/null and b/content/2.3.0/wiki/assets/multi_line_default.gif differ diff --git a/content/2.3.0/wiki/assets/pie_default.gif b/content/2.3.0/wiki/assets/pie_default.gif new file mode 100644 index 0000000..9502729 Binary files /dev/null and b/content/2.3.0/wiki/assets/pie_default.gif differ diff --git a/content/2.3.0/wiki/assets/radar_default.gif b/content/2.3.0/wiki/assets/radar_default.gif new file mode 100644 index 0000000..3f2ccf0 Binary files /dev/null and b/content/2.3.0/wiki/assets/radar_default.gif differ diff --git a/content/2.3.0/wiki/assets/stacked_area_default.gif b/content/2.3.0/wiki/assets/stacked_area_default.gif new file mode 100644 index 0000000..58d12ba Binary files /dev/null and b/content/2.3.0/wiki/assets/stacked_area_default.gif differ diff --git a/content/2.3.0/wiki/assets/stacked_bar_default.gif b/content/2.3.0/wiki/assets/stacked_bar_default.gif new file mode 100644 index 0000000..377e0f8 Binary files /dev/null and b/content/2.3.0/wiki/assets/stacked_bar_default.gif differ diff --git a/content/2.3.0/wiki/examples.md b/content/2.3.0/wiki/examples.md new file mode 100644 index 0000000..cbb8c9d --- /dev/null +++ b/content/2.3.0/wiki/examples.md @@ -0,0 +1,210 @@ +# Code Examples + +### Pie + +
+ Pie Demo +
+ +```kotlin +@Composable +private fun ShowPie() { + val dataSet = listOf(32f, 21f, 24f, 14f, 9f).toChartDataSet( + title = "Household Energy", + postfix = "%", + labels = listOf("Heating", "Cooling", "Appliances", "Water Heating", "Lighting") + ) + + PieChart(dataSet) +} +``` + +### Line + +
+ Line Demo +
+ +```kotlin +@Composable +private fun ShowLine() { + val dataSet = listOf(42f, 38f, 45f, 51f, 47f, 54f, 49f).toChartDataSet( + title = "Daily Support Tickets", + labels = listOf("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") + ) + + LineChart(dataSet) +} +``` + +### MultiLine + +
+ MultiLine Demo +
+ +```kotlin +@Composable +private fun ShowMultiLine() { + val items = listOf( + "Web Store" to listOf(420f, 510f, 480f, 530f, 560f, 590f), + "Mobile App" to listOf(360f, 420f, 410f, 460f, 500f, 540f), + "Partner Sales" to listOf(280f, 320f, 340f, 360f, 390f, 420f) + ) + + val dataSet = items.toMultiChartDataSet( + title = "Weekly Revenue by Channel", + prefix = "$", + categories = listOf("Week 1", "Week 2", "Week 3", "Week 4", "Week 5", "Week 6") + ) + + LineChart(dataSet) +} +``` + +### Bar + +
+ Bar Demo +
+ +```kotlin +@Composable +private fun ShowBar() { + val dataSet = listOf(45f, -12f, 38f, 27f, -19f, 42f, 31f).toChartDataSet( + title = "Daily Net Cash Flow", + labels = listOf("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") + ) + + BarChart(dataSet) +} +``` + +### Stacked Bar + +
+ Stacked Bar Demo +
+ +```kotlin +@Composable +private fun ShowStackedBar() { + val items = listOf( + "North America" to listOf(320f, 340f, 360f, 390f), + "Europe" to listOf(210f, 230f, 245f, 260f), + "Asia Pacific" to listOf(180f, 205f, 225f, 250f) + ) + + val dataSet = items.toMultiChartDataSet( + title = "Quarterly Revenue by Region", + prefix = "$", + categories = listOf("Q1", "Q2", "Q3", "Q4") + ) + + StackedBarChart(dataSet) +} +``` + +### Histogram + +
+ Histogram Demo +
+ +```kotlin +@Composable +private fun ShowHistogram() { + val dataSet = listOf(3f, 6f, 11f, 16f, 14f, 9f, 5f).toChartDataSet( + title = "Request Duration Distribution", + labels = listOf("0-50ms", "50-100ms", "100-150ms", "150-200ms", "200-250ms", "250-300ms", "300ms+") + ) + + HistogramChart(dataSet) +} +``` + +### Stacked Area + +
+ Stacked Area Demo +
+ +```kotlin +@Composable +private fun ShowStackedArea() { + val items = listOf( + "Free Plan" to listOf(620f, 650f, 690f, 720f, 760f, 800f), + "Standard Plan" to listOf(240f, 260f, 285f, 310f, 340f, 365f), + "Premium Plan" to listOf(90f, 95f, 105f, 118f, 130f, 142f) + ) + + val dataSet = items.toMultiChartDataSet( + title = "Monthly Active Subscribers by Plan", + categories = listOf("Jan", "Feb", "Mar", "Apr", "May", "Jun") + ) + + StackedAreaChart(dataSet) +} +``` + +### Radar + +
+ Radar Demo +
+ +```kotlin +@Composable +private fun ShowRadar() { + val categories = listOf( + "Performance", + "Reliability", + "Usability", + "Security", + "Scalability", + "Observability" + ) + + val dataSet = listOf(84f, 79f, 76f, 88f, 82f, 74f).toChartDataSet( + title = "Platform Readiness Score", + labels = categories + ) + + RadarChart(dataSet) +} +``` + + +## Style Customization + +To customize chart appearance, start from each chart's `*ChartDefaults.style(...)` factory and override only the fields you need. + +```kotlin +@Composable +private fun ShowStyledBar() { + val dataSet = listOf(45f, -12f, 38f, 27f, -19f, 42f, 31f).toChartDataSet( + title = "Daily Net Cash Flow", + prefix = "$", + labels = listOf("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") + ) + + val style = BarChartDefaults.style( + barColor = Color(0xFF0F766E), + barAlpha = 0.78f, + space = 14.dp, + gridVisible = true, + gridSteps = 5, + gridColor = Color(0xFF94A3B8), + selectionLineColor = Color(0xFFEA580C), + yAxisLabelCount = 6, + chartViewStyle = ChartViewDefaults.style( + width = 340.dp, + cornerRadius = 18.dp, + shadow = 2.dp, + backgroundColor = Color(0xFFF8FAFC), + ), + ) + + BarChart(dataSet = dataSet, style = style) +} +``` diff --git a/content/2.3.0/wiki/getting-started.md b/content/2.3.0/wiki/getting-started.md new file mode 100644 index 0000000..a11971b --- /dev/null +++ b/content/2.3.0/wiki/getting-started.md @@ -0,0 +1,74 @@ +--- +title: Setup +--- + +# Manual Setup + +This guide will help you integrate the Charts library into your Kotlin Multiplatform project. + +## Installation + +Replace `` with the latest release: [![Release](https://img.shields.io/maven-central/v/io.github.dautovicharis/charts.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/io.github.dautovicharis/charts/overview) + +### Repository +```kotlin +dependencyResolutionManagement { + repositories { + mavenCentral() + } +} +``` + +### Umbrella Dependency +```kotlin +commonMain.dependencies { + implementation("io.github.dautovicharis:charts:") +} +``` + +### Modular Dependencies (Pick What You Need) +```kotlin +commonMain.dependencies { + implementation("io.github.dautovicharis:charts-line:") + implementation("io.github.dautovicharis:charts-pie:") + implementation("io.github.dautovicharis:charts-bar:") + implementation("io.github.dautovicharis:charts-histogram:") + implementation("io.github.dautovicharis:charts-stacked-bar:") + implementation("io.github.dautovicharis:charts-stacked-area:") + implementation("io.github.dautovicharis:charts-radar:") + // Optional: add charts-core directly only if you need shared base APIs + implementation("io.github.dautovicharis:charts-core:") +} +``` + +### BOM (Optional Version Alignment) +Use BOM where Gradle platforms are supported (for example JVM/Android module dependencies). +For KMP `commonMain`, keep explicit versions as shown above. + +```kotlin +dependencies { + implementation(platform("io.github.dautovicharis:charts-bom:")) + implementation("io.github.dautovicharis:charts-line") + implementation("io.github.dautovicharis:charts-pie") + implementation("io.github.dautovicharis:charts-bar") + implementation("io.github.dautovicharis:charts-histogram") + implementation("io.github.dautovicharis:charts-stacked-bar") + implementation("io.github.dautovicharis:charts-stacked-area") + implementation("io.github.dautovicharis:charts-radar") +} +``` + +### Snapshot Builds [![Snapshots](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Fio%2Fgithub%2Fdautovicharis%2Fcharts%2Fmaven-metadata.xml&label=Snapshots&color=4285F4)](https://central.sonatype.com/repository/maven-snapshots/io/github/dautovicharis/charts/maven-metadata.xml) +Access the latest pre-release builds through the Sonatype snapshots repository. Snapshots contain the most recent features and fixes that haven't been officially released yet, allowing you to test upcoming functionality. +```kotlin +commonMain.dependencies { + implementation("io.github.dautovicharis:charts:") +} + +dependencyResolutionManagement { + repositories { + // Sonatype Central Portal Snapshots (replaces old s01.oss.sonatype.org) + maven("https://central.sonatype.com/repository/maven-snapshots/") + } +} +``` diff --git a/content/2.3.0/wiki/index.md b/content/2.3.0/wiki/index.md new file mode 100644 index 0000000..555ad8f --- /dev/null +++ b/content/2.3.0/wiki/index.md @@ -0,0 +1,20 @@ +
+ Charts Library Logo +
+ +# Charts {{versionLabel}} + + +
+ Charts Demo +
+ + +## What's New in {{versionLabel}} + + +## Breaking Changes / Migration + +Breaking changes and call-site migration details now live on a dedicated page: + +- [Migration Guide](/{{version}}/wiki/migration) diff --git a/content/2.3.0/wiki/migration.md b/content/2.3.0/wiki/migration.md new file mode 100644 index 0000000..736337e --- /dev/null +++ b/content/2.3.0/wiki/migration.md @@ -0,0 +1,3 @@ +# Migration Guide + +This page summarizes snapshot breaking changes and how to migrate call sites safely. Use the module sections below to jump directly to impacted APIs. diff --git a/content/snapshot/breaking-changes.md b/content/snapshot/breaking-changes.md index 3edfa1e..126c4bf 100644 --- a/content/snapshot/breaking-changes.md +++ b/content/snapshot/breaking-changes.md @@ -1,77 +1,3 @@ # Breaking Changes -## charts-core - -### Do I need to update call sites? -- No, if you already call `ChartViewDefaults.style(...)` and keep the default square chart area. -- Yes, if you want a non-square chart area; pass the new `modifierChart` argument. - -### What changed -- `ChartViewDefaults.style(...)` now includes `modifierChart: Modifier` (default `Modifier.aspectRatio(1f)`) and threads it through `ChartViewStyle`. - -### Migration (only if required) -```kotlin -// Before -val chartViewStyle = ChartViewDefaults.style() - -// After -val chartViewStyle = ChartViewDefaults.style( - modifierChart = Modifier.aspectRatio(16f / 9f), -) -``` - -- Recommended: Prefer named arguments when calling style factory functions. - -## charts-bar - -### Do I need to update call sites? -- No, if you call `BarChartDefaults.style(...)` with named arguments only. -- Yes, if you pass `BarChartDefaults.style(...)` arguments positionally after `barColor`, or if you call internal `validateBarData(...)` directly. - -### What changed -- `BarChartDefaults.style(...)` adds `barColors: List = emptyList()` immediately after `barColor`. -- `validateBarData(...)` now accepts `colorsSize` to validate `barColors` length against data points. - -### Migration (only if required) -```kotlin -// Before -val barStyle = BarChartDefaults.style( - MaterialTheme.colorScheme.primary, - 0.4f, - 10.dp, -) - -// After -val barStyle = BarChartDefaults.style( - barColor = MaterialTheme.colorScheme.primary, - barAlpha = 0.4f, - space = 10.dp, -) -``` - -- Recommended: Use named arguments for `BarChartDefaults.style(...)` to stay resilient to future parameter additions. - -## charts-pie - -### Do I need to update call sites? -- No, if you never passed `innerPadding` to `PieChartDefaults.style(...)`. -- Yes, if you previously passed `innerPadding`; move that value into `chartViewStyle`. - -### What changed -- `PieChartDefaults.style(...)` removed `innerPadding`. -- Pie content padding now comes from `chartViewStyle.innerPadding`. - -### Migration (only if required) -```kotlin -// Before -val pieStyle = PieChartDefaults.style( - innerPadding = 24.dp, -) - -// After -val pieStyle = PieChartDefaults.style( - chartViewStyle = ChartViewDefaults.style(innerPadding = 24.dp), -) -``` - -- Recommended: Keep pie container spacing and chart-view spacing aligned through one `ChartViewStyle` instance. +No call-site updates required. diff --git a/registry/versions.json b/registry/versions.json index c832468..6ed6327 100644 --- a/registry/versions.json +++ b/registry/versions.json @@ -8,6 +8,14 @@ "demoBase": "/demo/snapshot/", "notes": "Latest development snapshot" }, + { + "id": "2.3.0", + "label": "2.3.0", + "wikiRoot": "/content/2.3.0/wiki", + "apiBase": "/static/api/2.3.0", + "demoBase": "/demo/2.3.0/", + "notes": "Release 2.3.0" + }, { "id": "2.2.0", "label": "2.2.0",