eclipsesource / tabris-js

Create native mobile apps in JavaScript or TypeScript.
https://tabrisjs.com
BSD 3-Clause "New" or "Revised" License
1.4k stars 170 forks source link

how to use chart.js in tabris #2180

Closed bezkel closed 2 years ago

bezkel commented 3 years ago

Hi. On tabris.com is written that I can use chart.js I tried to use it with tabris 3.7.0 but it doesnt work. How could I use it and which version should I use? I dont want to reinvent the wheel and generate graphs by myself on a canvas.

cookieguru commented 3 years ago

The Chart.js example was removed in 9b36f6806243a17c57fbaf82b9a36448d79c2f3f

Can you post the error you are seeing?

bezkel commented 3 years ago

I get 36 errors - all are TS2304 errors like this: node_modules/chart.js/types/color.d.ts:1:47 - error TS2304: Cannot find name 'CanvasPattern'. export type Color = string | CanvasGradient | CanvasPattern;

All are kind of this types: CanvasPattern, HTMLCanvasElement, CanvasRenderingContext2D, OffscreenCanvas, CanvasLineCap, CanvasLineJoin, HTMLImageElement, CanvasRenderingContext2DSettings.

I can skip this errors by using "skipLibCheck": true in tsconfig.json and it could be served. But if I open it, it results in this error: Failed to create chart: can't acquire context from the given item

cookieguru commented 3 years ago

And which version of Tabris.js are you using?

bezkel commented 3 years ago

I use tabris 3.7.0

bezkel commented 3 years ago

has anyone tried this and have a solution for me?

jumpjack commented 2 years ago

Does tabris 2.x developer app include charts.js? I get a "module not found" error.

cookieguru commented 2 years ago

The chart.js library is not available for consumption except in the examples. In order to test it out you'll need to install the tabris-cli and include the dependency in your project's package.json.

mpost commented 2 years ago

Closing for now. Please reopen if you have any more issue.