GraphicsJS icon indicating copy to clipboard operation
GraphicsJS copied to clipboard

How to use graphics.js with Angular 6?

Open abudarevsky opened this issue 7 years ago • 11 comments

There is demo project for AnyChart intergration with angular 5, however, the same approach doesn't work for graphics.js. Attempt to import the library results in error:

core.js:1633 ERROR Error: Uncaught (in promise): ReferenceError: acgraph is not defined

installed the latest version 1.3.2 via npm

abudarevsky avatar Jul 25 '18 16:07 abudarevsky

@abudarevsky we will look into it and get back to you

loki20beta avatar Aug 03 '18 05:08 loki20beta

@abudarevsky Unfortunately, the current version of AnyChart doesn't provide typedefs for pure GraphicsJS which functions and methods are available via acgraph.***(). Now you can use graphicsJS only as a part of AnyChart library. You should include anychart-base.min.js and access to graphics methods and functions via anychart.graphics.***(). Meanwhile, our team prepares additional index.d.ts for pure GraphicsJS. We will notify you when the update becomes available.

Shestac92 avatar Aug 07 '18 03:08 Shestac92

@abudarevsky We are glad to notify that we have prepared typedefs for graphicsJS! You can download the current version of graphicsJS.d.ts by this link.

Here are few lines how to use the graphicsJS in the Angular app:

stage: acgraph.vector.Stage = null;
ngOnInit() {
  this.stage = acgraph.create(this.container.nativeElement);
  this.stage.circle(50, 50, 45);
}

Shestac92 avatar Sep 27 '18 09:09 Shestac92

@Shestac92 Does the link for the ts file work?

arunmmanoharan avatar Oct 22 '18 15:10 arunmmanoharan

@a2441918 Please, use this link to get the latest graphics.d.ts

Shestac92 avatar Oct 23 '18 02:10 Shestac92

@Shestac92 the link seems to be broken

jchatkinson avatar Dec 29 '18 00:12 jchatkinson

@jchatkinson Thank you for pointing me at this fact! Very soon I will provide the correct link.

Shestac92 avatar Dec 29 '18 10:12 Shestac92

Any news on this? both of links are broken!

ghost avatar Sep 13 '19 07:09 ghost

@pouya-daneshvar-freelands-it Use the link to download the index.d.ts file for GraphicsJS.

Shestac92 avatar Sep 16 '19 02:09 Shestac92

Any news on this? both of links are broken!

vincent1981 avatar Jun 22 '20 02:06 vincent1981

The last link mentioned is http://api.anychart.stg/si/8.3.0/graphics.d.ts, but I was able to download the d.ts file by replacing .stg with .com.

decfrr avatar Nov 05 '23 06:11 decfrr