npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular4-knob

v1.1.11

Published

Angular 4 directive for Knob component powered by d3.js v4 without jQuery dependencies

Downloads

9

Readme

angular2-knob

Angular 4 directive for Knob component using d3.js v4 without jQuery dependencies

screenshot

Features

  • very easy to implement
  • without jQuery dependencies
  • powered by d3.js v4
  • configurable minimum, maximum values and step
  • animated
  • great ability to configure
  • configurable scale
  • touch, click and drag events implemented

Dependencies

  • Angular 4
  • D3.js V4
  • @types/d3-selection@^1.1.0

Browser Support

  • Chrome, Firefox, Safari, Opera, IE9+

Get started

Installation

You can also use bower to install the component:

$ npm install angular2-knob --save

Usage

IMPORTING ANGULAR MODULE:
import { KnobModule } from "angular2-knob";

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [KnobModule]
  bootstrap: [AppComponent]
})
HTML USE:
<div ui-knob [value]="value" [options]="knOptions"></div>
CONFIGURING OPTIONS IN ANGULAR COMPONENT:
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent{
  knOptions = {
    readOnly: true,
    size: 140,
    unit: '%',
    textColor: '#000000',
    fontSize: '32',
    fontWeigth: '700',
    fontFamily: 'Roboto',
    valueformat: 'percent',
    max: 100,
    trackWidth: 19,
    barWidth: 20,
    trackColor: '#D8D8D8',
    barColor: '#FF6F17',
    subText: {
      enabled: true,
      fontFamily: 'Verdana',
      font: '14',
      fontWeight: 'bold',
      text: 'Overall',
      color: '#000000',
      offset: 7
    },
  }
  value = 45; 
}

Options

You can pass these options to the initialize function to set a custom look and feel for the plugin.

| Property | Type | Default | Description | |------------------|--------------|-------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| | animate | object | { enabled: true, duration: 1000, ease: 'bounce' } | Duration in milliseconds, Ease: linear, bounce, sin, cubic, quad, exp, circle | | size | integer | 200 | Size of knob in px. It will always be a square | | startAngle | integer | 0 | Start angle in degrees | | endAngle | integer | 360 | End angle in degrees | | unit | string | '' | Unit values | | displayInput | boolean | true | Display input value (true or false) | | inputFormatter | function | function(value){ return value; } | Formats the input value before appending the unit and displaying it to the DOM | | readOnly | boolean | false | Disabled change value (true or false) | | trackWidth | integer | 50 | Width track bar in px | | barWidth | integer | 50 | Width bar value in px | | trackColor | string | 'rgba(0,0,0,0)' | Color track bar | | barColor | string | 'rgba(255,0,0,.5)' | Color bar value | | prevBarColor | string | 'rgba(0,0,0,0)' | Color bar previous value | | textColor | string | '#222' | Text color | | barCap | integer | 0 | Defines how the ending of the bar line looks like in radius | | trackCap | integer | 0 | Defines how the ending of the track line looks like in radius | | fontSize | string | 'auto' | Font size in px. auto: automatic change | | subText | object | { enabled: false, text: '', fontFamily: 'Arial', fontWeight: 'normal', color: 'gray', font: 'auto', offset: 0 } | Subtext options | | bgColor | string | '' | Background color | | bgFull | string | false | Paints the background of the whole circle ignoring startAngle and endAngle | | scale | object | { enabled: false, type: 'lines', color: 'gray', width: 4, quantity: 20, height: 10, spaceWidth: 15 } | Scale options, type: lines or dots | | step | integer | 1 | Step change, min 0.1 | | displayPrevious | boolean | false | Display previous value (true or false) | | min | integer | 0 | Min value (start value), only integer | | max | integer | 100 | Max value (end value), only integer | | dynamicOptions | boolean | false | Dynamic change options (true or false) |