agcGstaticLoaderProvider

This provider configures the the loader strategy implementation for the current google chart “gstatic” loader version.

New loaders have been implemented with providers to provide a helpful programmatic implementation for configuration.

Methods

Name Description Default Value

setVersion(value)

Sets the frozen version of the Google Visualization API to use.

'current'

addPackage(packageName)

Adds packageName to the list of Google Visualization API packages to be loaded.

'corechart'

removePackage(packageName)

Removes packageName from the list of Google Visualization API packages to be loaded, if present.

'corechart'

setOption(key, value)

Sets an option key on the loader configuration to the value set with value.

setOptions(value)

Overwrites the entire underlying options object to the object passed as value. This is helpful for bulk setting of many options.

clearOption(key)

Delete key from the options object. May be helpful to provide a quick override for a value set by a utility method in your application.

useBothLoaders(value)

Pass true to add scripts for both jsapi and gstatic loaders. This is required for Google Visualization API versions before `45` if using `GeoChart` or `Map` types. Angular Google Chart handles this internally already, so this is here is an override to add special cases or cancel out the automatic setting.

false

Example Code

(function() {
    angular.module('myApp')
        .config(configLoader);
    
    configLoader.$inject = ['agcLibraryLoaderProvider', 'agcGstaticLoaderProvider'];
    
    function configLoader(agcLibraryLoaderProvider, agcGstaticLoaderProvider){

        // Select the loader strategy.
        agcLibraryLoaderProvider.setLoader('gstatic');

        // Provider supports method chaining.
        agcGstaticLoaderProvider
            .setVersion('45')
            .addPackage('map')
            .setOption('mapsApiKey', '[YOUR API KEY]');

    }
})();