-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
84 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
import { ModuleWithProviders, NgModule } from '@angular/core'; | ||
|
||
import { GoogleChartComponent } from './google-chart/google-chart.component'; | ||
import { Config } from './models/config.model'; | ||
import { CHART_VERSION, MAPS_API_KEY } from './models/injection-tokens.model'; | ||
import { GoogleChartsConfig } from './models/google-charts-config.model'; | ||
import { GOOGLE_CHARTS_CONFIG } from './models/injection-tokens.model'; | ||
import { RawChartComponent } from './raw-chart/raw-chart.component'; | ||
|
||
@NgModule({ | ||
declarations: [GoogleChartComponent, RawChartComponent], | ||
exports: [GoogleChartComponent, RawChartComponent] | ||
}) | ||
export class GoogleChartsModule { | ||
public static forRoot({ mapsApiKey, version }: Config = {}): ModuleWithProviders<GoogleChartsModule> { | ||
public static forRoot(config: GoogleChartsConfig = {}): ModuleWithProviders<GoogleChartsModule> { | ||
return { | ||
ngModule: GoogleChartsModule, | ||
providers: [ | ||
{ provide: MAPS_API_KEY, useValue: mapsApiKey }, | ||
{ provide: CHART_VERSION, useValue: version } | ||
] | ||
providers: [{ provide: GOOGLE_CHARTS_CONFIG, useValue: config }] | ||
}; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
libs/angular-google-charts/src/lib/models/google-charts-config.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
export interface GoogleChartsConfig { | ||
/** | ||
* This setting lets you specify a key that you may use with Geochart and Map Chart. | ||
* You may want to do this rather than use the default behavior which may result in | ||
* occasional throttling of service for your users. | ||
* | ||
* Only available when using Google Charts 45 or higher. | ||
* | ||
* {@link https://developers.google.com/chart/interactive/docs/basic_load_libs#load-settings Parameter documentation } | ||
* {@link https://developers.google.com/chart/interactive/docs/gallery/geochart GeoChart Documentation} | ||
*/ | ||
mapsApiKey?: string; | ||
|
||
/** | ||
* Which version of Google Charts to use. | ||
* | ||
* Please note that this library does only work with Google Charts 45 or higher. | ||
* | ||
* @description | ||
* Can be either a number specifying a | ||
* {@link https://developers.google.com/chart/interactive/docs/release_notes#current:-january-6,-2020 frozen version } of Google Charts | ||
* or one of the special versions `current` and `upcoming`. | ||
* | ||
* Defaults to `current`. | ||
* | ||
* {@link https://developers.google.com/chart/interactive/docs/basic_load_libs#basic-library-loading Offical Documentation} | ||
*/ | ||
version?: string; | ||
|
||
/** | ||
* When set to true, all charts and tooltips that generate HTML from user-supplied data will sanitize it | ||
* by stripping out unsafe elements and attributes. | ||
* | ||
* Only available when using GoogleCharts 47 or higher. | ||
* | ||
* {@link https://developers.google.com/chart/interactive/docs/basic_load_libs#load-settings Parameter documentation } | ||
*/ | ||
safeMode?: boolean; | ||
} |
5 changes: 3 additions & 2 deletions
5
libs/angular-google-charts/src/lib/models/injection-tokens.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { InjectionToken } from '@angular/core'; | ||
|
||
export const CHART_VERSION = new InjectionToken<string>('CHART_VERSION'); | ||
export const MAPS_API_KEY = new InjectionToken<string>('MAPS_API_KEY'); | ||
import { GoogleChartsConfig } from './google-charts-config.model'; | ||
|
||
export const GOOGLE_CHARTS_CONFIG = new InjectionToken<GoogleChartsConfig>('GOOGLE_CHARTS_CONFIG'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters