Skip to content

Commit

Permalink
Rename Chart and PieChart composable functions to `CartesianChart…
Browse files Browse the repository at this point in the history
…Host` and `PieChartHost`, respectively
  • Loading branch information
patrickmichalik committed Jul 23, 2023
1 parent d1bdddc commit 2260098
Show file tree
Hide file tree
Showing 22 changed files with 78 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.patrykandpatrick.vico.compose.axis.axisLabelComponent
import com.patrykandpatrick.vico.compose.axis.horizontal.bottomAxis
import com.patrykandpatrick.vico.compose.axis.vertical.endAxis
import com.patrykandpatrick.vico.compose.axis.vertical.startAxis
import com.patrykandpatrick.vico.compose.chart.Chart
import com.patrykandpatrick.vico.compose.chart.CartesianChartHost
import com.patrykandpatrick.vico.compose.chart.column.columnChart
import com.patrykandpatrick.vico.compose.component.lineComponent
import com.patrykandpatrick.vico.compose.component.shapeComponent
Expand Down Expand Up @@ -88,7 +88,7 @@ public fun HorizontalAxisTextInside() {
verticalMargin = 4.dp,
horizontalMargin = 4.dp,
)
Chart(
CartesianChartHost(
chart = columnChart(),
model = model,
startAxis = startAxis(
Expand Down Expand Up @@ -118,7 +118,7 @@ public fun HorizontalAxisTextInsideAndBottomAxis() {
verticalMargin = 4.dp,
horizontalMargin = 4.dp,
)
Chart(
CartesianChartHost(
chart = columnChart(),
model = model,
startAxis = startAxis(
Expand All @@ -139,7 +139,7 @@ public fun HorizontalAxisTextInsideAndBottomAxis() {
@Preview(showBackground = true, widthDp = 250)
public fun HorizontalAxisTextOutside() {
ProvidePreviewChartStyle {
Chart(
CartesianChartHost(
chart = columnChart(),
model = model,
startAxis = startAxis(
Expand All @@ -157,7 +157,7 @@ public fun HorizontalAxisTextOutside() {
@Preview(showBackground = true, widthDp = 250)
public fun HorizontalAxisGuidelineDoesNotOverlayBottomAxisLine() {
ProvidePreviewChartStyle {
Chart(
CartesianChartHost(
chart = columnChart(),
model = model,
startAxis = startAxis(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.patrykandpatrick.vico.compose.axis.horizontal.bottomAxis
import com.patrykandpatrick.vico.compose.axis.vertical.startAxis
import com.patrykandpatrick.vico.compose.chart.Chart
import com.patrykandpatrick.vico.compose.chart.CartesianChartHost
import com.patrykandpatrick.vico.compose.chart.column.columnChart
import com.patrykandpatrick.vico.core.chart.values.AxisValuesOverrider
import com.patrykandpatrick.vico.core.component.text.textComponent
Expand All @@ -38,7 +38,7 @@ private val model = entryModelOf(2f, -1f, 4f, -2f, 1f, 5f, -3f)
public fun SingleColumnChartWithNegativeValues() {
val marker = rememberMarker()
Surface {
Chart(
CartesianChartHost(
modifier = Modifier.height(250.dp),
chart = columnChart(
persistentMarkers = mapOf(
Expand All @@ -57,7 +57,7 @@ public fun SingleColumnChartWithNegativeValues() {
@Composable
public fun SingleColumnChartWithNegativeValuesAndDataLabels() {
Surface {
Chart(
CartesianChartHost(
chart = columnChart(
dataLabel = textComponent(),
),
Expand All @@ -72,7 +72,7 @@ public fun SingleColumnChartWithNegativeValuesAndDataLabels() {
@Composable
public fun SingleColumnChartWithNegativeValuesAndAxisValuesOverridden() {
Surface {
Chart(
CartesianChartHost(
chart = columnChart(
axisValuesOverrider = AxisValuesOverrider.fixed(
minY = 1f,
Expand All @@ -90,7 +90,7 @@ public fun SingleColumnChartWithNegativeValuesAndAxisValuesOverridden() {
@Composable
public fun SingleColumnChartWithNegativeValuesAndAxisValuesOverridden2() {
Surface {
Chart(
CartesianChartHost(
chart = columnChart(
axisValuesOverrider = AxisValuesOverrider.fixed(
minY = -2f,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import androidx.compose.ui.unit.dp
import com.patrykandpatrick.vico.compose.axis.horizontal.bottomAxis
import com.patrykandpatrick.vico.compose.axis.vertical.endAxis
import com.patrykandpatrick.vico.compose.axis.vertical.startAxis
import com.patrykandpatrick.vico.compose.chart.Chart
import com.patrykandpatrick.vico.compose.chart.CartesianChartHost
import com.patrykandpatrick.vico.compose.chart.column.columnChart
import com.patrykandpatrick.vico.compose.chart.line.lineChart
import com.patrykandpatrick.vico.compose.chart.line.lineSpec
Expand Down Expand Up @@ -103,7 +103,7 @@ public fun ChartWithIndependentAxes(modifier: Modifier = Modifier) {

composedChart.setPersistentMarkers(markerMap)

Chart(
CartesianChartHost(
chart = composedChart,
model = model1 + model2,
startAxis = startAxis,
Expand All @@ -120,7 +120,7 @@ public fun ChartWithDependentAxes(modifier: Modifier = Modifier) {

composedChart.setPersistentMarkers(markerMap)

Chart(
CartesianChartHost(
chart = composedChart,
model = model1 + model2,
startAxis = startAxis,
Expand All @@ -133,7 +133,7 @@ public fun ChartWithDependentAxes(modifier: Modifier = Modifier) {
@Composable
@Preview("Column chart", widthDp = 350)
public fun ColumnChart(modifier: Modifier = Modifier) {
Chart(
CartesianChartHost(
chart = getColumnChart(markerMap = markerMap),
model = model1,
startAxis = startAxis,
Expand All @@ -145,7 +145,7 @@ public fun ColumnChart(modifier: Modifier = Modifier) {
@Composable
@Preview("Line chart", widthDp = 350)
public fun LineChart(modifier: Modifier = Modifier) {
Chart(
CartesianChartHost(
chart = getLineChart(markerMap = markerMap),
model = model2,
startAxis = startAxis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.patrykandpatrick.vico.compose.axis.vertical.startAxis
import com.patrykandpatrick.vico.compose.chart.Chart
import com.patrykandpatrick.vico.compose.chart.CartesianChartHost
import com.patrykandpatrick.vico.compose.chart.line.lineChart
import com.patrykandpatrick.vico.compose.chart.line.lineSpec
import com.patrykandpatrick.vico.compose.component.shape.shader.verticalGradient
Expand All @@ -49,7 +49,7 @@ public fun LineChartDark() {
val yellow = Color(0xFFFFAA4A)
val pink = Color(0xFFFF4AAA)

Chart(
CartesianChartHost(
modifier = Modifier.padding(8.dp),
chart = lineChart(
lines = listOf(
Expand All @@ -76,7 +76,7 @@ public fun LineChartDark() {
@Preview("Line Chart", widthDp = 200)
@Composable
public fun RegularLineChart() {
Chart(
CartesianChartHost(
chart = lineChart(),
model = model1,
startAxis = startAxis(),
Expand All @@ -86,7 +86,7 @@ public fun RegularLineChart() {
@Preview("Line Chart Expanded", widthDp = 200)
@Composable
public fun RegularLineChartExpanded() {
Chart(
CartesianChartHost(
chart = lineChart(
axisValuesOverrider = AxisValuesOverrider.fixed(
minY = -1f,
Expand All @@ -101,7 +101,7 @@ public fun RegularLineChartExpanded() {
@Preview("Line Chart Collapsed", widthDp = 200)
@Composable
public fun RegularLineChartCollapsed() {
Chart(
CartesianChartHost(
chart = lineChart(
axisValuesOverrider = AxisValuesOverrider.fixed(
minY = 1f,
Expand All @@ -116,7 +116,7 @@ public fun RegularLineChartCollapsed() {
@Preview("Composed Chart", widthDp = 200)
@Composable
public fun ComposedLineChart() {
Chart(
CartesianChartHost(
chart = lineChart() + lineChart(
lines = listOf(
lineSpec(
Expand All @@ -138,7 +138,7 @@ public fun ComposedLineChart() {
@Preview("Composed Chart Collapsed", widthDp = 200)
@Composable
public fun ComposedLineChartCollapsed() {
Chart(
CartesianChartHost(
chart = lineChart(
axisValuesOverrider = AxisValuesOverrider.fixed(
minY = 1f,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.patrykandpatrick.vico.compose.chart.Chart
import com.patrykandpatrick.vico.compose.chart.CartesianChartHost
import com.patrykandpatrick.vico.compose.chart.column.columnChart
import com.patrykandpatrick.vico.compose.chart.line.lineChart
import com.patrykandpatrick.vico.compose.chart.line.lineSpec
Expand Down Expand Up @@ -64,7 +64,7 @@ public fun ColumnChartCard(): Unit = VicoTheme {
val colors = MaterialTheme.colors

SampleCard {
Chart(
CartesianChartHost(
modifier = chartModifier,
chart = columnChart(
columns = listOf(
Expand Down Expand Up @@ -109,7 +109,7 @@ public fun LineChartCard(): Unit = VicoTheme {
val colors = MaterialTheme.colors

SampleCard {
Chart(
CartesianChartHost(
modifier = Modifier.height(100.dp),
chart = lineChart(
lines = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.patrykandpatrick.vico.compose.axis.horizontal.bottomAxis
import com.patrykandpatrick.vico.compose.axis.vertical.startAxis
import com.patrykandpatrick.vico.compose.chart.Chart
import com.patrykandpatrick.vico.compose.chart.CartesianChartHost
import com.patrykandpatrick.vico.compose.chart.column.columnChart
import com.patrykandpatrick.vico.compose.component.lineComponent
import com.patrykandpatrick.vico.core.chart.column.ColumnChart.MergeMode.Stack
Expand Down Expand Up @@ -55,7 +55,7 @@ private val columns: List<LineComponent>
public fun StackedColumnChartWithNegativeValues() {
val marker = rememberMarker()
Surface {
Chart(
CartesianChartHost(
modifier = Modifier.height(250.dp),
chart = columnChart(
columns = columns,
Expand All @@ -76,7 +76,7 @@ public fun StackedColumnChartWithNegativeValues() {
@Composable
public fun StackedColumnChartWithNegativeValuesAndDataLabels() {
Surface {
Chart(
CartesianChartHost(
chart = columnChart(
columns = columns,
dataLabel = textComponent(),
Expand All @@ -93,7 +93,7 @@ public fun StackedColumnChartWithNegativeValuesAndDataLabels() {
@Composable
public fun StackedColumnChartWithNegativeValuesAndAxisValuesOverridden() {
Surface {
Chart(
CartesianChartHost(
chart = columnChart(
columns = columns,
axisValuesOverrider = AxisValuesOverrider.fixed(
Expand All @@ -113,7 +113,7 @@ public fun StackedColumnChartWithNegativeValuesAndAxisValuesOverridden() {
@Composable
public fun StackedColumnChartWithNegativeValuesAndAxisValuesOverridden2() {
Surface {
Chart(
CartesianChartHost(
chart = columnChart(
columns = columns,
axisValuesOverrider = AxisValuesOverrider.fixed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.patrykandpatrick.vico.compose.axis.horizontal.bottomAxis
import com.patrykandpatrick.vico.compose.axis.vertical.startAxis
import com.patrykandpatrick.vico.compose.chart.Chart
import com.patrykandpatrick.vico.compose.chart.CartesianChartHost
import com.patrykandpatrick.vico.compose.chart.column.columnChart
import com.patrykandpatrick.vico.compose.chart.scroll.rememberChartScrollSpec
import com.patrykandpatrick.vico.compose.component.lineComponent
Expand Down Expand Up @@ -83,7 +83,7 @@ private fun ProvidePreviewChartStyle(content: @Composable () -> Unit) {
@Composable
public fun ThresholdLine() {
ProvidePreviewChartStyle {
Chart(
CartesianChartHost(
modifier = Modifier,
chart = columnChart().apply {
addDecoration(
Expand All @@ -106,7 +106,7 @@ public fun ThresholdLine() {
@Composable
public fun ThresholdLineWithCustomText() {
ProvidePreviewChartStyle {
Chart(
CartesianChartHost(
modifier = Modifier,
chart = columnChart().apply {
addDecoration(
Expand Down Expand Up @@ -167,7 +167,7 @@ public fun ThresholdLineWithCustomText() {
@Composable
public fun RangedThresholdLine() {
ProvidePreviewChartStyle {
Chart(
CartesianChartHost(
modifier = Modifier,
chart = columnChart().apply {
addDecoration(
Expand All @@ -190,7 +190,7 @@ public fun RangedThresholdLine() {
@Composable
public fun RangedThresholdLineWithBrushShader() {
ProvidePreviewChartStyle {
Chart(
CartesianChartHost(
modifier = Modifier,
chart = columnChart().apply {
addDecoration(
Expand Down Expand Up @@ -221,7 +221,7 @@ public fun RangedThresholdLineWithBrushShader() {
@Composable
public fun RangedThresholdLineWithComponentShader() {
ProvidePreviewChartStyle {
Chart(
CartesianChartHost(
modifier = Modifier,
chart = columnChart().apply {
addDecoration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.patrykandpatrick.vico.compose.axis.horizontal.bottomAxis
import com.patrykandpatrick.vico.compose.axis.vertical.startAxis
import com.patrykandpatrick.vico.compose.chart.Chart
import com.patrykandpatrick.vico.compose.chart.CartesianChartHost
import com.patrykandpatrick.vico.compose.chart.column.columnChart
import com.patrykandpatrick.vico.compose.chart.scroll.rememberChartScrollSpec
import com.patrykandpatrick.vico.core.axis.AxisPosition
Expand All @@ -47,7 +47,7 @@ private val axisValueFormatter = AxisValueFormatter<AxisPosition.Horizontal.Bott
@Preview(widthDp = 400, backgroundColor = WHITE, showBackground = true)
@Composable
public fun ColumnChartEdgeTickPosition() {
Chart(
CartesianChartHost(
chart = chart,
model = model,
startAxis = startAxis(),
Expand All @@ -62,7 +62,7 @@ public fun ColumnChartEdgeTickPosition() {
@Preview(widthDp = 400, backgroundColor = WHITE, showBackground = true)
@Composable
public fun ColumnChartWithCustomEdgeTickPosition() {
Chart(
CartesianChartHost(
chart = chart,
model = model,
startAxis = startAxis(),
Expand All @@ -77,7 +77,7 @@ public fun ColumnChartWithCustomEdgeTickPosition() {
@Preview(widthDp = 400, backgroundColor = WHITE, showBackground = true)
@Composable
public fun ColumnChartWithEdgeTickPosition() {
Chart(
CartesianChartHost(
chart = chart,
model = model,
startAxis = startAxis(),
Expand All @@ -92,7 +92,7 @@ public fun ColumnChartWithEdgeTickPosition() {
@Preview(widthDp = 400, backgroundColor = WHITE, showBackground = true)
@Composable
public fun ColumnChartWithEdgeTickPositionDeprecated() {
Chart(
CartesianChartHost(
chart = chart,
model = model,
startAxis = startAxis(),
Expand All @@ -106,7 +106,7 @@ public fun ColumnChartWithEdgeTickPositionDeprecated() {
@Preview(widthDp = 400, backgroundColor = WHITE, showBackground = true)
@Composable
public fun ColumnChartWithCenterTickPositionDeprecated() {
Chart(
CartesianChartHost(
modifier = Modifier,
chart = chart,
model = model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.viewinterop.AndroidViewBinding
import com.patrykandpatrick.vico.compose.axis.horizontal.bottomAxis
import com.patrykandpatrick.vico.compose.axis.vertical.startAxis
import com.patrykandpatrick.vico.compose.chart.Chart
import com.patrykandpatrick.vico.compose.chart.CartesianChartHost
import com.patrykandpatrick.vico.compose.chart.line.lineChart
import com.patrykandpatrick.vico.compose.style.ProvideChartStyle
import com.patrykandpatrick.vico.core.axis.Axis
Expand All @@ -44,7 +44,7 @@ internal fun Chart1(uiSystem: UISystem, chartEntryModelProducer: ChartEntryModel
private fun ComposeChart1(chartEntryModelProducer: ChartEntryModelProducer) {
val marker = rememberMarker()
ProvideChartStyle(rememberChartStyle(chartColors)) {
Chart(
CartesianChartHost(
chart = lineChart(persistentMarkers = remember(marker) { mapOf(PERSISTENT_MARKER_X to marker) }),
chartModelProducer = chartEntryModelProducer,
startAxis = startAxis(),
Expand Down
Loading

0 comments on commit 2260098

Please sign in to comment.