New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@talentia/angular-d3-cloud

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@talentia/angular-d3-cloud

D3 word cloud component for Angular built upon d3-cloud

  • 1.4.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Angular D3 Word Cloud

D3 Cloud component for Angular built upon d3-cloud

Open in StackBlitz

This version require Angular CLI 15

Previous versions

Click to expand

Installation

npm install --save @talentia/angular-d3-cloud@1.4.4

Installing the package does not install the type definitions for d3-cloud, d3-scale, d3-scale-chromatic, d3-selection and d3-transition libraries. If you need to use these libraries in your project then install the type definitions with the following command:

npm i --save-dev @types/d3-cloud@1.2.5 @types/d3-scale@4.0.2 @types/d3-scale-chromatic@3.0.0 @types/d3-selection@3.0.3 @types/d3-transition@3.0.2

Usage

First import the package to your app module

// app.module.ts
import { AngularD3CloudModule } from '@talentia/angular-d3-cloud';

@NgModule({
  imports: [
    AngularD3CloudModule
  ],
  ...
})

Now the component is ready to use.

<!-- app.component.html -->
<angular-d3-cloud [data]="data" [hover]="true" [selection]="true" [tooltip]="true"></angular-d3-cloud>
// app.component.ts
export class AppComponent implements OnInit {
   @Input() data!: AngularD3Word[];

     private words = ["Exercitation","duis","ex","laboris","est","aliqua","Lorem","veniam","ad","Minim","enim","do","exercitation","eiusmod","sunt","qui","Aliqua","velit","in","commodo","anim","Sunt","labore","dolor","non","culpa","proident","laborum","dolore","occaecat","mollit","ea","aute","excepteur","Labore","incididunt","tempor","Nisi","nostrud","deserunt","ipsum","adipisicing","pariatur","magna","Ut","aliquip","et","Pariatur","sint","ut","amet","id","eu","cillum","nulla","esse","elit","consequat","Ea","ullamco","Ad","voluptate","nisi","minim"];

   ngOnInit(): void {
    this.data = this.words.map((word) => {
      const value = 10 + Math.random() * 90;
      return { text: word, value: value, tooltip: `The value of ${word} is ${value}` } as AngularD3Word;
    });
  } 
}

AngularD3CloudComponent Properties

NameDescriptionTypeRequiredDefault
dataWords arrayAngularD3Word[]
widthLayout width (px)number700
heightLayout height (px)number600
paddingPadding between tags (px)number5
fontFont family needed for calculating layoutstringArial
fontSizeMapperMap each word value of data to font size (px)number((word: AngularD3Word, index: number) => number)
rotateRotation in degreesnumber((word: AngularD3Word, index: number) => number)
autoFillWhether words need to be filled with random colorsbooleanfalse
fillMapperFunction used by autoFill to map each data item to a fill color(word: AngularD3Word, index: number) => stringschemeCategory10
animationsWhether to apply animationbooleanfalse
speedAnimation speed (ms)number600
fontWeightFont weightstringnumber
fontStyleFont stylestringnormal
tooltipWhether the tooltip should be shownbooleanfalse
hoverWhether to apply the hover effect on the wordsbooleanfalse
selectionWhether the word should be selectablebooleanfalse

AngularD3CloudComponent Events

NameDescriptionPayload
wordClickEvent triggered when click event triggered on a word{ event: MouseEvent, word: AngularD3Word }
wordMouseOverEvent triggered when mouseover event triggered on a word{ event: MouseEvent, word: AngularD3Word }
wordMouseMoveEvent triggered when mousemove event triggered on a word{ event: MouseEvent, word: AngularD3Word }
wordMouseOutEvent triggered when mouseout event triggered on a word{ event: MouseEvent, word: AngularD3Word }

AngularD3Word Interface

NameDescriptionType
valueValue to map to font sizenumber
tooltipTooltip textstring

AngularD3Word extends the interface Word imported from d3-cloud

Example

Run the following commands to start sample project:

npm start

Thanks

This project is built with the idea of React D3 Cloud.
This project is forked from maitrungduc1410/d3-cloud-angular.

Keywords

FAQs

Package last updated on 10 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc