Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.0-SNAPSHOT #132

Merged
merged 2 commits into from
Jun 24, 2024
Merged
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
6 changes: 1 addition & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.targets.js.internal.filterClassName
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig

plugins {
Expand Down Expand Up @@ -139,7 +139,3 @@ buildConfig {
buildConfigField("DEMO_VERSION_CODE", Config.demoVersionCode)
useKotlinOutput()
}

kover {
filterClassName("androidx.compose.ui.tooling.preview.Preview")
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ sonar {
"${project.rootDir}/charts/build/reports/kover/report.xml," +
"${project.rootDir}/app/build/reports/kover/report.xml"
)
property("sonar.coverage.exclusions", "**/preview/**")
}
}

Expand Down
15 changes: 12 additions & 3 deletions charts/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.dokka.versioning.VersioningConfiguration
import org.jetbrains.dokka.versioning.VersioningPlugin
import org.jetbrains.kotlin.gradle.targets.js.internal.filterClassName

plugins {
alias(libs.plugins.kotlinMultiplatform)
Expand Down Expand Up @@ -171,5 +170,15 @@ dependencies {
}

kover {
filterClassName("androidx.compose.ui.tooling.preview.Preview")
}
reports {
filters {
excludes {
packages("io.github.dautovicharis.charts.preview")
annotatedBy(
"androidx.compose.ui.tooling.preview.Preview"
)
androidGeneratedClasses()
}
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package io.github.dautovicharis.charts.preview

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import io.github.dautovicharis.charts.BarChartView
import io.github.dautovicharis.charts.internal.common.theme.ChartsDefaultTheme
import io.github.dautovicharis.charts.preview.mock.Mock
import io.github.dautovicharis.charts.style.BarChartDefaults

@Composable
private fun BarChartPreview() {
BarChartView(
dataSet = Mock.barChart(),
style = BarChartDefaults.style()
)
}

@Preview
@Composable
private fun BarChartDefault() {
ChartsDefaultTheme(darkTheme = false) {
BarChartPreview()
}
}

@Preview
@Composable
private fun BarChartDark() {
ChartsDefaultTheme(darkTheme = true) {
BarChartPreview()
}
}

@Preview
@Composable
private fun BarChartDynamic() {
ChartsDefaultTheme(dynamicColor = true) {
BarChartPreview()
}
}

@Preview
@Composable
private fun BarChartError() {
ChartsDefaultTheme {
BarChartView(
dataSet = Mock.barChart(1),
style = BarChartDefaults.style()
)
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package io.github.dautovicharis.charts
package io.github.dautovicharis.charts.preview
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import io.github.dautovicharis.charts.StackedBarChartView
import io.github.dautovicharis.charts.internal.common.theme.ChartsDefaultTheme
import io.github.dautovicharis.charts.mock.Mock
import io.github.dautovicharis.charts.preview.mock.Mock
import io.github.dautovicharis.charts.style.StackedBarChartDefaults

@Composable
private fun StackedBarChartViewPreview() {
private fun StackedBarChartPreview() {
StackedBarChartView(
dataSet = Mock.stackedBarChart(),
style = StackedBarChartDefaults.style()
Expand All @@ -17,39 +18,41 @@ private fun StackedBarChartViewPreview() {

@Preview
@Composable
private fun StackedBarChartViewDefault() {
private fun StackedBarChartDefault() {
ChartsDefaultTheme(darkTheme = false, dynamicColor = false) {
StackedBarChartViewPreview()
StackedBarChartPreview()
}
}

@Preview
@Composable
private fun StackedBarChartViewDark() {
private fun StackedBarChartDark() {
ChartsDefaultTheme(darkTheme = true, dynamicColor = false) {
StackedBarChartViewPreview()
StackedBarChartPreview()
}
}

@Preview(apiLevel = 33)
@Composable
private fun StackedBarChartViewDynamic() {
private fun StackedBarChartDynamic() {
ChartsDefaultTheme(darkTheme = false, dynamicColor = true) {
StackedBarChartViewPreview()
StackedBarChartPreview()
}
}

@Preview
@Composable
private fun StackedBarChartViewInvalidData() {
private fun StackedBarChartError() {
val barColor = MaterialTheme.colorScheme.primary
val style = StackedBarChartDefaults.style(
barColors = listOf(barColor),
space = 8.dp
)

StackedBarChartView(
dataSet = Mock.stackedBarChartInvalid(),
style = style
)
ChartsDefaultTheme {
StackedBarChartView(
dataSet = Mock.stackedBarChartInvalid(),
style = style
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package io.github.dautovicharis.charts.preview

import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import io.github.dautovicharis.charts.LineChartView
import io.github.dautovicharis.charts.internal.common.theme.ChartsDefaultTheme
import io.github.dautovicharis.charts.preview.mock.Mock
import io.github.dautovicharis.charts.style.ChartViewDefaults
import io.github.dautovicharis.charts.style.LineChartDefaults

@Composable
private fun LineChartViewPreview() {
val colors = listOf(
MaterialTheme.colorScheme.primary

)

val style = LineChartDefaults.style(
bezier = true,
lineColors = colors,
dragPointSize = 5f,
pointVisible = true,
chartViewStyle = ChartViewDefaults.style(width = 300.dp)
)

LineChartView(
dataSet = Mock.lineChartSimple(),
style = style
)
}

@Preview
@Composable
private fun LineChartDefault() {
ChartsDefaultTheme(darkTheme = false, dynamicColor = false) {
LineChartViewPreview()
}
}

@Preview
@Composable
private fun LineChartDark() {
ChartsDefaultTheme(darkTheme = true, dynamicColor = false) {
LineChartViewPreview()
}
}

@Preview
@Composable
private fun LineChartDynamic() {
ChartsDefaultTheme(dynamicColor = true) {
LineChartViewPreview()
}
}

@Preview
@Composable
private fun LineChartError() {
ChartsDefaultTheme {
LineChartView(
dataSet = Mock.lineChartSimple(1),
style = LineChartDefaults.style()
)
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package io.github.dautovicharis.charts
package io.github.dautovicharis.charts.preview

import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import io.github.dautovicharis.charts.LineChartView
import io.github.dautovicharis.charts.internal.common.theme.ChartsDefaultTheme
import io.github.dautovicharis.charts.mock.Mock
import io.github.dautovicharis.charts.preview.mock.Mock
import io.github.dautovicharis.charts.style.ChartViewDefaults
import io.github.dautovicharis.charts.style.LineChartDefaults


@Composable
private fun LineChartViewPreview() {
private fun MultiLineChartPreview() {
val colors = listOf(
MaterialTheme.colorScheme.primary,
MaterialTheme.colorScheme.secondary,
Expand All @@ -35,31 +36,31 @@ private fun LineChartViewPreview() {

@Preview
@Composable
private fun LineChartViewDefault() {
private fun MultiLineChartDefault() {
ChartsDefaultTheme(darkTheme = false, dynamicColor = false) {
LineChartViewPreview()
MultiLineChartPreview()
}
}

@Preview
@Composable
private fun LineChartViewDark() {
private fun MultiLineChartDark() {
ChartsDefaultTheme(darkTheme = true, dynamicColor = false) {
LineChartViewPreview()
MultiLineChartPreview()
}
}

@Preview(apiLevel = 33)
@Composable
private fun LineChartViewDynamic() {
private fun MultiLineChartDynamic() {
ChartsDefaultTheme(darkTheme = false, dynamicColor = true) {
LineChartViewPreview()
MultiLineChartPreview()
}
}

@Preview
@Composable
private fun LineChartViewInvalidData() {
private fun MultiLineChartError() {
val colors = listOf(
MaterialTheme.colorScheme.primary,
MaterialTheme.colorScheme.secondary,
Expand All @@ -74,8 +75,10 @@ private fun LineChartViewInvalidData() {
chartViewStyle = ChartViewDefaults.style(width = 300.dp)
)

LineChartView(
dataSet = Mock.lineChartInvalid(),
style = style
)
ChartsDefaultTheme {
LineChartView(
dataSet = Mock.lineChartInvalid(),
style = style
)
}
}
Loading
Loading