patrykandpatrick / vico

A light and extensible chart library for Android.
https://patrykandpatrick.com/vico/wiki
Apache License 2.0
2.15k stars 130 forks source link

Unresolved reference: com.patrykandpatrick.vico.compose.chart.CartesianChartHost #581

Closed virtualpathum closed 8 months ago

virtualpathum commented 8 months ago

How to reproduce

This sounds basic but I keep getting this. However, in the same project, I can run LineChart without any issues. (com.patrykandpatrick.vico.core.chart.line.LineChart)

my build. gradle has this

implementation("com.patrykandpatrick.vico:compose:1.14.0")
// For `compose`. Creates a `ChartStyle` based on an M2 Material Theme.
implementation("com.patrykandpatrick.vico:compose-m2:1.14.0")
// For `compose`. Creates a `ChartStyle` based on an M3 Material Theme.
implementation("com.patrykandpatrick.vico:compose-m3:1.14.0")
// Houses the core logic for charts and other elements. Included in all other modules.
implementation("com.patrykandpatrick.vico:core:1.14.0")

what am I doing wrong?

Did clean build restart etc...

Observed behavior

Cannot create CartesianChartHost

Expected behavior

I need to create a stacked bar chart

Vico version(s)

Latest stable version

Android version(s)

27

Additional information

No response

patrickmichalik commented 8 months ago

Hello! CartesianChartHost is a Vico 2 API. Please update to Vico 2 or use the equivalent Vico 1 API, which is Chart.

I wrote another comment here a few minutes ago, asking for extra context, but I realized what’s going on a moment later, so I deleted it. Sorry for the extra notification.

virtualpathum commented 8 months ago

I was referring to the given sample code and wanted to generate a chart like Chart5. Vico 2 is still in alpha, right? So, is there a sample code to refer to generate a stacked bar chart with Vico 1 API?

patrickmichalik commented 8 months ago

Yup, Vico 2 is in alpha, @virtualpathum, though it should be noted that this refers primarily to the stability of the API. I wouldn’t consider version 2.0.0 Alpha 8 less reliable than version 1.14.0, for example. Both versions are actively maintained, and we’ve addressed all reported issues for both, but Vico 2 has the advantage of including a large number of further optimizations, a consolidated API, and several new features (with more on the way). That said, while upcoming Vico 1 updates shouldn’t require any changes on your end, the Vico 2 API will be modified in the alpha stage.

To see the code for the Vico 1 version of the fifth sample chart, please select the correct tag (v1.14.0). Here is a direct link.

virtualpathum commented 8 months ago

Thanks for the prompt replies. Will check the given link.

patrickmichalik commented 8 months ago

You’re welcome! Let me know if you have any questions.