All Projects → larskarbo → Napchart

larskarbo / Napchart

Licence: gpl-3.0
Drag-and-drop time-planning library using HTML5 and the canvas element

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Napchart

Schedule
Schedule is a package that helps tracking schedules for your models. If you have workers in a company, you can set schedules for them and see their availability though the time.
Stars: ✭ 155 (+20.16%)
Mutual labels:  schedule, time
crystime
Advanced time, calendar, schedule, and remind library for Crystal
Stars: ✭ 23 (-82.17%)
Mutual labels:  time, schedule
Period
Complex period comparisons
Stars: ✭ 1,001 (+675.97%)
Mutual labels:  schedule, time
Calendar
📅 PHP Date & Time library that solves common problems in object oriented, immutable way.
Stars: ✭ 113 (-12.4%)
Mutual labels:  time
Human time
Ruby time and date comparisons for humans
Stars: ✭ 113 (-12.4%)
Mutual labels:  time
Workq
Job server in Go
Stars: ✭ 1,546 (+1098.45%)
Mutual labels:  schedule
Moment Range
Fancy date ranges for Moment.js
Stars: ✭ 1,639 (+1170.54%)
Mutual labels:  time
Timesincetextview
Android TextView for displaying the time since a date
Stars: ✭ 108 (-16.28%)
Mutual labels:  time
Hickory
🕰 The command line tool for scheduling Python scripts
Stars: ✭ 126 (-2.33%)
Mutual labels:  schedule
Chrono
Date and time library for Rust
Stars: ✭ 1,780 (+1279.84%)
Mutual labels:  time
Date Fns Timezone
Parsing and formatting date strings using IANA time zones for date-fns.
Stars: ✭ 118 (-8.53%)
Mutual labels:  time
Use Timer
A timer hook for React
Stars: ✭ 113 (-12.4%)
Mutual labels:  time
Lora Serialization
LoraWAN serialization/deserialization library for The Things Network
Stars: ✭ 120 (-6.98%)
Mutual labels:  time
Time
time是一个for typecho相册模板
Stars: ✭ 112 (-13.18%)
Mutual labels:  time
As Duration
Extraction of ActiveSupport::Duration from Rails
Stars: ✭ 126 (-2.33%)
Mutual labels:  time
Vue Schedule Calendar
日程调度日历。
Stars: ✭ 110 (-14.73%)
Mutual labels:  schedule
Ruby Duration
Immutable type that represents some amount of time with accuracy in seconds.
Stars: ✭ 122 (-5.43%)
Mutual labels:  time
React Timer Hook
React timer hook
Stars: ✭ 118 (-8.53%)
Mutual labels:  time
Hms
A simple class for storing time-of-day values
Stars: ✭ 117 (-9.3%)
Mutual labels:  time
Dateutil
Useful extensions to the standard Python datetime features
Stars: ✭ 1,706 (+1222.48%)
Mutual labels:  time

Napchart

npm version

Drag-and-drop time-planning library using HTML5 and the canvas element. Used by napchart.com

enter image description here

Installation

You can download the latest version of Napchart from the GitHub releases

To install via npm:

npm install napchart --save

Create a Chart

It is easy to create a Napchart on your page. All you need is a canvas element, a resizer div and some javascript code

<div style="width:400px;height:400px">
	<canvas id="myNapchart"></canvas>
</div>
<script>
var ctx = document.getElementById("myNapchart").getContext('2d')
var myNapchart = Napchart.init(ctx, {
	// data goes here
	elements: [{
		"start":720,
		"end": 790,
		"text": "Cool text"
	},{
		"start":1420,
		"end":400
	}]
}, {
	// options go here
)
</script>

Data

The second data parameter of napchart.init defines what data should initially be drawn to the napchart. The structure is simple like this

var defaultData = {
  elements: [],
  shape: 'circle',
  lanes: 1,
  colorTags,
}

You don't need to specify shape or lanes if you don't want to. If you don't specify anything at all it will start with a blank napchart

Elements

Elements are structured like this

var element = {
  start: Number, // between 0 and 1440
  end: Number, // between 0 and 1440
  lane: Number || 0, // must not be higher or equal to chart.data.lanes
  text: String || '',
  color: Color || chart.config.defaultColor // string (red, blue...) or hex (#ffffff)
  id: Number, // automatically generated
}

Shape

String that defines which shape you want

string = 'circle' || 'wide' || 'line

Lanes

Number of how many lanes you want. Max 4 recommended

ColorTags

Array with objects that connects a color with a text string (tag). This replaces types from previous versions of napchart

colorTags = [
  { color: 'red', tag: 'Sleep'},
  ...
]

Options

The third parameter of napchart.init is an object where you can specify options. Here are the defaults

{
	interaction: true,
	penMode: true,
	background: 'transparent',
	fontColor: '#aaaaaa'
}

Contributing

See CONTRIBUTING.md for a sweet introduction to the code-base

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].