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

vuesalize

v2.1.9

Published

Component library dedicated to simplifying interactive visualization building in Vue.js 3.

Downloads

226

Readme

Vuesalize

Visit our interactive docs page!

What's the point?

Building interactive visualizations on the web can be hard, and it can be even harder when you would like to leverage existing visualization libraries inside a Vue.js project. The goal of Vuesalize is to simplify this process by providing a set of chart components (and a couple other components) that are commonly used in building interactive visualizations on the web. The charts are built using a combination of Vue.js and D3.js. The main rationale for this approach is to fully embrace the Vue paradigm and move the SVG definitions to the template (HTML), which allows Vue to handle creating and removing elements on the page. This is analogous to the "enter/update/exit" strategy used in D3 but specifically taking advantage of the virtual DOM. By building charts where the SVG is defined in Vue's template, we can not only send down props to update the chart, but can also emit events on interactions (e.g. click, mousover, etc.) and offer scoped slots for custom tooltips!

Installation

::: warning Starting with version 1.0.1, Vuesalize will only support Vue 3. If you'd like to use Vuesalize with Vue 2, use the last available version 0.2.0. :::

The library is currently available on npm, and it is possible to use it with Vue CLI (recommended) or directly with the CDN version in a <script> tag.

Vue CLI

The steps to use is it in a project created using the Vue CLI are as follows:

  1. Install from npm using npm install vuesalize
  2. In main.js, import the Vuesalize plugin and install it using use(). Here is an example below for a project
import { createApp } from 'vue'
import App from './App.vue'

import 'vuesalize/dist/vuesalize.css'
import Vuesalize from 'vuesalize'

createApp(App).use(Vuesalize).mount('#app')
  1. Start using the components in templates. For example, if the StackedBarChart and LoaderSpinning components were going to be used in a default App.vue file, this is how it would be setup:
<script setup>
const barchartdata = [
    {"date": 2019, "Utilities": 21, "Rent": 16, "Insurance": 22},
    {"date": 2020, "Utilities": 19, "Rent": 10, "Insurance": 17},
]
</script>

<template>
    <loader-spinning/>
    <StackedBarChart :plot-data="barchartdata" x-key="date"></StackedBarChart>
</template>

<style scoped></style>

CDN

It is quite simple to get started with the CDN. The vuesalize javascript and css files need to be linked (lines 5 and 7 below). Then after creating an app instance app = createApp({...}), you can call app.use(Vuesalize) to install the plugin. As with other packages, it is also necessary to link the official Vue 3 package (line 6) before vuesalize.

<html lang="en">
<head>
   <meta charset="utf-8">
   <title>Browser test</title>
    <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/vuesalize.css">
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/vuesalize.umd.js"></script>
</head>
<body>
<div id="app">
   <loader-spinning></loader-spinning>
   <stacked-bar-chart :plot-data="barchartdata" x-key="date"></stacked-bar-chart>
</div>

<script>
    const {createApp} = Vue

    const app = createApp({
        data() {
            return {
                barchartdata: [
                    {"date": 2019, "Utilities": 21, "Rent": 16, "Insurance": 22},
                    {"date": 2020, "Utilities": 19, "Rent": 10, "Insurance": 17},
                ]
            }
        }
    })

    app.use(Vuesalize)

    app.mount('#app')

</script>
</body>
</html>

Examples of how each of the chart components can be used can be found in the sections below. Additionally, the SFC component templates can be retrieved from github