patternomaly icon indicating copy to clipboard operation
patternomaly copied to clipboard

Pre-packaged .js file

Open Yobmod opened this issue 7 years ago • 3 comments

Is it possible to get a packaged (post babel etc) single file version of this, that can just be included in the html?

I've tried installing and babelling/webpacking it myself, but every bundle results in a "pattern is not defined" error, even though it appears all the code is there. Same error whether i put the pattern.draw() in the bundle.js or as a separate file after the patternomaly.bundle.js.)

Yobmod avatar Mar 31 '17 16:03 Yobmod

i've found only this https://unpkg.com/[email protected]/dist/patternomaly.js

baterflyrity avatar Sep 08 '17 12:09 baterflyrity

I ran the npm and these are the files created if anyone needs them. patternomaly.zip

holypwnage avatar Jun 12 '18 22:06 holypwnage

Just to expand on @baterflyrity's answer above, usage would be:

    <script src="https://unpkg.com/[email protected]/dist/patternomaly.js"></script>
    var colors = [
        '#1f77b4', 
        '#e377c2',
        '#ff7f0e',
        '#2ca02c'
    ];

    var patterns = pattern.generate(colors);


    const myChart = new Chart(ctx, {
            type: 'pie',
            data: {
                labels: [...

    // And then...

    myChart.data.datasets[0].backgroundColor = patterns;
    myChart.update();

gbrits avatar Dec 06 '21 13:12 gbrits