@talentia/angular-d3-cloud
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -1,41 +0,43 @@ | ||
import { ElementRef, EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core'; | ||
import cloud from 'd3-cloud'; | ||
import 'd3-transition'; | ||
import { ElementRef, EventEmitter, OnChanges, AfterViewInit, SimpleChanges, OnDestroy } from '@angular/core'; | ||
import { AngularD3Word } from './angular-d3-cloud.interfaces'; | ||
import { AngularD3CloudService } from './angular-d3-cloud.service'; | ||
import * as i0 from "@angular/core"; | ||
export declare class AngularD3CloudComponent implements OnChanges, OnInit { | ||
export declare class AngularD3CloudComponent implements OnChanges, AfterViewInit, OnDestroy { | ||
private cloudService; | ||
wordcloud: ElementRef<HTMLDivElement> | undefined; | ||
data: cloud.Word[]; | ||
data?: AngularD3Word[]; | ||
width?: number; | ||
height?: number; | ||
padding?: number | ((datum: cloud.Word, index: number) => number); | ||
font?: string | ((datum: cloud.Word, index: number) => string); | ||
fontSizeMapper?: (datum: cloud.Word, index: number) => number; | ||
rotate?: number | ((datum: cloud.Word, index: number) => number); | ||
padding?: number | ((word: AngularD3Word, index: number) => number); | ||
font?: string | ((word: AngularD3Word, index: number) => string); | ||
fontSizeMapper?: number | ((word: AngularD3Word, index: number) => number); | ||
rotate?: number | ((word: AngularD3Word, index: number) => number); | ||
autoFill?: boolean; | ||
fillMapper?: (datum: cloud.Word, index: number) => string; | ||
fillMapper?: (word: AngularD3Word, index: number) => string; | ||
animations?: boolean; | ||
fontWeight: string | number; | ||
fontWeight?: string | number | ((word: AngularD3Word, index: number) => string | number); | ||
wordClick: EventEmitter<{ | ||
event: MouseEvent; | ||
word: cloud.Word; | ||
word: AngularD3Word; | ||
}>; | ||
wordMouseOver: EventEmitter<{ | ||
event: MouseEvent; | ||
word: cloud.Word; | ||
word: AngularD3Word; | ||
}>; | ||
wordMouseOut: EventEmitter<{ | ||
event: MouseEvent; | ||
word: cloud.Word; | ||
word: AngularD3Word; | ||
}>; | ||
private isMouseClickUsed; | ||
private isMouseOverUsed; | ||
private isMouseOutUsed; | ||
private static TAG; | ||
ngOnInit(): void; | ||
ngAfterViewInit(): void; | ||
ngOnChanges(_changes: SimpleChanges): void; | ||
renderCloud(): void; | ||
private validateProps; | ||
private wordMouseClickSubscriber; | ||
private wordMouseOverSubscriber; | ||
private wordMouseOutSubscriber; | ||
constructor(cloudService: AngularD3CloudService); | ||
ngAfterViewInit(): Promise<void>; | ||
ngOnChanges(changes: SimpleChanges): Promise<void>; | ||
ngOnDestroy(): void; | ||
private renderCloudAsync; | ||
private cloneData; | ||
private createOptions; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<AngularD3CloudComponent, never>; | ||
static ɵcmp: i0.ɵɵComponentDeclaration<AngularD3CloudComponent, "angular-d3-cloud", never, { "data": "data"; "width": "width"; "height": "height"; "padding": "padding"; "font": "font"; "fontSizeMapper": "fontSizeMapper"; "rotate": "rotate"; "autoFill": "autoFill"; "fillMapper": "fillMapper"; "animations": "animations"; "fontWeight": "fontWeight"; }, { "wordClick": "wordClick"; "wordMouseOver": "wordMouseOver"; "wordMouseOut": "wordMouseOut"; }, never, never, false, never>; | ||
} |
@@ -0,6 +1,28 @@ | ||
import { Subject } from 'rxjs'; | ||
import 'd3-transition'; | ||
import { AngularD3CloudOptions, AngularD3Word } from './angular-d3-cloud.interfaces'; | ||
import * as i0 from "@angular/core"; | ||
export declare class AngularD3CloudService { | ||
private static TAG; | ||
private document; | ||
wordMouseClick: Subject<{ | ||
event: MouseEvent; | ||
word: AngularD3Word; | ||
}>; | ||
wordMouseOver: Subject<{ | ||
event: MouseEvent; | ||
word: AngularD3Word; | ||
}>; | ||
wordMouseOut: Subject<{ | ||
event: MouseEvent; | ||
word: AngularD3Word; | ||
}>; | ||
constructor(); | ||
renderCloudSync(node: Element, options?: AngularD3CloudOptions): TypeError | null; | ||
renderCloudAsync(node: Element, options?: AngularD3CloudOptions): Promise<void>; | ||
private renderCloud; | ||
private canvasGenerator; | ||
private validateData; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<AngularD3CloudService, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<AngularD3CloudService>; | ||
} |
@@ -5,9 +5,9 @@ { | ||
"description": "D3 word cloud component for Angular built upon d3-cloud", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"dependencies": { | ||
"d3-cloud": "^1.2.5", | ||
"d3-scale": "^3.2.3", | ||
"d3-scale-chromatic": "^2.0.0", | ||
"d3-selection": "^2.0.0", | ||
"d3-transition": "^2.0.0", | ||
"d3-scale": "^4.0.2", | ||
"d3-scale-chromatic": "^3.0.0", | ||
"d3-selection": "^3.0.0", | ||
"d3-transition": "^3.0.1", | ||
"tslib": "^2.3.0" | ||
@@ -21,15 +21,20 @@ }, | ||
"author": { | ||
"email": "maitrungduc1410@gmail.com", | ||
"name": "Mai Trung Duc", | ||
"url": "https://github.com/maitrungduc1410" | ||
"name": "Leonardo Cavone", | ||
"url": "https://github.com/Talentia-Software-OSS" | ||
}, | ||
"contributors": [ | ||
{ | ||
"email": "maitrungduc1410@gmail.com", | ||
"name": "Mai Trung Duc", | ||
"url": "https://github.com/maitrungduc1410" | ||
} | ||
], | ||
"repository": { | ||
"url": "https://github.com/maitrungduc1410/d3-cloud-angular.git", | ||
"url": "https://github.com/Talentia-Software-OSS/d3-cloud-angular", | ||
"type": "git" | ||
}, | ||
"bugs": { | ||
"email": "maitrungduc1410@gmail.com", | ||
"url": "https://github.com/maitrungduc1410/d3-cloud-angular/issues" | ||
"url": "https://github.com/Talentia-Software-OSS/d3-cloud-angular/issues" | ||
}, | ||
"homepage": "https://github.com/maitrungduc1410/d3-cloud-angular", | ||
"homepage": "https://github.com/Talentia-Software-OSS/d3-cloud-angular", | ||
"readme": "README.md", | ||
@@ -36,0 +41,0 @@ "license": "MIT", |
export * from './lib/angular-d3-cloud.service'; | ||
export * from './lib/angular-d3-cloud.component'; | ||
export * from './lib/angular-d3-cloud.module'; | ||
export * from './lib/angular-d3-cloud.interfaces'; |
# Angular D3 Word Cloud | ||
D3 Cloud component for Angular built upon d3-cloud | ||
## This version require Angular CLI 15 | ||
## Previous versions | ||
<details> | ||
<summary>Click to expand</summary> | ||
- [Version 1.4.0](https://github.com/Talentia-Software-OSS/d3-cloud-angular/tree/1.4.x) | ||
- [Version 1.3.0](https://github.com/Talentia-Software-OSS/d3-cloud-angular/tree/1.3.x) | ||
</details> | ||
<img src="./demo.png"> | ||
@@ -8,3 +20,3 @@ | ||
``` | ||
npm install --save angular-d3-cloud | ||
npm install --save @talentia/angular-d3-cloud@1.4.1 | ||
``` | ||
@@ -15,3 +27,4 @@ # Usage | ||
// app.module.ts | ||
import { AngularD3CloudModule } from 'angular-d3-cloud' | ||
import { AngularD3CloudModule } from '@talentia/angular-d3-cloud'; | ||
@NgModule({ | ||
@@ -28,21 +41,20 @@ imports: [ | ||
<!-- app.component.html --> | ||
<angular-d3-cloud | ||
[data]="data" | ||
[width]="700" | ||
[height]="600" | ||
[padding]="5" | ||
font="serif" | ||
[rotate]="0" | ||
[autoFill]="true" | ||
(wordClick)="onWorkClick($event)" | ||
></angular-d3-cloud> | ||
<angular-d3-cloud [data]="data"></angular-d3-cloud> | ||
``` | ||
```ts | ||
// app.component.ts | ||
export class AppComponent { | ||
data = [ | ||
"Hello", "world", "normally", "you", "want", "more", "words", | ||
"than", "this"].map(function (d) { | ||
return { text: d, value: 10 + Math.random() * 90}; | ||
}) | ||
export class AppComponent implements OnInit { | ||
@Input() data!: AngularD3Word[]; | ||
private words = ['Exercitation', 'duis', 'ex', 'laboris', 'laboris', 'est', 'aliqua', 'Lorem', 'veniam', 'ad.', 'Minim', 'aliqua', 'enim', 'do', 'exercitation', 'duis', 'eiusmod', 'sunt', 'do', 'exercitation', 'qui', 'ex.', 'Aliqua', 'velit', 'sunt', 'in', 'commodo', 'anim.', 'Sunt', 'labore', 'sunt', 'dolor', 'exercitation', 'non', 'commodo', 'laboris', 'culpa', 'culpa', 'exercitation', 'ex', 'proident', 'laborum.\n\nId', 'dolore', 'commodo', 'occaecat', 'in', 'velit.', 'Aliqua', 'mollit', 'ea', 'qui', 'ad', 'aute', 'est', 'excepteur', 'non', 'aliqua', 'occaecat', 'ad', 'non', 'ea.', 'Labore', 'incididunt', 'excepteur', 'tempor', 'culpa', 'proident', 'ex', 'commodo.', 'Nisi', 'nostrud', 'tempor', 'deserunt', 'ipsum', 'adipisicing', 'aute', 'do', 'adipisicing.\n\nOfficia', 'pariatur', 'eiusmod', 'tempor', 'magna', 'occaecat.', 'Ut', 'proident', 'anim', 'aute', 'aliquip', 'pariatur', 'et.', 'Pariatur', 'ad', 'ea', 'sint', 'ut', 'excepteur', 'amet', 'id', 'do.', 'Labore', 'eu', 'velit', 'non', 'cillum', 'nulla.\n\nIncididunt', 'duis', 'tempor', 'sunt', 'dolor', 'magna', 'occaecat', 'esse', 'elit', 'consequat.', 'Ea', 'sint', 'et', 'labore', 'amet', 'ullamco', 'non', 'tempor.', 'Ad', 'voluptate', 'nisi', 'duis', 'minim', 'elit', 'in', 'adipisicing', 'et', 'laboris', 'nulla', 'culpa', 'ad']; | ||
ngOnInit(): void { | ||
this.refresh(); | ||
} | ||
refresh(): void { | ||
this.data = this.words.map((word) => { | ||
return { text: word, value: 10 + Math.random() * 90 }; | ||
}); | ||
} | ||
} | ||
@@ -75,6 +87,6 @@ ``` | ||
``` | ||
ng build angular-d3-cloud --watch | ||
npm start # in a separate terminal | ||
npm start | ||
``` | ||
# Thanks | ||
This project is built with the idea of [React D3 Cloud](https://github.com/Yoctol/react-d3-cloud) | ||
This project is built with the idea of [React D3 Cloud](https://github.com/Yoctol/react-d3-cloud). | ||
This project is forked from [maitrungduc1410/d3-cloud-angular](https://github.com/maitrungduc1410/d3-cloud-angular). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
150376
20
1111
89
+ Addedd3-array@3.2.4(transitive)
+ Addedd3-color@3.1.0(transitive)
+ Addedd3-ease@3.0.1(transitive)
+ Addedd3-format@3.1.0(transitive)
+ Addedd3-interpolate@3.0.1(transitive)
+ Addedd3-scale@4.0.2(transitive)
+ Addedd3-scale-chromatic@3.1.0(transitive)
+ Addedd3-selection@3.0.0(transitive)
+ Addedd3-time@3.1.0(transitive)
+ Addedd3-time-format@4.1.0(transitive)
+ Addedd3-timer@3.0.1(transitive)
+ Addedd3-transition@3.0.1(transitive)
+ Addedinternmap@2.0.3(transitive)
- Removedd3-array@2.12.1(transitive)
- Removedd3-color@2.0.0(transitive)
- Removedd3-ease@2.0.0(transitive)
- Removedd3-format@2.0.0(transitive)
- Removedd3-interpolate@2.0.1(transitive)
- Removedd3-scale@3.3.0(transitive)
- Removedd3-scale-chromatic@2.0.0(transitive)
- Removedd3-selection@2.0.0(transitive)
- Removedd3-time@2.1.1(transitive)
- Removedd3-time-format@3.0.0(transitive)
- Removedd3-timer@2.0.0(transitive)
- Removedd3-transition@2.0.0(transitive)
- Removedinternmap@1.0.1(transitive)
Updatedd3-scale@^4.0.2
Updatedd3-scale-chromatic@^3.0.0
Updatedd3-selection@^3.0.0
Updatedd3-transition@^3.0.1