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

vue-chartmaker

v1.4.4

Published

A Vue.JS Component for creating Charts in HTML and CSS

Downloads

137

Readme

vue-chartmaker

A Vue.JS Component for making chart in HTML and CSS

Installation

In your terminal / powershell, within your project folder, run the following command :

npm install vue-chartmaker --save

In order to use the library, you must import it in your <script></script>, in your .vue files:

<script>
    import ChartMaker from 'vue-chartmaker'

    export default {
        name: 'YourComponentName',
        components: {
            ChartMaker
        },
        data: function() {
            return {
                params: {
                    /* Your params ... */
                }
            }
        }
    }
</script>

To use it in your template, you can include it like any components :

<template>
    <div>
        <chart-maker v-bind:params="params">
            <!-- Your code ... -->
        </chart-maker>
    </div>
</template>

Common Params

The component 'ChartMaker' accepts an object as 'params' attribute.
The following properties are common for every charts :

  1. 'id' (mandatory) : The id of the graph. It will be prefixed by 'vue-chartmaker-chart-'.
  2. 'title' (optional) : The title of the graph. It will be display in a Bootstrap Jumbotron at the top of the chart.
  3. 'description' (optional): A little description of the graph. It will be display like a descriptive text at the bottom of the chart.
  4. 'type' (mandatory) : The type of the graph. At the moment, it could be : 'pie' or 'bar'.

Bar Chart

For 'Bar' charts, a property 'xMax' must also be specified in order to fix a size to the graph.
Here is an example of an object to be pass to 'ChartMaker' component :

const params = {
    id: "loading-time",
    title: "Loading time",
    description: "Loading time of all css files in milliseconds",
    type: 'bar',
    xMax: 100
}

In order to add data, we must use <tr>, <th> and <td> within the <chart-maker></chart-maker> tags.
You can find a example below :

<!-- Your code ... -->
<chart-maker v-bind:params="params">
    <tr>
        <th scope="row">style.css</th> <!-- Here is the label of the row -->
        <td style="--value: 12;"> <!-- Here is the value of the row, which will be use to create the chart -->
            <span>12&nbsp;ms</span> <!-- Here is the value label of the row, which will be diplay to the user -->
        </td>
    </tr>
    <tr>
        <th scope="row">chart.css</th>
        <td style="--value: 42;">
            <span>42&nbsp;ms</span>
        </td>
    </tr>
</chart-maker>
<!-- Your code ... -->

Pie Chart

For 'Pie' charts, there is no more property to define than the common ones.
Here is the 'params' object :

const params = {
    id: "loading-time-pie",
    title: "Loading time",
    description: "Loading time of all css files in milliseconds",
    type: 'pie'
}

Like bar's charts, we must use tags like <tr>, <th> and <td>. Here is an example :

<!-- Your code ... -->
<chart-maker v-bind:params="params">
    <tr style="--color: #734BF9"> <!-- YOU must specify the color for the pie -->
        <th scope="row">style.css</th> <!-- The data's label -->
        <td :style="'--value: 27;'"> <!-- The value IN PERCENT -->
            12&nbsp;ms <!-- The value label to be displayed in the legend -->
        </td>
    </tr>
    <tr style="--color: #E11A81">
        <th scope="row">charts.css</th>
        <td :style="'--value: 73;'">
            42&nbsp;ms
        </td>
    </tr>
</chart-maker>
<!-- Your code ... -->