| 21627 |
kshitij.so |
1 |
# Morris.js - pretty time-series line graphs
|
|
|
2 |
|
|
|
3 |
[](http://travis-ci.org/oesmith/morris.js)
|
|
|
4 |
|
|
|
5 |
Morris.js is the library that powers the graphs on http://howmanyleft.co.uk/.
|
|
|
6 |
It's a very simple API for drawing line, bar, area and donut charts.
|
|
|
7 |
|
|
|
8 |
Cheers!
|
|
|
9 |
|
|
|
10 |
\- Olly (olly@oesmith.co.uk)
|
|
|
11 |
|
|
|
12 |
## Requirements
|
|
|
13 |
|
|
|
14 |
- [jQuery](http://jquery.com/) (>= 1.7 recommended, but it'll probably work with older versions)
|
|
|
15 |
- [Raphael.js](http://raphaeljs.com/) (>= 2.0)
|
|
|
16 |
|
|
|
17 |
## Usage
|
|
|
18 |
|
|
|
19 |
See [the website](http://oesmith.github.com/morris.js/).
|
|
|
20 |
|
|
|
21 |
## Development
|
|
|
22 |
|
|
|
23 |
Very daring.
|
|
|
24 |
|
|
|
25 |
Fork, hack, possibly even add some tests, then send a pull request :)
|
|
|
26 |
|
|
|
27 |
### Developer quick-start
|
|
|
28 |
|
|
|
29 |
You'll need [node.js](https://nodejs.org). I recommend using
|
|
|
30 |
[nvm](https://github.com/creationix/nvm) for installing node in
|
|
|
31 |
development environments.
|
|
|
32 |
|
|
|
33 |
With node installed, install [grunt](https://github.com/cowboy/grunt) using
|
|
|
34 |
`npm install -g grunt`, and then the rest of the test/build dependencies
|
|
|
35 |
with `npm install` in the morris.js project folder.
|
|
|
36 |
|
|
|
37 |
Once you're all set up, you can compile, minify and run the tests using `grunt`.
|
|
|
38 |
|
|
|
39 |
## Changelog
|
|
|
40 |
|
|
|
41 |
### 0.4.3 - 12th May 2013
|
|
|
42 |
|
|
|
43 |
- Fix flickering hover box [#186](https://github.com/oesmith/morris.js/issues/186)
|
|
|
44 |
- xLabelAngle option (diagonal labels!!) [#239](https://github.com/oesmith/morris.js/issues/239)
|
|
|
45 |
- Fix area chart fill bug [#190](https://github.com/oesmith/morris.js/issues/190)
|
|
|
46 |
- Make event handlers chainable
|
|
|
47 |
- gridTextFamily and gridTextWeight options
|
|
|
48 |
- Fix hovers with setData [#213](https://github.com/oesmith/morris.js/issues/213)
|
|
|
49 |
- Fix hideHover behaviour [#236](https://github.com/oesmith/morris.js/issues/236)
|
|
|
50 |
|
|
|
51 |
### 0.4.2 - 14th April 2013
|
|
|
52 |
|
|
|
53 |
- Fix DST handling [#191](https://github.com/oesmith/morris.js/issues/191)
|
|
|
54 |
- Parse data values from strings in Morris.Donut [#189](https://github.com/oesmith/morris.js/issues/189)
|
|
|
55 |
- Non-cumulative area charts [#199](https://github.com/oesmith/morris.js/issues/199)
|
|
|
56 |
- Round Y-axis labels to significant numbers [#162](https://github.com/oesmith/morris.js/162)
|
|
|
57 |
- Customising default hover content [#179](https://github.com/oesmith/morris.js/179)
|
|
|
58 |
|
|
|
59 |
### 0.4.1 - 8th February 2013
|
|
|
60 |
|
|
|
61 |
- Fix goal and event rendering. [#181](https://github.com/oesmith/morris.js/issues/181)
|
|
|
62 |
- Don't break when empty data is passed to setData [#142](https://github.com/oesmith/morris.js/issues/142)
|
|
|
63 |
- labelColor option for donuts [#159](https://github.com/oesmith/morris.js/issues/159)
|
|
|
64 |
|
|
|
65 |
### 0.4.0 - 26th January 2013
|
|
|
66 |
|
|
|
67 |
- Goals and events [#103](https://github.com/oesmith/morris.js/issues/103).
|
|
|
68 |
- Bower package manager metadata.
|
|
|
69 |
- More flexible formatters [#107](https://github.com/oesmith/morris.js/issues/107).
|
|
|
70 |
- Color callbacks.
|
|
|
71 |
- Decade intervals for time-axis labels.
|
|
|
72 |
- Non-continous line tweaks [#116](https://github.com/oesmith/morris.js/issues/116).
|
|
|
73 |
- Stacked bars [#120](https://github.com/oesmith/morris.js/issues/120).
|
|
|
74 |
- HTML hover [#134](https://github.com/oesmith/morris.js/issues/134).
|
|
|
75 |
- yLabelFormat [#139](https://github.com/oesmith/morris.js/issues/139).
|
|
|
76 |
- Disable axes [#114](https://github.com/oesmith/morris.js/issues/114).
|
|
|
77 |
|
|
|
78 |
### 0.3.3 - 1st November 2012
|
|
|
79 |
|
|
|
80 |
- **Bar charts!** [#101](https://github.com/oesmith/morris.js/issues/101).
|
|
|
81 |
|
|
|
82 |
### 0.3.2 - 28th October 2012
|
|
|
83 |
|
|
|
84 |
- **Area charts!** [#47](https://github.com/oesmith/morris.js/issues/47).
|
|
|
85 |
- Some major refactoring and test suite improvements.
|
|
|
86 |
- Set smooth parameter per series [#91](https://github.com/oesmith/morris.js/issues/91).
|
|
|
87 |
- Custom dateFormat for string x-values [#90](https://github.com/oesmith/morris.js/issues/90).
|
|
|
88 |
|
|
|
89 |
### 0.3.1 - 13th October 2012
|
|
|
90 |
|
|
|
91 |
- Add `formatter` option for customising value labels in donuts [#75](https://github.com/oesmith/morris.js/issues/75).
|
|
|
92 |
- Cycle `lineColors` on line charts to avoid running out of colours [#78](https://github.com/oesmith/morris.js/issues/78).
|
|
|
93 |
- Add method to select donut segments. [#79](https://github.com/oesmith/morris.js/issues/79).
|
|
|
94 |
- Don't go negative on yMin when all y values are zero. [#80](https://github.com/oesmith/morris.js/issues/80).
|
|
|
95 |
- Don't sort data when parseTime is false [#83](https://github.com/oesmith/morris.js/issues/83).
|
|
|
96 |
- Customise styling for points. [#87](https://github.com/oesmith/morris.js/issues/87).
|
|
|
97 |
|
|
|
98 |
### 0.3.0 - 15th September 2012
|
|
|
99 |
|
|
|
100 |
- Donut charts!
|
|
|
101 |
- Bugfix: ymin/ymax bug [#71](https://github.com/oesmith/morris.js/issues/71).
|
|
|
102 |
- Bugfix: infinite loop when data indicates horizontal line [#66](https://github.com/oesmith/morris.js/issues/66).
|
|
|
103 |
|
|
|
104 |
### 0.2.10 - 26th June 2012
|
|
|
105 |
|
|
|
106 |
- Support for decimal labels on y-axis [#58](https://github.com/oesmith/morris.js/issues/58).
|
|
|
107 |
- Better axis label clipping [#63](https://github.com/oesmith/morris.js/issues/63).
|
|
|
108 |
- Redraw graphs with updated data using `setData` method [#64](https://github.com/oesmith/morris.js/issues/64).
|
|
|
109 |
- Bugfix: series with zero or one non-null values [#65](https://github.com/oesmith/morris.js/issues/65).
|
|
|
110 |
|
|
|
111 |
### 0.2.9 - 15th May 2012
|
|
|
112 |
|
|
|
113 |
- Bugfix: Fix zero-value regression
|
|
|
114 |
- Bugfix: Don't modify user-supplied data
|
|
|
115 |
|
|
|
116 |
### 0.2.8 - 10th May 2012
|
|
|
117 |
|
|
|
118 |
- Customising x-axis labels with `xLabelFormat` option
|
|
|
119 |
- Only use timezones when timezone info is specified
|
|
|
120 |
- Fix old IE bugs (mostly in examples!)
|
|
|
121 |
- Added `preunits` and `postunits` options
|
|
|
122 |
- Better non-continuous series data support
|
|
|
123 |
|
|
|
124 |
### 0.2.7 - 2nd April 2012
|
|
|
125 |
|
|
|
126 |
- Added `xLabels` option
|
|
|
127 |
- Refactored x-axis labelling
|
|
|
128 |
- Better ISO date support
|
|
|
129 |
- Fix bug with single value in non time-series graphs
|
|
|
130 |
|
|
|
131 |
### 0.2.6 - 18th March 2012
|
|
|
132 |
|
|
|
133 |
- Partial series support (see `null` y-values in `examples/quarters.html`)
|
|
|
134 |
- `parseTime` option bugfix for non-time-series data
|
|
|
135 |
|
|
|
136 |
### 0.2.5 - 15th March 2012
|
|
|
137 |
|
|
|
138 |
- Raw millisecond timestamp support (with `dateFormat` option)
|
|
|
139 |
- YYYY-MM-DD HH:MM[:SS[.SSS]] date support
|
|
|
140 |
- Decimal number labels
|
|
|
141 |
|
|
|
142 |
### 0.2.4 - 8th March 2012
|
|
|
143 |
|
|
|
144 |
- Negative y-values support
|
|
|
145 |
- `ymin` option
|
|
|
146 |
- `units` options
|
|
|
147 |
|
|
|
148 |
### 0.2.3 - 6th Mar 2012
|
|
|
149 |
|
|
|
150 |
- jQuery no-conflict compatibility
|
|
|
151 |
- Support ISO week-number dates
|
|
|
152 |
- Optionally hide hover on mouseout (`hideHover`)
|
|
|
153 |
- Optionally skip parsing dates, treating X values as an equally-spaced series (`parseTime`)
|
|
|
154 |
|
|
|
155 |
### 0.2.2 - 29th Feb 2012
|
|
|
156 |
|
|
|
157 |
- Bugfix: mouseover error when options.data.length == 2
|
|
|
158 |
- Automatically sort options.data
|
|
|
159 |
|
|
|
160 |
### 0.2.1 - 28th Feb 2012
|
|
|
161 |
|
|
|
162 |
- Accept a DOM element *or* an ID in `options.element`
|
|
|
163 |
- Add `smooth` option
|
|
|
164 |
- Bugfix: clone `@default`
|
|
|
165 |
- Add `ymax` option
|
|
|
166 |
|
|
|
167 |
## License
|
|
|
168 |
|
|
|
169 |
Copyright (c) 2012, Olly Smith
|
|
|
170 |
All rights reserved.
|
|
|
171 |
|
|
|
172 |
Redistribution and use in source and binary forms, with or without
|
|
|
173 |
modification, are permitted provided that the following conditions are met:
|
|
|
174 |
|
|
|
175 |
1. Redistributions of source code must retain the above copyright notice, this
|
|
|
176 |
list of conditions and the following disclaimer.
|
|
|
177 |
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
178 |
this list of conditions and the following disclaimer in the documentation
|
|
|
179 |
and/or other materials provided with the distribution.
|
|
|
180 |
|
|
|
181 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
182 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
183 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
184 |
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
185 |
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
186 |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
187 |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
188 |
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
189 |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
190 |
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|