npm install bit-c3
A live-reloading chart widget that can be loaded by:
- StealJS + ES6
- npm / browserify / CJS
- RequireJS / AMD
- Standalone with CanJS and jQuery
Use NPM to install bit-c3:
npm install bit-c3 --save
See http://bitovi-components.github.io/bit-c3 for usage instructions, examples and documentation.
With StealJS, you can import this module directly in a template that is autorendered:
``html
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])
});
`
Alternatively, you can import this module like:
`js
import "bit-c3";
import $ from "jquery";
import stache from "can-stache";
import DefineList from "can-define/list/list";
var template = stache('
'
'
'
'
$("body").append(template({
dataSource: new DefineList([1, 2, 3])
}));
`
Use require to load bit-c3 and everything elsebit-c3
needed to create a template that uses :
`js
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('
'
'
'
'
$("body").append(bitC3template({
dataSource: new DefineList([1, 2, 3])
}));
`
Configure the can, jquery, c3, and d3 paths and the bit-c3s package:
`html`
Make sure you have the css plugin configured also!
Use bit-c3 like:
`js
define(["can-stache", "can-define/list/list", "jquery", "bit-c3"], function(stache, DefineList, $) {
var bitC3template = stache('
'
'
'
'
$("body").append(bitC3template({
dataSource: new DefineList([1, 2, 3])
}));
});
`
Load the global css and js files:
`html`
href="./node_modules/bit-c3/dist/global/bit-c3.css" />
To setup your dev environment:
1. Clone and fork this repo.
2. Run npm install.grunt test
3. Run . Everything should pass.grunt serve
4. Launch development server by running .grunt build
5. Run . 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.git add -f dist
3. Create and checkout a "release" branch.
4. Run .git tag v0.2.0
5. Commit the addition and tag it . Push the tag git push origin --tags`.