patternomaly
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -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() { |
{ | ||
"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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
94
0
140420
16
38
2288