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

bit-c3

v0.3.0

Published

Build C3 charts with CanJS components

Downloads

13

Readme

Build Status

A live-reloading chart widget that can be loaded by:

  • StealJS + ES6
  • npm / browserify / CJS
  • RequireJS / AMD
  • Standalone with CanJS and jQuery

Install

Use NPM to install bit-c3:

npm install bit-c3 --save

Usage

See http://bitovi-components.github.io/bit-c3 for usage instructions, examples and documentation.

ES6 use

With StealJS, you can import this module directly in a template that is autorendered:

<script type="text/stache" id="demo" can-autorender>
	<can-import from="bit-c3" />
	<bit-c3>
		<bit-c3-data>
			<bit-c3-data-column key="dataSource" {value}="dataSource" />
		</bit-c3-data>
	</bit-c3>
</script>

<script src='./node_modules/steal/steal.js'
	main="can/view/autorender/">

	import canViewModel from "can-view-model";
	import DefineList from "can-define/list/list";

	canViewModel(document.getElementById('demo')).set({
		dataSource: new DefineList([1, 2, 3])
	});
</script>

Alternatively, you can import this module like:

import "bit-c3";
import $ from "jquery";
import stache from "can-stache";
import DefineList from "can-define/list/list";

var template = stache('<bit-c3>' +
	'<bit-c3-data>' +
		'<bit-c3-data-column key="dataSource" value="{dataSource}" />' +
	'</bit-c3-data>' +
'</bit-c3>');

$("body").append(template({
	dataSource: new DefineList([1, 2, 3])
}));

CJS use

Use require to load bit-c3 and everything else needed to create a template that uses bit-c3:

var $ = require("jquery")

// Add's bit-c3 tag
require("bit-c3");

// Use stache and can-define
var stache = require("can-stache");
var DefineList = require("can-define/list/list");

var bitC3template = stache('<bit-c3>' +
    '<bit-c3-data>' +
        '<bit-c3-data-column key="dataSource" {value}="dataSource" />' +
    '</bit-c3-data>' +
'</bit-c3>');

$("body").append(bitC3template({
    dataSource: new DefineList([1, 2, 3])
}));

AMD use

Configure the can, jquery, c3, and d3 paths and the bit-c3s package:

<script src="require.js"></script>
<script>
	require.config({
	    paths: {
	        "jquery": "node_modules/jquery/dist/jquery",
	        "can": "node_modules/canjs/dist/amd/can"
	    },
	    packages: [{
		    	name: 'bit-c3',
		    	location: 'node_modules/bit-c3/dist/amd',
		    	main: 'bit-c3'
	    }]
	});
	require(["main-amd"], function(){});
</script>

Make sure you have the css plugin configured also!

Use bit-c3 like:

define(["can-stache", "can-define/list/list", "jquery", "bit-c3"], function(stache, DefineList, $) {
	var bitC3template = stache('<bit-c3>' +
	    '<bit-c3-data>' +
	        '<bit-c3-data-column key="dataSource" {value}="dataSource" />' +
	    '</bit-c3-data>' +
	'</bit-c3>');

	$("body").append(bitC3template({
	    dataSource: new DefineList([1, 2, 3])
	}));
});

Standalone use

Load the global css and js files:

<link rel="stylesheet" type="text/css" 
      href="./node_modules/bit-c3/dist/global/bit-c3.css" />
      
<script src='./node_modules/jquery/dist/jquery.js'></script>
<script src='./node_modules/can/dist/global/can.all.js'></script>
<script src='./node_modules/bit-c3/node_modules/d3/d3.js'></script>
<script src='./node_modules/bit-c3/node_modules/c3/c3.js'></script>
<script src='./node_modules/bit-c3/dist/global/bit-c3.js'></script>
<script id='main-stache' text='text/stache'>
	<bit-c3>
		<bit-c3-data>
			<bit-c3-data-column key="dataSource" value="{dataSource}" />
		</bit-c3-data>
	</bit-c3>
</script>
<script>
	var bitC3template = can.stache('<h2>bit-c3</h2><bit-c3>' +
	    '<bit-c3-data>' +
	        '<bit-c3-data-column key="dataSource" value="{dataSource}" />' +
	    '</bit-c3-data>' +
	'</bit-c3>');

	$("body").append(bitC3template({
	    dataSource: new can.DefineList([1, 2, 3])
	}));
</script>

Contributing

To setup your dev environment:

  1. Clone and fork this repo.
  2. Run npm install.
  3. Run grunt test. Everything should pass.
  4. Launch development server by running grunt serve.
  5. Run grunt build. Everything should build ok.

To publish:

  1. Update the version number in package.json and commit and push this.
  2. Run npm publish. This should generate the dist folder.
  3. Create and checkout a "release" branch.
  4. Run git add -f dist.
  5. Commit the addition and tag it git tag v0.2.0. Push the tag git push origin --tags.