Git Product home page Git Product logo

Comments (2)

FERNman avatar FERNman commented on May 16, 2024 1

Hi @simonmoreau

If you want to use the Formatter object of GoogleCharts, here's what you have to do (also found in the README.

In the component where you want to create the chart, inject the ScriptLoaderService.
Example:

constructor(private loaderService: ScriptLoaderService) {}

Then subscribe to the onReady event of the ScriptLoaderService and load the package you need in the callback. As an example and to follow best practices, I'll do this in the onInit method. It can, however, be done anywhere in your component:

ngOnInit() {
  this.loaderService.onReady.subscribe(() => {
     this.loaderService.loadChartPackages(this.type).subscribe(() => {
       // Start creating your chart now
       // Example:
       const formatter = new google.visualization.BarFormat();
     });
  });
}

where this.type is your chart type, and you can get it by calling the following line:

this.type = GoogleChartPackagesHelper.getPackageForChartName('BarChart');

Hope this helps. If you still have any problems regarding this issue, feel free to point them out.

from angular-google-charts.

simonmoreau avatar simonmoreau commented on May 16, 2024

I get it, it is working fine by now ! Thank you for your help !

from angular-google-charts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.