Socket
Socket
Sign inDemoInstall

patternomaly

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.3.1

index.d.ts

16

dist/patternomaly.js

@@ -148,2 +148,16 @@ (function (global, factory) {

var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var inherits = function (subClass, superClass) {

@@ -1038,3 +1052,3 @@ if (typeof superClass !== "function" && superClass !== null) {

Object.assign(completeShapesList, shapes, deprecatedShapes);
_extends(completeShapesList, shapes, deprecatedShapes);

@@ -1041,0 +1055,0 @@ function draw() {

4

package.json
{
"name": "patternomaly",
"version": "1.3.0",
"version": "1.3.1",
"description": "Easily generate patterns for use in data graphics",
"jsnext:main": "dist/patternomaly.mjs",
"main": "dist/patternomaly.js",
"typings": "index.d.ts",
"browser": "dist/patternomaly.js",

@@ -28,2 +29,3 @@ "scripts": {

"babel-plugin-external-helpers": "^6.8.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-preset-es2015": "^6.13.2",

@@ -30,0 +32,0 @@ "babel-register": "^6.11.6",

@@ -23,9 +23,60 @@ # Patternomaly

pattern.generate([
'#1f77b4',
'#ff7f0e',
'#2ca02c',
'#d62728'
]);
```javascript
pattern.generate([
'#1f77b4',
'#ff7f0e',
'#2ca02c',
'#d62728'
]);
```
## Available Patterns
There are currently 21 pattern variants available. When using the `generate` method (above) patterns will be 'randomly' assigned.
It is however possible to provide specific patterns using the `draw` method.
```javascript
datasets: [{
data: [
300, 50, 100, 210, 140
],
backgroundColor: [
pattern.draw('square', '#1f77b4'),
pattern.draw('circle', '#ff7f0e'),
pattern.draw('diamond', '#2ca02c'),
pattern.draw('zigzag-horizontal', '#17becf'),
pattern.draw('triangle', 'rgb(255, 99, 132, 0.4)') // with opacity
]
}]
```
### Pattern Keys
- plus
- cross
- dash
- cross-dash
- dot
- dot-dash
- disc
- ring
- line
- line-vertical
- weave
- zigzag
- zigzag-vertical
- diagonal
- diagonal-right-left
- square
- box
- triangle
- triangle-inverted
- diamond
- diamond-box
<img src="./assets/pattern-list.png" alt="Pattern example" width="650">
*Thanks to [obedm503](https://github.com/obedm503) for generating the example pattern image.*
## Providing a Pattern Alternative

@@ -36,1 +87,9 @@

See the [pattern option example page](examples/optional.html) for a simple implementation of a pattern toggle switch for Chart.js.
## Typescript / Angular
A typings file is included in this package. Just insert `import {draw, generate} from 'patternomaly'` in the header of your .ts file.
Still you have to add the javascript file to your build e.g. in the scripts array in angular.cli.json e.g. `"scripts": ["node_modules/patternomaly/dist/patternomaly.js"]`.

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc