Giter Site home page Giter Site logo

Comments (9)

FERNman avatar FERNman commented on August 23, 2024

I've just published a new version of the package that exports the ScriptLoaderService. You'd have to inject this service into your custom component and then wait for onLoad to be called. Just see the Google-Charts-Component as an example.

from angular-google-charts.

jkon avatar jkon commented on August 23, 2024

Sweet, thanks!

from angular-google-charts.

jkon avatar jkon commented on August 23, 2024

so, I see how you used the script loader service to get the chart packages, but what if I want to make a formatter? I still need the google.visualization object, right? Like in your formatter example:

 myFormatter = [
  { formatter: new google.visualization.Dateformat({formatType: 'long'}), colIndex: 1 },
  { formatter: new google.visualization.Dateformat({formatType: 'long'}), colIndex: 3 }
]; 

from angular-google-charts.

jkon avatar jkon commented on August 23, 2024

Having a new issue after updating to 0.0.7. All of my module.ngfactory.js files are throwing this error:
"export 'Éľa' (imported as 'i39') was not found in 'angular-google-charts'

from angular-google-charts.

jkon avatar jkon commented on August 23, 2024

i downgraded to 0.0.6 and had the same errors. had to go back to 0.0.5 to get rid of them

from angular-google-charts.

FERNman avatar FERNman commented on August 23, 2024

Could you please provide explanation on how to reproduce this?

from angular-google-charts.

jkon avatar jkon commented on August 23, 2024

I tried to create a stackblitz to reproduce, but I can't seem to. It must be something specific to my project. I can add that when I try to render the chart, I get this error after every change detection:
TypeError: ctor is not a constructor
at _createClass (core.js:10628)
at createProviderInstance$1 (core.js:10602)
at resolveNgModuleDep (core.js:10553)
at NgModuleRef
.get (core.js:11595)
at resolveDep (core.js:12074)
at createClass (core.js:11934)
at createDirectiveInstance (core.js:11777)
at createViewNodes (core.js:13239)
at createEmbeddedView (core.js:13116)
at callWithDebugContext (core.js:14524)

I'm not sure what's going on or why it is happening with the newer versions only

from angular-google-charts.

jkon avatar jkon commented on August 23, 2024

hm, I have been trying to create a stackblitz example that reproduces the errors I was seeing, but I just couldn't. I added all the modules my app imports and couldn't. So, I decided to try seeing if it was a package version issue with some other package, so I blew out my local node_modules and reinstalled everything and now the errors are gone from my project. Just one of those shruggie moments. Anyway, while building the stackblitz I also did an example of how to use the script loader service. Here is a snippet of how I used it to make a formatter that I think could help others:

constructor( private loaderService: ScriptLoaderService ) {}

  ngOnInit() {
    this.loaderService.onReady.subscribe( () => {
      this.loaderService.loadChartPackages(this.type).subscribe( () => {
        console.log('loaded chart packages');
        const formatter = new google.visualization.BarFormat();
        console.log(formatter);
      });
      
    });
  }

It's worth noting that this.type needs to be the translated string that your package returns with [GoogleChartPackagesHelper.getPackageForChartName(this.type)]. That helper isn't available, so I had to look at it to figure out what string to actually pass. That helper being available would be nice.
Again, thanks for the quick turnaround on exposing the service

from angular-google-charts.

FERNman avatar FERNman commented on August 23, 2024

Thanks for the code example, I've added a new section to the readme based on it! 👍

I'm also happy that everything worked out for you, I'll close this one now.

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.