Giter Club home page Giter Club logo

dailychart's Introduction

Dailychart.js

npm Travis (.org)

Dailychart.js is a tiny standalone SVG charting library to display daily graph of a stock market security. Try the demo.

Installation

The simplest way is to include the library file from CDN:

<script src='https://unpkg.com/dailychart/dist/dailychart.min.js'></script>

It's also possible to install the package as a dependency from NPM

npm install dailychart --save

then include the library into your project:

var Dailychart = require('dailychart');

Usage

First, create a container for the chart and fill with data using attributes.

  • data-dailychart-values (required) - comma-separated values for the chart.
  • data-dailychart-close - the value splits the chart on two areas (positive, negative) with its own colors.
  • data-dailychart-length - the total number of data points. Used to scale the chart along the horizontal axis. If data-dailychart-values has fewer points the remaining space will be empty. On the other hand, if data-dailychart-length isn't defined the chart will fit the container.
<div id="chart"
     data-dailychart-values="12.94,13.0,12.98,13.02,13.0,13.0,12.95,12.85,13.04,13.13"
     data-dailychart-close="13.08"
     data-dailychart-length="78">
</div>

Optionally apply CSS to the container.

#chart {
  width: 80px;
  height: 30px;
}

Finally, create the chart for the element.

Dailychart.create('#chart', { lineWidth: 2 });

The first parameter can be a HTML element, a list of HTML elements or a CSS selector string.

Configuration

The second parameter of the constructor is an object that contains the number of options to control the appearance of the chart.

  • width - Chart width. If not set it equals to container's width.
  • height - Chart height. If not set it equals to container's height.
  • lineWidth - Line width of the graph (default: 1).
  • colorPositive - Color of the positive part of the graph (default: '#33AE45').
  • colorNegative - Color of the negative part of the graph (default: '#EB5757').
  • fillPositive - Fill color of the positive area (default: '').
  • fillNegative - Fill color of the negative area (default: '').
  • closeWidth - Width of the close line (default: 1).
  • closeColor - Color of the close line (default: '#e0e0e0').

License

Dailychart.js is available under the MIT License.

dailychart's People

Contributors

greenkeeper[bot] avatar kbychkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dailychart's Issues

Use stroke line of area instead of extra path object

The objects pathPositive (l. 117) and pathNegative (l. 122) are obsolete if you use the native stroke line.

Replace
Line 119: const areaPositive = this.pathElement(dPositive, lineWidth, colorPositive, fillPositive, idPositive);
Line 124: const areaNegative = this.pathElement(dNegative, lineWidth, colorNegative, fillNegative, idNegative);

Dailychart in Nuxt3 - VUE3

Hi !

Thanks for your project, is it possible to convert DailyChart as an ES modules ?

I'm currently facing this issue when i want to use it on my project

[nuxt] [request error] Cannot set properties of undefined (setting 'Dailychart')

Have a nice day

An in-range update of babel7 is breaking the build 🚨

There have been updates to the babel7 monorepo:

    • The devDependency @babel/core was updated from 7.7.7 to 7.8.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.

babel7 is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Chart not visible when data contains the equal values

For example

<div data-dailychart="" data-dailychart-values="104.74,104.74,104.74,104.74,104.74,104.74,104.74,104.74,104.74,104.74,104.74,104.74,104.74,104.74,104.74,104.74,104.74,104.74" data-dailychart-close="104.740000" data-dailychart-length="129"></div>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.