Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3fc

Package Overview
Dependencies
Maintainers
1
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3fc

A set of re-useable components for building financial charts with D3

  • 0.2.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.7K
decreased by-10.4%
Maintainers
1
Weekly downloads
 
Created
Source

d3fc Build Status

A collection of components that make it easy to build interactive financial charts with D3.

Installation

d3fc and its dependencies (D3, css-layout) are available via npm. Simply install as follows:

npm install d3fc

Once installed, you can reference the d3fc JavaScript, CSS and dependencies within an HTML page as follows:

<script src="node_modules/d3fc/node_modules/d3/d3.js"></script>
<script src="node_modules/d3fc/node_modules/css-layout/src/Layout.js"></script>
<script src="node_modules/d3fc/dist/d3fc.js"></script>

<link href="node_modules/d3-financial-components/dist/d3fc.css" rel="stylesheet"/>

If you want a quick verification that everything has installed correctly, the following code will render a simple time series chart:

<div id="chart"></div>
<script type="text/javascript">
var data = fc.dataGenerator()(50);

var chart = fc.charts.linearTimeSeries()
    .xDomain(fc.utilities.extent(data, 'date'))
    .xTicks(5)
    .yDomain(fc.utilities.extent(data, ['high', 'low']))
    .yNice()
    .yTicks(5);

var gridlines = fc.scale.gridlines();
var candlestick = fc.series.candlestick();
var movingAverage = fc.indicators.movingAverage();

var multi = fc.series.multi()
    .series([gridlines, candlestick, movingAverage]);
chart.plotArea(multi);

d3.select("#chart")
    .append('svg')
    .style({
        height: '250px',
        width: '600px'
    })
    .datum(data)
    .call(chart);

</script>

To find out more about the various components, visit the project webpage.

Developing

npm, the package manager for Node.js, is used to manage the project's dependencies. Grunt, a JavaScript task runner, is used to test and build the project.

Initial Setup

  • Download or clone this repository locally
  • Ensure Node.js, which includes npm, is installed
  • Ensure Grunt is installed:
npm install -g grunt-cli
  • Navigate to the root of your local copy of this project and install the dependencies:
npm install
  • Perform an initial build:
grunt

Grunt Tasks

The following Grunt tasks, found in Gruntfile.js, can be run from the command line. The most commonly used tasks to build and develop the project are:

  • grunt build - generate the project's JavaScript and CSS files in the dist directory (at the root of the project); build the visual tests
  • grunt dev - run grunt build, then grunt watch
  • grunt dev:serve - same as grunt dev but also starts a web server for viewing the visual tests

Other tasks include:

  • grunt check - run JSHint and JSCS checks
  • grunt test - run unit tests and build the visual tests
  • grunt watch - watch the source files and rebuild when a change is saved
  • grunt serve - start a web server for viewing the visual tests
  • grunt - check, test and build the project

Visual Tests

The project includes a number of unit tests, however, because these components are visual in nature, unit testing is not enough. This project contains a number of ad-hoc visual tests that are found within the visual-tests folder. The visual tests are compiled, via assemble, to create a simple website. To view this site, run grunt serve or a static server from the visual-tests\dist folder.

License

These components are licensed under the MIT License.

Keywords

FAQs

Package last updated on 21 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc