> For the complete documentation index, see [llms.txt](https://guide.vico.patrykandpatrick.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.vico.patrykandpatrick.com/android-integrations/jetpack-glance.md).

# Jetpack Glance

The `compose-glance` module lets Jetpack Glance app widgets display Vico charts. Use [`CartesianChartImage`](https://api.vico.patrykandpatrick.com/vico/compose-glance/com.patrykandpatrick.vico.compose.glance.cartesian/-cartesian-chart-image.html) and [`PieChartImage`](https://api.vico.patrykandpatrick.com/vico/compose-glance/com.patrykandpatrick.vico.compose.glance.pie/-pie-chart-image.html) in widget content. These functions render charts off-screen to bitmaps and display the result as a static Glance image.

This differs from the interactive chart hosts [`CartesianChartHost`](https://api.vico.patrykandpatrick.com/vico/compose/com.patrykandpatrick.vico.compose.cartesian/-cartesian-chart-host) and [`PieChartHost`](https://api.vico.patrykandpatrick.com/vico/compose/com.patrykandpatrick.vico.compose.pie/-pie-chart-host/). Glance doesn’t support the Compose canvas, so the image functions are the supported entry points for app widgets. Because the result is static, chart interactions such as scroll, zoom, and markers are unavailable.

## Cartesian charts

Pass a [`CartesianChart`](https://api.vico.patrykandpatrick.com/vico/compose/com.patrykandpatrick.vico.compose.cartesian/-cartesian-chart/) instance and a [`CartesianChartModel`](https://api.vico.patrykandpatrick.com/vico/compose/com.patrykandpatrick.vico.compose.cartesian.data/-cartesian-chart-model/) instance:

```kt
CartesianChartImage(
    chart = rememberCartesianChart(rememberLineCartesianLayer()),
    model = model,
    contentDescription = "Weekly sales",
    modifier = GlanceModifier.fillMaxSize(),
)
```

## Pie charts

Pass a [`PieChart`](https://api.vico.patrykandpatrick.com/vico/compose/com.patrykandpatrick.vico.compose.pie/-pie-chart/) instance and a [`PieChartModel`](https://api.vico.patrykandpatrick.com/vico/compose/com.patrykandpatrick.vico.compose.pie.data/-pie-chart-model/) instance:

```kt
PieChartImage(
    chart = rememberPieChart(),
    model = model,
    contentDescription = "Expense breakdown",
    modifier = GlanceModifier.fillMaxSize(),
)
```

## Size and scaling

By default, each image uses Glance’s current widget size. You can pass a custom [`DpSize`](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize) value via the `size` parameter. Use the `contentScale` parameter, which accepts a [`ContentScale`](https://developer.android.com/reference/kotlin/androidx/glance/layout/ContentScale) value, to control how the bitmap is scaled within the image bounds.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://guide.vico.patrykandpatrick.com/android-integrations/jetpack-glance.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
