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

dojichart

v0.6.1

Published

Candlestick charts using the canvas element

Downloads

2

Readme

DojiChart

DojiChart is a JavaScript library for displaying candlestick charts and technical indicators using the canvas element.

Install

npm install dojichart

Features

  • Multiple chart panels - A DojiChart instance comprises multiple chart panels, for example, a separate volume panel can be associated with a price chart panel.

  • Layers - A chart panel has layers, for example a candlestick layer and moving average layer.

  • Responsive - Charts are responsive, such that they expand or contract to fit their container's width.

  • Size and spacing - The width of candlesticks and their intervals can be changed on the fly - this is equivalent to zooming.

  • Scrolling - Charts can be scrolled forward and backward, either one bar at a time or by a specific number of time intervals.

  • Grid lines and labels - Each chart panel can optionally have value and time grid lines and labels, which can be set to appear at specified granularity or automatically.

  • Crosshair - A crosshair, implemented as a layer is rendered over each chart panel and reacts to mousemove events.

  • Events - Click events on candlesticks is implemented and can be extended to cover other interaction events, such as touch and drag.

Usage

Include the DojiChart CSS and JavaScript in the head of your HTML document:

<link rel="stylesheet" href="dojichart.min.css">
<script type="text/javascript" src="dojichart.min.js"></script>

Provide an HTML container element:

<div class="dojichart" id="mychart">
  <div class="region" data-name="price"></div>
</div>

Instantiate the DojiChart instance, create a panel, add a layer and load some data:

var dojichart = new DojiChart.core.Chart(document.getElementById('mychart'), {
  fieldMap: {
    time: 't',
    open: 'o',
    high: 'h',
    low: 'l',
    close: 'c'
  }
});

// Create a chart panel with a candlestick chart layer
var price_chart_panel = new DojiChart.panel.TimeValuePanel({
  primaryLayer: new DojiChart.layer.CandleLayer(),
  height: 200
});

// Render the panel in the region named 'price'
dojichart.addComponent('price', price_chart_panel);

// Dummy data
var data_arr = [
  {'t':'2015-11-11T17:25:00.000000Z','o':4672.3,'h':4675.3,'l':4671.0,'c':4671.4},
  {'t':'2015-11-11T17:30:00.000000Z','o':4671.5,'h':4675.1,'l':4671.3,'c':4674.5},
  {'t':'2015-11-11T17:35:00.000000Z','o':4674.5,'h':4678.6,'l':4674.5,'c':4676.2},
  {'t':'2015-11-11T17:40:00.000000Z','o':4676.0,'h':4677.3,'l':4674.5,'c':4674.9},
  {'t':'2015-11-11T17:45:00.000000Z','o':4674.7,'h':4676.2,'l':4673.2,'c':4673.3}
];

// Load data
dojichart.loadData(data_arr, 'EURUSD', 'M5');

License

DojiChart is made available via the GNU General Public License version 3 (GPLv3). You are required to release the source code of any program that you distribute that uses DojiChart. If you would like to use the DojiChart source as part of commercial software or do not want disclose your source code, please get in contact.