AnyChart / GraphicsJS

A lightweight JavaScript graphics library with the intuitive API, based on SVG/VML technology.
http://www.graphicsjs.org/
BSD 3-Clause "New" or "Revised" License
992 stars 67 forks source link

How to use graphics.js with Angular 6? #8

Open abudarevsky opened 6 years ago

abudarevsky commented 6 years ago

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

loki20beta commented 6 years ago

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

Shestac92 commented 6 years ago

@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 commented 6 years ago

@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);
}
arunmmanoharan commented 6 years ago

@Shestac92 Does the link for the ts file work?

Shestac92 commented 6 years ago

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

jchatkinson commented 5 years ago

@Shestac92 the link seems to be broken

Shestac92 commented 5 years ago

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

ghost commented 5 years ago

Any news on this? both of links are broken!

Shestac92 commented 5 years ago

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

vincent1981 commented 4 years ago

Any news on this? both of links are broken!

decfrr commented 1 year ago

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.