Comparar commits

...

322 Commits

Autor SHA1 Mensagem Data
etimberg a62537a800 bump and build for 1.1.1 release 2016-04-05 18:27:27 -04:00
Evert Timberg 4495b63d0a Merge pull request #2220 from TAGraves/master
Fixed a bug with calculating the canvas width and height
2016-04-05 09:47:25 -04:00
Tommy Graves 75ce567d05 Fixed a bug with calculating the canvas width and height
A previous commit removing a workaround for an old Firefox bug left part
of that workaround in, and it was preventing the expected behavior of
the canvas size being equal to the offsetWidth and offsetHeight of the
canvas prior to instantiation of Chart.JS
2016-04-05 08:28:46 -04:00
Evert Timberg ae103c3d0f Merge pull request #2218 from eemikula/master
Change legendTemplates to use separate spans for text and icon.
2016-04-04 19:49:03 -04:00
Eric Mikula 1ccb100739 Change legendTemplates to use separate spans for text and icon.
This addresses the issue in #2192 without entirely reverting #886. Note that it still may cause confusing behavior for some legends: Specifically, the example on chartjs.org styles ".doughnut-legend li span" with a fixed width, and therefore both of the new spans will be impacted by this styling. However, now two spans are generated instead. %name%-legend-icon is used for the color icon, and %name%-legend-text can be used for styling the text. This should be described in release notes.
2016-04-04 18:22:25 -04:00
Evert Timberg 09efe9e6e2 Merge pull request #2214 from eemikula/master
Changing object type check to prevent errors when undefined. Fixes #2213
2016-04-03 15:33:12 -04:00
Eric Mikula 31b883f815 Changing object type check to prevent errors when undefined. Fixes #2213 2016-04-03 15:19:21 -04:00
Nick Downie ef923dfe28 Update package + built files to 1.1.0 version 2016-04-01 17:03:30 +01:00
etimberg 3f73433831 Fixes #2185
Undoes the merge of #1334
2016-03-29 19:41:13 -04:00
Evert Timberg d7117bc792 Add title of license to license file. Fixes #2097 2016-03-13 10:20:24 -04:00
Evert Timberg cf767f71a2 Merge pull request #2093 from aaron-em/angleLineInterval
Add angleLineInterval option
2016-03-13 10:09:43 -04:00
Aaron Miller 668b532fbe Add angleLineInterval option to radar chart 2016-03-13 09:59:19 -04:00
Evert Timberg 6507f5c087 Merge pull request #2118 from davidcochrum/master
Fix multi-dataset bar highlighting and bar highlight color logic
2016-03-11 13:29:30 -05:00
David Cochrum 131b18059a Update Chart.js 2016-03-11 12:21:45 -05:00
David Cochrum 48c082b04a Fix multi-dataset bar highlighting and bar highlight color logic 2016-03-11 12:19:12 -05:00
David Cochrum cf47543243 Fix multi-dataset bar highlighting and bar highlight color logic 2016-03-11 12:16:43 -05:00
Evert Timberg 3f2119526d Fix #2102 2016-03-06 19:03:03 -05:00
Evert Timberg d17c76ea1a Merge pull request #2090 from aaron-em/patch-1
Mention that 1.x is feature-complete
2016-03-02 16:24:35 -05:00
Aaron Miller af3bcd5cfe Mention that 1.x is feature-complete
It'll help would-be contributors (such as myself, see #2058) avoid creating PRs that won't be accepted.
2016-03-02 16:20:23 -05:00
Evert Timberg ea0d93c970 Merge pull request #1070 from mackuba/stop_animations
Stop animations when destroying a chart
2016-02-27 15:46:05 -05:00
Evert Timberg 43606d1faa Merge pull request #1334 from thePanz/patch-2
Fix error in generateLegend() function
2016-02-20 13:29:32 -05:00
William Entriken 6009b00f74 Merge pull request #1886 from coolbombom/patch-4
having differnt colors in one dataset
2016-02-20 13:11:16 -05:00
Derek Perkins 8d6209271b Add link to slack invite 2016-02-19 21:21:26 -07:00
Evert Timberg 57753b8280 update to new gulp and new uglify version. 2016-02-15 19:22:55 -05:00
Evert Timberg 111ada730c Fix typo in docs. Fixes #1042 2016-02-15 16:42:23 -05:00
Evert Timberg 4aa274d5b2 Default multiTooltipTemplate now shows the dataset label + updated built files. Fixes #612 2016-02-15 14:43:34 -05:00
Evert Timberg 4f4f804a71 Use a named define to fix #768 2016-02-15 14:38:11 -05:00
Evert Timberg d4917afba9 Update git ignore to make it easier to switch between branches. Add code climate config here as well. 2016-02-14 15:15:17 -05:00
etimberg 37883689ad Fixes #1144 with an update to the docs to indicate that labels are required for each point 2016-02-07 19:58:15 -05:00
etimberg cf0b550a80 Check to ensure dom node exists when calculating size. Fixes #919 2016-02-07 19:23:54 -05:00
coolbombom 3f658555ba I will try again!
had a bad effect on color that was not array .... fully tested now, is working in my solution!
2016-01-11 12:48:09 +01:00
coolbombom 1f1e6b4e44 minor update, missed a small detail sorry!!!
missed a small detail, resolved in an error, sorry!
2016-01-11 12:17:08 +01:00
coolbombom 3ac54b8790 having differnt colors in one dataset
Hi updated the bar chart so the bars can have different colors in one dataset!

cheers
c_bb
2016-01-11 12:02:32 +01:00
Evert Timberg 126e318fef Update built files 2016-01-09 10:59:52 -05:00
Evert Timberg 1d3cb8ec41 Merge pull request #1875 from michaelarnauts/master
Ignore null values when calculating scale
2016-01-09 09:40:07 -05:00
Michaël Arnauts 57bd8c7715 Ignore null values when calculating scale 2016-01-09 12:04:29 +01:00
Evert Timberg 104143672b Merge pull request #1874 from Parent5446/patch-1
Added documentation about tooltip templates
2016-01-08 23:49:32 -05:00
Tyler Romeo c5f141306f Added documentation about tooltip templates
It can be a little unclear what the actual format for tooltip templates are. Added information concerning how the tooltip templates are evaluated, and what context, i.e., variables, is available inside of them.
2016-01-08 20:02:45 -08:00
Evert Timberg 299c4b3ae1 Update readme for latest v2 beta release 2016-01-01 12:56:08 -05:00
Evert Timberg cea557849a Merge pull request #1844 from zachpanz88/patch-2
Bump copyright year in license
2015-12-31 16:41:26 -05:00
Zach Panzarino 12a35b5d7b Bump copyright year in license 2015-12-31 15:41:36 -05:00
etimberg cfa6eb1289 Update built files 2015-12-27 12:10:07 -05:00
Evert Timberg 92d4d989f5 Merge pull request #1834 from damiansilbergleithcunniff/issue-1764-default-pie-chart-colors
Issue 1764: Add default colors for Pie Charts
2015-12-27 12:08:33 -05:00
Damian Silbergleith Cunniff cebbca67d1 Choose a "better" set of 12 default colors/highlight colors for pie charts 2015-12-27 09:14:15 -07:00
Damian Silbergleith Cunniff c47e4c1da1 Change reference to index to prevent running off the end of the array 2015-12-26 15:36:15 -07:00
Damian Silbergleith Cunniff b06344563d spaces -> tabs 2015-12-26 10:04:29 -07:00
Damian Silbergleith Cunniff 77185993df fix spaces -> tabs 2015-12-26 10:01:06 -07:00
Damian Silbergleith Cunniff fd2344dd5f Update the docs to reflect the new feature 2015-12-26 09:47:59 -07:00
Damian Silbergleith Cunniff e949edacf5 Update the pie chart to use the default color/highlight if none is specified 2015-12-26 09:41:31 -07:00
Damian Silbergleith Cunniff a868a2f61e Add default global values for Color and Highlight color 2015-12-26 09:34:43 -07:00
Evert Timberg ee6aabaffc Merge pull request #1302 from jantimon/master
More robust in-between arc calculation see #1301
2015-12-25 17:44:26 -05:00
Evert Timberg 69695235ac Merge pull request #1771 from ryoon/recent-firefox
Remove Firefox workaround
2015-12-25 13:39:21 -05:00
Evert Timberg 5cdd7a0893 Merge pull request #1141 from kirkstrobeck/gulp-watch
Add livereload to Gulp  task
2015-12-24 23:17:29 -05:00
Evert Timberg f63debe2c7 Merge pull request #1040 from dima117/master
fix multiTooltip appearance with empty title
2015-12-24 21:50:18 -05:00
William Entriken 3c6a736413 Merge pull request #1192 from kkirsche/patch-1
Remove moot `version` property from bower.json
2015-12-21 16:05:38 -05:00
Ryo ONODERA e94bd460a7 Remove Firefox workaround
The workaround for older Firefox should be removed, because latest
supported Firefox 38.4.0/42.0 do not require it.
And it has side effect like #1198 or my problem on Kintone on cybozu.com.
2015-12-12 09:00:12 +09:00
Evert Timberg 4297672424 Merge pull request #1092 from tannerlinsley/negative-arcs-fix
Only draw positive radius arcs Fixes #592
2015-11-16 21:17:46 -05:00
William Entriken 07aa9473f1 Typo: consistent capitalization 2015-11-16 18:11:22 -05:00
Jake 2e9c3d3109 Merge pull request #1621 from jakesyl/add-composer
Add Composer file
2015-11-08 14:37:41 -05:00
Jake a5e382ab8a add composer file
add composer file
2015-11-05 13:36:04 -05:00
Jake 4476c698c5 Merge pull request #1589 from zachpanz88/patch-1
Change license link
2015-11-04 13:07:25 -05:00
Evert Timberg 257da76b4c Merge pull request #1190 from Nek-/patch-1
Added ignore section
2015-11-01 17:16:22 -05:00
Evert Timberg a169e5ad41 Merge pull request #1262 from mattclegg/master
Call onAnimationComplete when reached last frame
2015-11-01 17:11:24 -05:00
Zach Panzarino 682545e1e3 Change license link
The link to the license now points to the direct license that applies for chart.js, rather than a generic MIT license
2015-10-28 21:22:41 -04:00
Tanner Linsley 69e886ad5b Update README.md 2015-10-26 12:44:48 -06:00
Tanner Linsley 249ca0cef7 Update README.md 2015-10-26 12:43:50 -06:00
Tanner Linsley f1a3fb2361 Merge pull request #1577 from yanarchy/patch-1
Add npm info to getting started doc.
2015-10-26 12:42:54 -06:00
Yan Fan b87106c181 Add npm info to getting started doc. 2015-10-26 11:41:01 -07:00
Tanner Linsley b4856d2e24 Update README.md 2015-10-24 18:07:26 -06:00
Tanner Linsley a68c53cf1e Update README.md 2015-10-24 18:06:59 -06:00
Tanner Linsley 891bd63ac7 Update README.md 2015-10-24 18:06:36 -06:00
Tanner Linsley 70b437b41a Update README.md 2015-10-24 18:05:24 -06:00
Tanner Linsley 07b1758c2e Update README.md 2015-10-24 17:56:28 -06:00
Tanner Linsley 55235ef03c Update README.md 2015-10-24 17:55:34 -06:00
Tanner Linsley dfdd865508 Update README.md 2015-10-24 17:43:51 -06:00
Tanner Linsley c11145bb2d Update README.md 2015-10-24 17:37:18 -06:00
Tanner Linsley 9c39d47bc7 Update README.md 2015-10-24 17:26:10 -06:00
Tanner Linsley 0510ba4139 Update README.md 2015-09-30 12:06:26 -06:00
Tanner Linsley 85e6d1ae71 Added Current 2.0 release to Readme 2015-09-30 11:59:09 -06:00
Tanner Linsley 322abd4361 Merge pull request #1476 from nnnick/v1.0-readme-update
Update v1.x readme to reflect release status
2015-09-24 22:34:00 -06:00
Tanner Linsley f992ddd0d7 Update README.md 2015-09-24 22:33:05 -06:00
Tanner Linsley 407eb846d0 Update v1.x readme to reflect release status 2015-09-21 14:28:10 -06:00
Evert Timberg dd4a67e85c Merge pull request #1067 from rvaidya/master
Added a scaleBackgroundColors configuration option for radar charts, to...
2015-09-17 17:28:00 -04:00
Evert Timberg 7fcd4dcae8 Merge pull request #1450 from nlzet/fix-legend-template-doc
Fix span closed before appending the label
2015-09-14 18:44:04 -04:00
NLZ13 8481811110 Fix span closed before appending the label 2015-09-13 00:33:51 +02:00
Evert Timberg c38e852b61 Merge pull request #1449 from bgvianyc/master
adding template language reference to docs
2015-09-12 11:10:40 -04:00
Barry Gitarts b601e2c2a1 adding template language reference to docs 2015-09-12 09:02:26 -04:00
Evert Timberg b41ba24fff Merge pull request #1439 from bengesoff/patch-2
fixed very small typo
2015-09-04 13:49:49 -04:00
Ben Gesoff 8983929f18 fixed very small typo
wrong it's
2015-09-04 17:08:58 +01:00
Tanner Linsley 2fff73f9e3 Merge pull request #1397 from coolbombom/patch-3
Fix scale error before animation complete
2015-08-28 16:29:30 -06:00
Tanner Linsley 1ae2884a04 Merge pull request #1402 from hrniels/tooltip
Added tooltipTitleTemplate option.
2015-08-28 16:28:11 -06:00
Evert Timberg 2b9a575d4d Merge pull request #1389 from ericjperry/fix/datasetStroke
The datasetStroke option has been fixed for line graphs
2015-08-22 09:39:20 -04:00
Evert Timberg 41fb914952 Merge pull request #1390 from internalfx/patch-1
Closes #1309
2015-08-22 09:38:03 -04:00
Nils Asmussen a14309d95f Added tooltipTitleTemplate option. 2015-08-22 13:47:01 +02:00
coolbombom 80ba5aa1c5 error thrown
error thrown (TypeError: this.scale is undefined) if destroy is called before animation is complete, this update fix this error!
2015-08-21 10:53:52 +02:00
Internalfx ac5bf729c5 Closes #1309
Doughnut.addData() broken for index of 0 #1309
2015-08-18 18:39:11 -07:00
Eric Perry 3f77eb83b2 The datasetStroke option has been fixed for line graphs 2015-08-18 17:56:19 -04:00
Evert Timberg ac360b8dd1 Merge pull request #1382 from bengesoff/patch-1
fixed two typos
2015-08-18 10:42:11 -04:00
Ben Gesoff c276c3a974 fixed two typos
wrong it's
2015-08-17 16:37:01 +01:00
Ema Panz d7ee18372a Fix error in generateLegend() function 2015-07-25 17:32:58 +02:00
Tanner Linsley 43f19359a9 Merge pull request #1308 from eunicekokor/patch-1
Update 00-Getting-Started.md
2015-07-22 11:32:08 -06:00
Evert Timberg f56a7db8fc Merge pull request #1181 from paulmasson/master
Update CDN link
2015-07-18 08:01:29 -04:00
eunice 804fcea46a Update 00-Getting-Started.md
Closes a small issue I found while going through the documentation https://github.com/nnnick/Chart.js/issues/1307
2015-07-13 17:45:27 -07:00
Jan Nicklas 0bb3a9b024 Fix typo 2015-07-10 11:53:35 +02:00
Jan Nicklas 961fd11098 More robust in-between arc calculation see #1301 2015-07-10 11:47:48 +02:00
Evert Timberg 66cf8ab787 Merge pull request #1268 from klaemo/patch-1
add license to package.json
2015-07-01 09:04:44 -04:00
Clemens Stolle 79b02bcf26 add license to package.json
just to be a good npm citizen :)
2015-07-01 11:03:00 +02:00
mattclegg d5f1738a3f Merge branch 'master' of github.com:nnnick/Chart.js
# By Amir E. Aharoni
# Via Amir E. Aharoni (1) and Evert Timberg (1)
* 'master' of github.com:nnnick/Chart.js:
  Fix the spelling of "separate"
2015-06-30 11:13:37 +01:00
mattclegg f7e3962087 Call onAnimationComplete when reached last frame 2015-06-30 11:13:30 +01:00
Evert Timberg 1367a234ee Merge pull request #1241 from amire80/spelling
Fix the spelling of "separate"
2015-06-22 18:12:38 -04:00
Amir E. Aharoni 02616b9f17 Fix the spelling of "separate" 2015-06-23 01:01:59 +03:00
Kevin Kirsche 3d389d7c09 Remove moot version property from bower.json
Per bower/bower.json-spec@a325da3
2015-06-10 18:25:22 -04:00
Maxime Veber 28d30b4f5b Added ignore section 2015-06-10 22:32:23 +02:00
paulmasson d1cccd3546 Update CDN link 2015-06-08 16:45:47 -07:00
kirkstrobeck 8db79ae365 nnnick/Chart.js#1140: Watch sample folder 2015-05-27 18:28:45 -07:00
kirkstrobeck 8ef3aaa87d Add livereload to Gulp task 2015-05-27 18:07:01 -07:00
Evert Timberg e093fdf572 Merge pull request #1127 from leighquince/fix/radar-datasetfill-option
fix for radar chart ignoring datasetFill option
2015-05-20 17:54:17 -04:00
Leigh Quince 73b0d587ba fix for radar chart ignoring datasetFill option 2015-05-20 21:53:30 +02:00
Evert Timberg 2ce4291e98 Merge pull request #1122 from ismeta/fix-span-tag
Fixes #886 - Close span tags properly in legend generation template.
2015-05-16 08:37:38 -04:00
Vanessa Ung 598a6f3485 Fixes #886 - Close span tags properly in legend generation template. 2015-05-16 15:31:56 +10:00
Tanner Linsley b8691c9581 Revert "Merge pull request #856 from tannerlinsley/editable-chart-config"
This reverts commit a8063de6b8, reversing
changes made to 7f513b87ee.
2015-05-11 18:57:14 -06:00
Evert Timberg 4e3dd8ae3f Merge pull request #1066 from tannerlinsley/add-stacked-area
Add StackedArea chart type to community extensions
2015-05-06 20:31:27 -04:00
Evert Timberg cc57b9e581 Merge pull request #1098 from WouterSioen/fix-typo
Fix typo
2015-05-05 14:39:35 -04:00
Wouter Sioen aad966820e Fix a typo: segment vs segement
Fix typo in PolarArea

Update 04-Polar-Area-Chart.md
2015-05-05 16:31:00 +02:00
William Entriken 5443886ec3 Merge pull request #1068 from nnnick/animation-refactory
Animation refactory
2015-05-04 15:55:59 -04:00
William Entriken a8063de6b8 Merge pull request #856 from tannerlinsley/editable-chart-config
Data now editable right from chart config
2015-05-04 15:28:03 -04:00
Tanner Linsley 1df2b37bc5 Only draw positive radius arcs Fixes #592 2015-04-30 15:49:52 -06:00
William Entriken 7f513b87ee Merge pull request #952 from msmiley/patch-1
add datasetLabel for multiTooltip on dynamically-added points
2015-04-24 16:32:24 -04:00
William Entriken a3d4bc0bfe Merge pull request #851 from jtblin/master
Fix #507 - calculate container width and heigh without padding
2015-04-24 10:28:29 -04:00
Evert Timberg b5692c8534 Merge pull request #1069 from mackuba/fix_endpoint
Prevent taking vertical space for X labels more than once
2015-04-17 06:33:42 -04:00
Kuba Suder 66f7f96d4b stop animations when destroying a chart
otherwise the animation keeps updating the chart for some time after it
was supposed to be destroyed, and when the canvas might have been
already reused for a new chart
2015-04-16 22:41:53 +02:00
Kuba Suder 2e311896ad prevent taking vertical space for x labels more than once
calculateXLabelRotation() subtracts space needed for x labels from
this.endPoint, but if this block is called more than once then the space
is subtracted more than once and the chart gets smaller and smaller with
every iteration
2015-04-16 22:23:17 +02:00
Tanner Linsley 8cc5be1212 Revert changes to build 2015-04-16 13:57:27 -06:00
William Entriken b0a780822a Merge pull request #1025 from pijey/feature/offsetgridlines-linechart
Add offsetGridLines option to Line charts
2015-04-16 15:27:43 -04:00
William Entriken a932442d26 Merge branch 'chasd00-piechart-redraw-after-zero-segment-values' 2015-04-16 15:17:36 -04:00
William Entriken 889c9de779 Merge #756 Fixes #661 2015-04-16 15:17:28 -04:00
Rahul Vaidya d91c4a14e9 Decouple radar chart background colors from angle line drawing so they can be passed separately. 2015-04-16 11:36:49 -07:00
Rahul Vaidya 9eedf9adb6 For radar chart background colors, don't recalculate center offset multiple times. Verify that background color count is same as axes count. 2015-04-16 11:26:21 -07:00
Rahul Vaidya 7045fdbb5a Added a scaleBackgroundColors configuration option for Radial charts, to add a background color for each axis in the chart. 2015-04-16 09:22:31 -07:00
Tanner Linsley e69aa04918 Add StackedArea chart type to community extensions 2015-04-16 00:50:08 -06:00
Nick Downie c7f52f516c Derped HTML attributes. 2015-04-13 16:35:14 +01:00
Nick Downie 8c641d21d8 Merge pull request #1062 from dima117/patch-1
Update 06-Advanced.md
2015-04-13 16:32:41 +01:00
dima117 9605409838 Update 06-Advanced.md
https://github.com/nnnick/Chart.js/issues/1060
2015-04-13 15:39:44 +03:00
Evert Timberg 604d6bd4e3 Merge pull request #677 from rylanhalteman/fix-yLabel-padding
add 10 to yLabelWidth on set, rather than on use
2015-04-12 08:06:23 -04:00
Tanner Linsley 14f4fae786 Only start digest on first request. Cleanup 2015-04-12 00:05:31 -06:00
Evert Timberg c476db0dd7 Use findNextWhere correctly. 2015-04-11 23:05:05 -04:00
Evert Timberg 0a5f92a854 Remove the minAnimationSteps option since we did not end up needing it. 2015-04-11 21:11:49 -04:00
Evert Timberg b1cbf04f25 Remove the unused lastTimeRun from the animation service 2015-04-11 20:47:35 -04:00
Tanner Linsley 70b8bf106c Always execute last frame 2015-04-11 18:42:11 -06:00
Tanner Linsley 99bf85e913 Merge remote-tracking branch 'origin/animation-refactory' into animation-refactory
Conflicts:
	src/Chart.Core.js
2015-04-11 18:37:01 -06:00
Tanner Linsley e0c208be58 Frame Dropper 2015-04-11 18:34:06 -06:00
Evert Timberg 26eca23706 Implement cancel animation frame in the animation service 2015-04-11 20:17:46 -04:00
Evert Timberg 98253fea5d Fix some bugs in the animation stuff 2015-04-11 20:08:17 -04:00
Evert Timberg 9a13dd78fc Fix a typo 2015-04-11 19:42:54 -04:00
Evert Timberg 3e59438646 Integrate animation service with chart 2015-04-11 19:33:20 -04:00
Tanner Linsley 7a6f2b4f06 Src changes... derrrr 2015-04-11 17:30:06 -06:00
Tanner Linsley a417dd00c5 Merge pull request #1058 from tannerlinsley/animation-refactory
Chart.AnimationService
2015-04-11 17:23:59 -06:00
Tanner Linsley eee5af5924 Chart.AnimationService 2015-04-11 17:19:29 -06:00
Evert Timberg d3579334b2 Add an option to control the minimum number of animation steps. 2015-04-11 19:17:30 -04:00
Evert Timberg 0b8fd966ff Chart animations will now use the animation service provided in Chart.animationService. 2015-04-11 19:02:50 -04:00
Evert Timberg 972bc5636d Merge pull request #711 from cmweiss/master
Default color for Doughnut/Pie
2015-04-09 11:25:45 -04:00
dima117 ca7a39232a fix multiTooltip appearance with empty title
https://github.com/nnnick/Chart.js/issues/1039
2015-04-03 22:19:34 +03:00
Evert Timberg 44ed661e3b Merge pull request #1036 from dima117/master
helpers.generateLabels throws exception #1035
2015-04-01 18:04:12 -04:00
dima117 4009dbd6a0 helpers.generateLabels throws "labelTemplateString is not defined" exception #1035 2015-03-31 22:06:41 +03:00
pijey 2677360f4b Add offsetGridLines option to Line charts 2015-03-25 11:51:56 +01:00
Evert Timberg e461788b2b Merge pull request #1022 from GitGal/master
Added possible animation effects to getting started guide
2015-03-24 19:17:06 -04:00
GitGal f7ed97a33e Update 00-Getting-Started.md
Move Possible effects list above animationEasing
2015-03-24 18:17:41 +01:00
gitgal fc0434b3da add all possible easing animations to 00-Getting-Started.md 2015-03-24 18:07:35 +01:00
Nick Downie 1408c68205 Merge pull request #1005 from zymiboxpay/master
fix custom build bug
2015-03-18 11:38:15 +00:00
zymiboxpay 53bc8e769f fix custom build bug 2015-03-18 16:26:17 +08:00
Evert Timberg b5f73e2087 Merge pull request #1002 from nnnick/fix/issue927
fixes #927
2015-03-17 10:59:49 -04:00
William Entriken cb113c6452 fixes #927 2015-03-17 10:12:01 -04:00
William Entriken 8e5f1d9667 Merge pull request #575 from msrocka/master
fix #570: getDecimalPlaces throws error
2015-03-17 09:28:54 -04:00
William Entriken 47d23601b1 Fix CodeClimate issues 2015-03-16 19:14:36 -04:00
William Entriken 212d513746 Merge pull request #999 from mbrevda/unattachedElement
Properly size unattached canvas
2015-03-16 10:22:39 -04:00
Moshe Brevda 3e6883bdc0 Use default canvas size if one cannot be intelligently procured 2015-03-16 13:58:09 +02:00
Nick Downie 930b16a0af Versioned release files 2015-03-10 11:04:30 +00:00
Nick Downie 78d9627e4d Bump bower/package versions 2015-03-10 11:03:30 +00:00
Nick Downie 785f0b64b7 Merge pull request #983 from nnnick/release/v1.0.2
Release 1.0.2
2015-03-09 18:41:53 +00:00
Nick Downie d2b73bdc5b Release 1.0.2 2015-03-09 18:37:37 +00:00
Nick Downie 4b120ccbe9 Merge pull request #982 from nnnick/fix/automatic-chart-size-src
Target src files from #142
2015-03-09 17:20:29 +00:00
Nick Downie 1fd52e702c Merge pull request #981 from nnnick/fix/cancel-anim-frame
Ensure cancelAnimFrame has no function context
2015-03-09 17:16:15 +00:00
Nick Downie de564326b0 Target src files from #142 2015-03-09 17:14:09 +00:00
Nick Downie 154ce016cc Ensure cancelAnimFrame has no function context 2015-03-09 17:05:20 +00:00
Evert Timberg 5d8df20b0d Merge pull request #962 from steaks/removeUnecessaryComment
Removed an unnecessary comment
2015-03-02 11:39:28 -05:00
Steven Wexler 24248120a9 Removed an unnecessary comment 2015-03-01 20:31:44 -05:00
Jake 019e985c8f Merge pull request #898 from etimberg/fix/line_chart_single_label
Fix a divide by 0 error when there is only 1 label
2015-02-24 15:00:53 -05:00
Mike Smiley ff493738a2 add datasetLabel for multiTooltip on dynamically-added points 2015-02-24 14:19:01 -05:00
Nick Downie 5ea265983e Merge pull request #931 from jtibble/master
Removed trailing comma
2015-02-11 00:09:58 +00:00
John Tibble c09cac1cdd Removed trailing comma
Automated scan at my place of employment caught this trailing comma
2015-02-10 16:13:03 -05:00
William Entriken afd2631728 Merge pull request #917 from nnnick/fix-915
Fixes #915
2015-02-04 11:51:14 -05:00
William Entriken 4b09072c2a Fixes #915 2015-02-03 14:09:17 -05:00
William Entriken b865fd317a Fixes #901 2015-02-02 16:56:43 -05:00
Christopher Weiss bb6237a15e Accidentally left in Array.prototype.map. 2015-01-30 11:12:08 -05:00
Christopher Weiss b8b7c85c5e Using helper.each instead of Array.prototype.map 2015-01-30 11:01:44 -05:00
Jake 5ec66308e4 Update .travis.yml 2015-01-29 21:43:02 -05:00
William Entriken 9c6a7397b5 Merge pull request #867 from bendxn/master
Doughnut charts handling negative values
2015-01-29 16:54:45 -05:00
Evert Timberg 87b7f8070a Merge pull request #889 from bjornarg/cancelanimframe-fix
Fix issue with "Illegal invocation" in cancelAnimFrame.
2015-01-28 17:55:47 -05:00
Jake 2d28075cde ADD GH PR guidelines 2015-01-28 14:22:28 -05:00
Evert Timberg 2e0211320b Fix a divide by 0 error when there is only 1 label 2015-01-27 18:31:03 -05:00
William Entriken 8244dd1271 Merge pull request #551 from mparramont/patch-1
Fix global config multiTooltipTemplate comment
2015-01-27 14:04:10 -05:00
William Entriken 654e02763f Merge pull request #553 from johnheroy/master
Documentation: change lineColor to strokeColor for the first 3 example charts
2015-01-27 14:03:13 -05:00
William Entriken 0c1c9824b2 Merge pull request #694 from spmjs/master
Add spm support
2015-01-27 13:48:47 -05:00
William Entriken 63b14dde15 Clean up PR process 2015-01-27 13:35:30 -05:00
Bjørnar Grip Fjær 6f6f80e6d7 Fix issue with "Illegal invocation" in cancelAnimFrame. 2015-01-27 19:14:00 +01:00
Ben Dixon 13396c72b3 Merge remote-tracking branch 'upstream/master' 2015-01-26 18:49:17 -06:00
Evert Timberg a5550cef6b Merge pull request #142 from JonRowe/automatically_size_chart
Automatically size charts based upon the canvas size.
2015-01-26 18:55:49 -05:00
Christopher Weiss 0f49be56a4 Update 05-Pie-Doughnut-Chart.md 2015-01-26 16:33:24 -05:00
Christopher Weiss b9776736d4 Removed custom hue(), using hsl() 2015-01-26 16:28:11 -05:00
Jon Rowe 9ab36291a9 force calculated width/heights back to context, for firefox compatibility 2015-01-26 20:15:04 +11:00
Jon Rowe 657e53c117 make charts dependent on calculated width 2015-01-26 20:15:04 +11:00
Evert Timberg dc2ebab883 Merge pull request #890 from jakesyl/master
Update CONTRIBUTING.md
2015-01-25 21:29:22 -05:00
Jake 82571710c6 Update CONTRIBUTING.md 2015-01-25 20:48:33 -05:00
William Entriken 06adbb0c54 Merge pull request #703 from etimberg/fix/polar_area_update
Ensure that scales for polar area graphs are regenerated on updates.
2015-01-23 15:15:58 -05:00
Ben Dixon d051dfe47f handling negative values in doughnut charts 2015-01-15 13:40:08 -06:00
Ben Dixon 06b02e9c33 Revert "doughnut charts handling negative values"
This reverts commit 8b3a98f242.
2015-01-15 13:38:20 -06:00
Ben Dixon 8b3a98f242 doughnut charts handling negative values 2015-01-15 13:31:54 -06:00
Tanner Linsley 026611110a Updated Samples
Samples now include a “Randomize Data” button which utilizes the latest
changes.
2015-01-08 10:13:14 -07:00
William Entriken 092b011f9b formatting 2015-01-08 09:40:54 -05:00
William Entriken 8a027f49a4 typo 2015-01-08 09:39:49 -05:00
Tanner Linsley 359e94151c Data editable from chart config 2015-01-07 21:45:50 -07:00
Nick Downie 02f858b264 1.0.1 release builds 2015-01-07 22:49:33 +00:00
Nick Downie bdb49e6396 Merge pull request #611 from fntneves/feature/toggle-grid-lines
Add option to toggle grid vertical/horizontal lines
2015-01-07 22:44:59 +00:00
Nick Downie 05dbcd3a72 Merge pull request #840 from tannerlinsley/master
External Tooltips, Documentation and Samples
2015-01-07 22:44:02 +00:00
Tanner Linsley 64de3eb711 externalTooltips now labeled customTooltips 2015-01-06 22:53:30 -07:00
Evert Timberg 854cebc59c Merge pull request #855 from nnnick/fix/reset-canvas
Restore original canvas context when destroying
2015-01-06 19:17:01 -05:00
Nick Downie 74c9ef50c2 Space between status badges 2015-01-07 00:07:06 +00:00
Nick Downie 85f3755f9a Restore original canvas context when destroying 2015-01-06 23:44:51 +00:00
Jake 7aa867cf24 Merge pull request #850 from jakesyl/master
Increment Copyright Year
2015-01-04 17:14:15 -05:00
Jake 5d4e7cebea Update Chart.Core.js 2015-01-04 17:12:58 -05:00
William Entriken ed3e47f560 Merge pull request #846 from nnnick/fix/ci-builds
Fix Travis builds
2015-01-03 23:00:53 -05:00
Nick Downie d48979526f Merge pull request #842 from nnnick/fix/contributing-guidelines
Rewrite contributing guidelines
2015-01-03 17:26:21 +00:00
Nick Downie 329ad3cdce Remove checking .min file in CI 2015-01-03 17:19:28 +00:00
Nick Downie 84e859b6c5 Remove email notifications 2015-01-03 15:49:58 +00:00
Nick Downie 81d4f97abc Remove unnecessary semicolons 2015-01-03 15:40:47 +00:00
Nick Downie 2e4bb1899f Fix mixed whitespace 2015-01-03 15:40:33 +00:00
Nick Downie c9878b8434 Add Stack Overflow tag link to README 2015-01-03 15:30:58 +00:00
Jake 453310a338 Merge pull request #844 from jakesyl/master
move build status next to code climate button
2015-01-02 22:57:33 -05:00
Jake 9af5d0c9d6 move build status next to code climate 2015-01-02 22:56:58 -05:00
Nick Downie 7626dcf14e Link to contributing guide from readme 2015-01-01 23:49:10 +00:00
Nick Downie b4df89fcd1 Bump copyright year in license 2015-01-01 23:46:02 +00:00
Nick Downie 8c41c5c1b7 Rewrite contributing guidelines 2015-01-01 23:45:52 +00:00
William Entriken cfc4599a30 Add Travis CI support 2015-01-01 12:57:21 -05:00
Tanner Linsley 8c1e9588a1 External Tooltips, Documentation, and Samples 2014-12-30 13:05:11 -07:00
Jake 70c3672963 Merge pull request #841 from jakesyl/codeclimate
Move Code Climate Badge
2014-12-30 14:25:23 -05:00
Jake f4a5f67f7c Move Code Climate Badge 2014-12-30 14:24:55 -05:00
Jake 80e972c351 Delete dev instruction
@nnnick will rewrite this
2014-12-30 14:03:40 -05:00
Jake d320ce6eaf Merge pull request #750 from CAYdenberg/nnnick
Added link to CAYdenberg/Chart.js
2014-12-29 17:21:59 -05:00
Jake 7e97aa3300 Update CONTRIBUTING.md 2014-12-29 16:18:44 -05:00
Jake 102c069d74 Update CONTRIBUTING.md 2014-12-29 15:56:52 -05:00
Jake d8353c2b9a Update CONTRIBUTING.md 2014-12-29 15:55:17 -05:00
Nick Downie 932908532c Merge pull request #650 from fulldecent/patch-2
[CONTROVERSIAL] Update scope: new chart types are off topic
2014-12-29 20:42:54 +00:00
William Entriken 718dcd1a2b Merge pull request #5 from fulldecent/origin/patch-2
Origin/patch 2
2014-12-29 15:41:39 -05:00
William Entriken f81d6f45e1 Update readme about where to put new chart types 2014-12-29 15:40:09 -05:00
William Entriken 8522d4e60e Update to have new chart types in external repos 2014-12-29 15:38:03 -05:00
Jake 211850add2 Merge pull request #810 from Winnetou/patch-1
Minor typos
2014-12-29 15:12:33 -05:00
Derek Perkins aa96a3f33a Merge pull request #834 from jakesyl/patch-1
Add Code Climate Integration
2014-12-29 13:09:43 -07:00
Jake ac05a62000 Add Code Climate Integration 2014-12-28 22:18:55 -05:00
Mieszko f18b7ebd57 Minor typos 2014-12-09 11:11:49 +01:00
chad a7712e8c71 prevent divide by zero error when calculating a circumference 2014-11-13 11:36:13 -06:00
Casey Ydenberg 71bf3c8ee5 Added link to CAYdenberg/Chart.js 2014-11-11 15:11:30 -07:00
Jerome Touffe-Blin 1900c3b0f3 Fix #507 - calculate container width and heigh without padding 2014-10-25 13:21:52 +11:00
Christopher Weiss 73faf3413b Update Chart.Doughnut.js 2014-10-21 13:32:45 -04:00
Christopher Weiss fdc9be3e23 Correction in algorithm. 2014-10-21 13:28:45 -04:00
Christopher Weiss 7e21cb4e04 Pointed to core and doughnut. 2014-10-21 10:19:58 -04:00
Christopher Weiss 8984e8c2c4 Create doughnut.color.html
To test the new version of doughnut.
2014-10-21 10:16:30 -04:00
Christopher Weiss 686ea49953 Hue uses switch & fixed other problems. 2014-10-21 10:08:54 -04:00
Christopher Weiss ae9eaa95c7 hue() complete but undebugged. 2014-10-20 22:18:50 -04:00
Christopher Weiss e21147cbb9 Prototype for hue() & default fillColor to use it. 2014-10-20 21:49:41 -04:00
Evert Timberg 98c1ac439d Ensure that scales for polar area graphs are regenerated on updates. 2014-10-19 20:04:21 -04:00
chencheng 337511110c Add spm support 2014-10-15 17:28:50 +08:00
Rylan Halteman 5ab5e8400a add 10 to yLabelWidth on set, rather than on use 2014-10-08 11:36:39 -04:00
William Entriken 7eabb70130 Add strict language to README. 2014-10-01 12:18:47 -04:00
William Entriken ae65fde3e9 [CONTROVERSIAL] Update scope: new chart types are off topic 2014-09-26 12:37:51 -04:00
John Heroy 27a121c6b2 Change 'strokeColor' to 'fillColor' on 02-Bar-Chart.md 2014-09-25 09:49:20 -07:00
Nick Downie 1cfa42bc24 Merge pull request #627 from fulldecent/patch-2
Separate CONTRIBUTING.md, see https://github.com/blog/1184-contributing-...
2014-09-17 15:04:30 +01:00
William Entriken 401ff95867 move contributing to CONTRIBUTING.md, helps with NEW ISSUES 2014-09-15 12:16:31 -04:00
William Entriken ccc85c80d1 Separate CONTRIBUTING.md, see https://github.com/blog/1184-contributing-guidelines 2014-09-15 12:15:34 -04:00
Nick Downie 61b525a645 Merge pull request #606 from fulldecent/patch-1
Use canonical docs url
2014-09-10 16:32:57 +01:00
Francisco Neves a406fdae58 Update docs for toggle Horizontal/Vertical Lines feature 2014-09-08 17:49:19 +01:00
Francisco Neves a3daf1ca24 Add option to toggle grid vertical/horizontal lines 2014-09-08 16:10:45 +01:00
William Entriken 2ef91b1c78 Use canonical docs url 2014-09-04 13:48:37 -04:00
msrocka 5282c63ec3 fix #570: getDecimalPlaces throws error 2014-08-25 13:29:22 +02:00
Nick Downie 0a59a3c4df Merge pull request #560 from chandruxp/master
Fix for Almond AMD
2014-08-20 22:47:21 +01:00
chandruxp 47cf4f4814 Fix for Almond AMD 2014-08-20 15:20:46 -04:00
John Heroy e6cbd9dc7f Change lineColor to strokeColor in legendTemplate for Line, Bar, and Radar charts 2014-08-19 22:42:39 +08:00
Miguel Parramon f825a31ce4 Fix global config multiTooltipTemplate comment 2014-08-19 13:19:37 +02:00
chandruxp 53c4cd5ce1 Fix for Almond AMD 2014-08-18 18:52:50 -04:00
Nick Downie 8b840ce56b Pre-release version bump to beta.4 2014-08-17 23:21:11 +01:00
Nick Downie 7eec283d70 Merge pull request #435 from nnnick/fix/sparse-datasets
Resolve issues with sparse datasets & solve bezier capping to scale bounds
2014-08-17 23:18:42 +01:00
Nick Downie 10a9ef46cb Add in extra bezier debug point 2014-08-17 23:14:30 +01:00
Nick Downie 179d80a93b Cap bezier handles inside the scale 2014-08-17 22:32:36 +01:00
Nick Downie 48f10196f6 Use null checking for which points to draw/bezier 2014-08-03 19:20:31 +01:00
Nick Downie bd25b5c7fd New methods for array finding 2014-08-03 19:19:54 +01:00
Nick Downie 09c0f3308c Whitespace cleanup 2014-08-03 16:39:04 +01:00
Nick Downie 30777e4a87 Merge branch 'master' into fix/sparse-datasets
Conflicts:
	Chart.min.js
2014-08-03 16:05:34 +01:00
Nick Downie 14e72759ee Merge pull request #331 from kara/patch-1
Update copyright year in license to 2014
2014-07-27 23:27:32 +01:00
Nick Downie d47e600f1a Docs note on maintain aspect ratio option 2014-07-27 23:12:03 +01:00
Nick Downie 5bd10297fb Update built output 2014-07-27 23:03:32 +01:00
Nick Downie 55a115179e Fix reference error when tagging a release 2014-07-27 23:02:30 +01:00
Nick Downie 92e73bd28a Merge pull request #490 from nnnick/feature/version-bump
Create a task to bump + write version numbers
2014-07-27 22:59:14 +01:00
Nick Downie ebc955f562 Merge pull request #431 from Mardaneus86/patch-1
Missing draw method in Writing new chart types
2014-07-27 22:58:55 +01:00
Nick Downie 5683c11ebd Merge pull request #438 from Miosss/templateEnchanceme
Alternative scale templating. Passing function as template.
2014-07-27 22:58:06 +01:00
Nick Downie 61467e107f Merge pull request #443 from andyburke/aspectratios
Allow for responsive chart to take up its entire container.
2014-07-27 22:57:29 +01:00
Nick Downie adf6f3abb2 Create a task to bump + write version numbers
Also run `gulp release` to tag the latest release.
2014-07-27 21:41:49 +01:00
Nick Downie 22c50b0aba Merge pull request #460 from ooflorent/fix/npm-package
Add main in package.json
2014-07-17 10:02:01 +01:00
Florent Cailhol edb245b649 Add main file 2014-07-17 09:42:16 +02:00
Andy Burke 16cf465575 Add a small amount to docs. 2014-07-10 17:47:02 -07:00
Andy Burke 997a216b50 Allow for responsive charts to take up entire container by setting responsive: true and maintainAspectRatio: false. 2014-07-10 17:45:17 -07:00
Miosss d193951dc5 Alternative templating, cleanup.
Just added brackets.
2014-07-10 13:13:38 +02:00
Miosss c37c58ad39 Alternative scale templating. Passing function as template.
Allows to choose template mechanism - processing function or original micro templating.
2014-07-09 14:57:08 +02:00
Nick Downie 529d582f03 Built output 2014-07-08 23:13:29 +01:00
Nick Downie aa7975e4f7 Allow radar charts sparse data 2014-07-08 22:59:50 +01:00
Nick Downie fdfa9912e8 Refactor logic into shared Element method 2014-07-08 22:44:55 +01:00
Nick Downie 2f59921f7a Make a start on sparse data for line charts 2014-07-08 22:40:32 +01:00
Nick Downie e25fd5e37c Create null value bars, and hide if not numeric 2014-07-08 22:27:39 +01:00
Nick Downie 5d0171e8ed Check MultiTooltip elements are numeric 2014-07-08 22:19:36 +01:00
Nick Downie 55fc0cfd49 Change package.json name to lowercase 2014-07-08 21:45:56 +01:00
Tim Klingeleers cdfdc3c3e2 Missing draw method in Writing new chart types
Added the draw method to "Writing new chart types". If you use the template without the draw method, you get an undefined error because Chart.Type.prototype.render calls this.draw() on line 808 in Chart.Core.js.
2014-07-08 13:15:23 +02:00
Nick Downie ef5081184f Community chart types / extensions list 2014-07-06 22:59:57 +01:00
Kara 0a6c892766 Update copyright year in license to include 2014 2014-03-09 16:30:27 -07:00
Kara 51032692f3 Update copyright year in license to 2014 2014-03-09 16:19:18 -07:00
30 arquivos alterados com 2393 adições e 628 exclusões
+19
Ver Arquivo
@@ -0,0 +1,19 @@
---
engines:
duplication:
enabled: true
config:
languages:
- javascript
eslint:
enabled: true
fixme:
enabled: true
ratings:
paths:
- "**.js"
exclude_paths:
- dist/
- node_modules/
- test/
- coverage/
+1
Ver Arquivo
@@ -0,0 +1 @@
**/*{.,-}min.js
+213
Ver Arquivo
@@ -0,0 +1,213 @@
ecmaFeatures:
modules: true
jsx: true
env:
amd: true
browser: true
es6: true
jquery: true
node: true
# http://eslint.org/docs/rules/
rules:
# Possible Errors
comma-dangle: [2, never]
no-cond-assign: 2
no-console: 0
no-constant-condition: 2
no-control-regex: 2
no-debugger: 2
no-dupe-args: 2
no-dupe-keys: 2
no-duplicate-case: 2
no-empty: 2
no-empty-character-class: 2
no-ex-assign: 2
no-extra-boolean-cast: 2
no-extra-parens: 0
no-extra-semi: 2
no-func-assign: 2
no-inner-declarations: [2, functions]
no-invalid-regexp: 2
no-irregular-whitespace: 2
no-negated-in-lhs: 2
no-obj-calls: 2
no-regex-spaces: 2
no-sparse-arrays: 2
no-unexpected-multiline: 2
no-unreachable: 2
use-isnan: 2
valid-jsdoc: 0
valid-typeof: 2
# Best Practices
accessor-pairs: 2
block-scoped-var: 0
complexity: [2, 6]
consistent-return: 0
curly: 0
default-case: 0
dot-location: 0
dot-notation: 0
eqeqeq: 2
guard-for-in: 2
no-alert: 2
no-caller: 2
no-case-declarations: 2
no-div-regex: 2
no-else-return: 0
no-empty-label: 2
no-empty-pattern: 2
no-eq-null: 2
no-eval: 2
no-extend-native: 2
no-extra-bind: 2
no-fallthrough: 2
no-floating-decimal: 0
no-implicit-coercion: 0
no-implied-eval: 2
no-invalid-this: 0
no-iterator: 2
no-labels: 0
no-lone-blocks: 2
no-loop-func: 2
no-magic-number: 0
no-multi-spaces: 0
no-multi-str: 0
no-native-reassign: 2
no-new-func: 2
no-new-wrappers: 2
no-new: 2
no-octal-escape: 2
no-octal: 2
no-proto: 2
no-redeclare: 2
no-return-assign: 2
no-script-url: 2
no-self-compare: 2
no-sequences: 0
no-throw-literal: 0
no-unused-expressions: 2
no-useless-call: 2
no-useless-concat: 2
no-void: 2
no-warning-comments: 0
no-with: 2
radix: 2
vars-on-top: 0
wrap-iife: 2
yoda: 0
# Strict
strict: 0
# Variables
init-declarations: 0
no-catch-shadow: 2
no-delete-var: 2
no-label-var: 2
no-shadow-restricted-names: 2
no-shadow: 0
no-undef-init: 2
no-undef: 0
no-undefined: 0
no-unused-vars: 0
no-use-before-define: 0
# Node.js and CommonJS
callback-return: 2
global-require: 2
handle-callback-err: 2
no-mixed-requires: 0
no-new-require: 0
no-path-concat: 2
no-process-exit: 2
no-restricted-modules: 0
no-sync: 0
# Stylistic Issues
array-bracket-spacing: 0
block-spacing: 0
brace-style: 0
camelcase: 0
comma-spacing: 0
comma-style: 0
computed-property-spacing: 0
consistent-this: 0
eol-last: 0
func-names: 0
func-style: 0
id-length: 0
id-match: 0
indent: 0
jsx-quotes: 0
key-spacing: 0
linebreak-style: 0
lines-around-comment: 0
max-depth: 0
max-len: 0
max-nested-callbacks: 0
max-params: 0
max-statements: [2, 30]
new-cap: 0
new-parens: 0
newline-after-var: 0
no-array-constructor: 0
no-bitwise: 0
no-continue: 0
no-inline-comments: 0
no-lonely-if: 0
no-mixed-spaces-and-tabs: 0
no-multiple-empty-lines: 0
no-negated-condition: 0
no-nested-ternary: 0
no-new-object: 0
no-plusplus: 0
no-restricted-syntax: 0
no-spaced-func: 0
no-ternary: 0
no-trailing-spaces: 0
no-underscore-dangle: 0
no-unneeded-ternary: 0
object-curly-spacing: 0
one-var: 0
operator-assignment: 0
operator-linebreak: 0
padded-blocks: 0
quote-props: 0
quotes: 0
require-jsdoc: 0
semi-spacing: 0
semi: 0
sort-vars: 0
space-after-keywords: 0
space-before-blocks: 0
space-before-function-paren: 0
space-before-keywords: 0
space-in-parens: 0
space-infix-ops: 0
space-return-throw-case: 0
space-unary-ops: 0
spaced-comment: 0
wrap-regex: 0
# ECMAScript 6
arrow-body-style: 0
arrow-parens: 0
arrow-spacing: 0
constructor-super: 0
generator-star-spacing: 0
no-arrow-condition: 0
no-class-assign: 0
no-const-assign: 0
no-dupe-class-members: 0
no-this-before-super: 0
no-var: 0
object-shorthand: 0
prefer-arrow-callback: 0
prefer-const: 0
prefer-reflect: 0
prefer-spread: 0
prefer-template: 0
require-yield: 0
+3
Ver Arquivo
@@ -3,5 +3,8 @@
node_modules/*
custom/*
coverage/*
docs/index.md
.settings/
+13
Ver Arquivo
@@ -0,0 +1,13 @@
language: node_js
node_js:
- "0.11"
- "0.10"
before_script:
- npm install
script:
- gulp test
notifications:
slack: chartjs:pcfCZR6ugg5TEcaLtmIfQYuA
+57
Ver Arquivo
@@ -0,0 +1,57 @@
Contributing to Chart.js
========================
Contributions to Chart.js are welcome and encouraged, but please have a look through the guidelines in this document before raising an issue, or writing code for the project.
Using issues
------------
The [issue tracker](https://github.com/nnnick/Chart.js/issues) is the preferred channel for reporting bugs, requesting new features and submitting pull requests.
If you're suggesting a new chart type, please take a look at [writing new chart types](https://github.com/nnnick/Chart.js/blob/master/docs/06-Advanced.md#writing-new-chart-types) in the documentation, and some of the [community extensions](https://github.com/nnnick/Chart.js/blob/master/docs/06-Advanced.md#community-extensions) that have been created already.
To keep the library lightweight for everyone, it's unlikely we'll add many more chart types to the core of Chart.js, but issues are a good medium to design and spec out how new chart types could work and look.
Please do not use issues for support requests. For help using Chart.js, please take a look at the [`chartjs`](http://stackoverflow.com/questions/tagged/chartjs) tag on Stack Overflow.
Reporting bugs
--------------
Well structured, detailed bug reports are hugely valuable for the project.
Guidlines for reporting bugs:
- Check the issue search to see if it has already been reported
- Isolate the problem to a simple test case
- Provide a demonstration of the problem on [JS Bin](http://jsbin.com) or similar
Please provide any additional details associated with the bug, if it's browser or screen density specific, or only happens with a certain configuration or data.
Pull requests
-------------
Clear, concise pull requests are excellent at continuing the project's community driven growth. But please review [these guidelines](https://github.com/blog/1943-how-to-write-the-perfect-pull-request) and the guidelines below before starting work on the project.
Be advised that **Chart.js 1.0.2 is in feature-complete status**. Pull requests adding new features to the 1.x branch will be disregarded.
Guidlines:
- Please create an issue first:
- For bugs, we can discuss the fixing approach
- For enhancements, we can discuss if it is within the project scope and avoid duplicate effort
- Please make changes to the files in [`/src`](https://github.com/nnnick/Chart.js/tree/master/src), not `Chart.js` or `Chart.min.js` in the repo root directory, this avoids merge conflicts
- Tabs for indentation, not spaces please
- If adding new functionality, please also update the relevant `.md` file in [`/docs`](https://github.com/nnnick/Chart.js/tree/master/docs)
- Please make your commits in logical sections with clear commit messages
Joining the project
-------------
- Active committers and contributors are invited to introduce yourself and request commit access to this project. Please send an email to hello@nickdownie.com or file an issue.
License
-------
By contributing your code, you agree to license your contribution under the [MIT license](https://github.com/nnnick/Chart.js/blob/master/LICENSE.md).
externo
+712 -280
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+4 -3
Ver Arquivo
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+2 -1
Ver Arquivo
@@ -1,4 +1,5 @@
Copyright (c) 2013 Nick Downie
The MIT License (MIT)
Copyright (c) 2013-2016 Nick Downie
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+54 -19
Ver Arquivo
@@ -1,26 +1,61 @@
# Chart.js
[![](http://tannerlinsley.com/memes/chartjs.gif)](http://www.chartjs.org/docs/)
# Chart.js
[![Build Status](https://travis-ci.org/nnnick/Chart.js.svg?branch=master)](https://travis-ci.org/nnnick/Chart.js) [![Code Climate](https://codeclimate.com/github/nnnick/Chart.js/badges/gpa.svg)](https://codeclimate.com/github/nnnick/Chart.js) [![Chart.js on Slack](https://img.shields.io/badge/slack-Chart.js-blue.svg)](https://chartjs-slack-automation.herokuapp.com/)
*Simple HTML5 Charts using the canvas element* [chartjs.org](http://www.chartjs.org)
## Documentation
## v1.0.2 Stable
You can find documentation at [chartjs.org/docs](http://www.chartjs.org/docs). The markdown files that build the site are available under `/docs`. Please note - in some of the json examples of configuration you might notice some liquid tags - this is just for the generating the site html, please disregard.
- NPM: `npm install chart.js --save`
- Bower: `bower install Chart.js --save`
- CDN: https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js
- Zip: [Download](https://github.com/nnnick/Chart.js/archive/master.zip)
[Examples](https://github.com/nnnick/Chart.js/tree/master/samples) | [Documentation](http://www.chartjs.org/docs/)
## v2.0 Beta
- Release: [2.0.0-beta](https://github.com/nnnick/Chart.js/releases/tag/2.0.0-beta)
- Zip: [Download](https://github.com/nnnick/Chart.js/archive/2.0.0-beta2.zip)
Documentation for v2.0 is currently located [here](http://nnnick.github.io/Chart.js/docs-v2/).
## v2.0 Bleeding-Edge
- Branch: [v2.0-dev](https://github.com/nnnick/Chart.js/tree/v2.0-dev)
- Zip: [Download](https://github.com/nnnick/Chart.js/archive/v2.0-dev.zip)
The next generation and release of Chart.js (v2.0) has been well under way this year and we are very close to releasing some amazing new features including, but not limited to:
- Rewritten, optimized, and unit-tested
- New and improved scales (log, time, linear, category, multiple scales)
- Improved Tooltips and tooltip callbacks for customization
- Improved responsiveness and resizing
- Powerful support for adding, removing, changing, and updating data on the fly
- Animations for everything, including all elements, colors and tooltips
- Powerful customization when you need it. Automatic and dynamic when you don't.
- Excellent support for modern frameworks and modular build systems.
- Even more extensible via new element controllers, core scale classes, combo chart support, and hook systems
- Bug fixes, stability improvements, etc.
#####Contributing to 2.0
Submit PR's to the v2.0-dev branch.
#####Building and Testing
`gulp build`, `gulp test`, `gulp watch --test`
#####v1.x Status: Feature Complete
v1.x is now considered feature complete. PR's for bug fixes are still extremely welcome. Any open PR's for v1.x features will need to be reconsidered, refactored and resubmitted for v2.x (if the feature has not already been implemented). For questions on new features refer to the docs in the v2.0-dev branch
## Bugs, Issues and Contributing
Before submitting an issue or a pull request to the project, please take a moment to look over the [contributing guidelines](https://github.com/nnnick/Chart.js/blob/master/CONTRIBUTING.md) first.
For support using Chart.js, please post questions with the [`chartjs` tag on Stack Overflow](http://stackoverflow.com/questions/tagged/chartjs).
## License
Chart.js is available under the [MIT license](http://opensource.org/licenses/MIT).
## Bugs & issues
When reporting bugs or issues, if you could include a link to a simple [jsbin](http://jsbin.com) or similar demonstrating the issue, that'd be really helpful.
## Contributing
New contributions to the library are welcome, just a couple of guidelines:
- Tabs for indentation, not spaces please.
- Please ensure you're changing the individual files in `/src`, not the concatenated output in the `Chart.js` file in the root of the repo.
- Please check that your code will pass `jshint` code standards, `gulp jshint` will run this for you.
- Please keep pull requests concise, and document new functionality in the relevant `.md` file.
- Consider whether your changes are useful for all users, or if creating a Chart.js extension would be more appropriate.
- Please avoid committing in the build Chart.js & Chart.min.js file, as it causes conflicts when merging.
Chart.js is available under the [MIT license](https://github.com/nnnick/Chart.js/blob/master/LICENSE.md).
+15 -4
Ver Arquivo
@@ -1,10 +1,21 @@
{
"name": "Chart.js",
"version": "1.0.1-beta.2",
"description": "Simple HTML5 Charts using the canvas element",
"homepage": "https://github.com/nnnick/Chart.js",
"author": "nnnick",
"main": ["Chart.min.js"],
"dependencies": {
}
"main": [
"Chart.js"
],
"ignore": [
"**/*",
".travis.yml",
"CONTRIBUTING.md",
"Chart.js",
"LICENSE.md",
"README.md",
"gulpfile.js",
"package.json"
],
"dependencies": {},
"version": "1.1.1"
}
+26
Ver Arquivo
@@ -0,0 +1,26 @@
{
"name": "nnnick/chartjs",
"type": "library",
"description": "Simple HTML5 charts using the canvas element.",
"keywords": [
"chart",
"js"
],
"homepage": "http://www.chartjs.org/",
"license": "MIT",
"authors": [
{
"name": "NICK DOWNIE",
"email": "hello@nickdownie.com"
}
],
"require": {
"php": ">=5.3.3"
},
"minimum-stability": "stable",
"extra": {
"branch-alias": {
"release/2.0": "v2.0-dev"
}
}
}
+54 -4
Ver Arquivo
@@ -11,14 +11,14 @@ First we need to include the Chart.js library on the page. The library occupies
<script src="Chart.js"></script>
```
Alternatively, if you're using an AMD loader for JavaScript modules, that is also supported in the Chart.js core. Please note: the library will still occupy a global variable of `Chart`, even if it detects `define` and `define.amd`. If this is a problem, you can call `noConflict` to restore the global Chart variable to it's previous owner.
Alternatively, if you're using an AMD loader for JavaScript modules, that is also supported in the Chart.js core. Please note: the library will still occupy a global variable of `Chart`, even if it detects `define` and `define.amd`. If this is a problem, you can call `noConflict` to restore the global Chart variable to its previous owner.
```javascript
// Using requirejs
require(['path/to/Chartjs'], function(Chart){
// Use Chart.js as normal here.
// Chart.noConflict restores the Chart global variable to it's previous owner
// Chart.noConflict restores the Chart global variable to its previous owner
// The function returns what was previously Chart, allowing you to reassign.
var Chartjs = Chart.noConflict();
@@ -28,9 +28,19 @@ require(['path/to/Chartjs'], function(Chart){
You can also grab Chart.js using bower:
```bash
bower install chartjs --save
bower install Chart.js --save
```
or NPM:
```bash
npm install chart.js --save
```
Also, Chart.js is available from CDN:
https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js
###Creating a chart
To create a chart, we need to instantiate the `Chart` class. To do this, we need to pass in the 2d context of where we want to draw the chart. Here's an example.
@@ -68,6 +78,10 @@ We call a method of the name of the chart we want to create. We pass in the data
This concept was introduced in Chart.js 1.0 to keep configuration DRY, and allow for changing options globally across chart types, avoiding the need to specify options for each instance, or the default for a particular chart type.
Templates are based on micro templating by John Resig:
http://ejohn.org/blog/javascript-micro-templating/
```javascript
Chart.defaults.global = {
// Boolean - Whether to animate the chart
@@ -77,6 +91,14 @@ Chart.defaults.global = {
animationSteps: 60,
// String - Animation easing effect
// Possible effects are:
// [easeInOutQuart, linear, easeOutBounce, easeInBack, easeInOutQuad,
// easeOutQuart, easeOutQuad, easeInOutBounce, easeOutSine, easeInOutCubic,
// easeInExpo, easeInOutBack, easeInCirc, easeInOutElastic, easeOutBack,
// easeInQuad, easeInOutExpo, easeInQuart, easeOutQuint, easeInOutCirc,
// easeInSine, easeOutExpo, easeOutCirc, easeOutCubic, easeInQuint,
// easeInElastic, easeInOutSine, easeInOutQuint, easeInBounce,
// easeOutElastic, easeInCubic]
animationEasing: "easeOutQuart",
// Boolean - If we should show the scale at all
@@ -126,9 +148,15 @@ Chart.defaults.global = {
// Boolean - whether or not the chart should be responsive and resize when the browser does.
responsive: false,
// Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
maintainAspectRatio: true,
// Boolean - Determines whether to draw tooltips on the canvas or not
showTooltips: true,
// Function - Determines whether to execute the customTooltips function instead of drawing the built in tooltips (See [Advanced - External Tooltips](#advanced-usage-external-tooltips))
customTooltips: false,
// Array - Array of string names to attach tooltip events
tooltipEvents: ["mousemove", "touchstart", "touchmove"],
@@ -159,6 +187,9 @@ Chart.defaults.global = {
// String - Tooltip title font colour
tooltipTitleFontColor: "#fff",
// String - Tooltip title template
tooltipTitleTemplate: "<%= label%>",
// Number - pixel width of padding around tooltip text
tooltipYPadding: 6,
@@ -177,7 +208,7 @@ Chart.defaults.global = {
// String - Template string for single tooltips
tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>",
{% endraw %}
// String - Template string for single tooltips
// String - Template string for multiple tooltips
multiTooltipTemplate: "<%= value %>",
// Function - Will fire on animation progression.
@@ -195,3 +226,22 @@ Chart.defaults.global.responsive = true;
```
Now, every time we create a chart, `options.responsive` will be `true`.
###Tooltip Templates
For the `tooltipTemplate` and `multiTooltipTemplate` configuration options, you may use special template blocks. **Do not use user input in the tooltip template, as it may be executed as raw JavaScript.**
Anything in between `<%` and `%>` will be executed as JavaScript. As in the example shown above, `<% if (label) { %>` and later `<% } %>`. Using `<%= expr %>` will print the value of the variable named by `expr` into the tooltip.
The available variables to print into the tooltip depends on the chart type. In general, the following variables are available:
```javascript
{
value : "value of the data point",
label : "label for the position the data point is at",
datasetLabel: "label for the dataset the point is from",
strokeColor : "stroke color for the dataset",
fillColor : "fill color for the dataset",
highlightFill : "highlight fill color for the dataset",
highlightStroke : "highlight stroke color for the dataset"
}
```
+11 -2
Ver Arquivo
@@ -45,7 +45,7 @@ var data = {
};
```
The line chart requires an array of labels for each of the data points. This is shown on the X axis.
The line chart requires an array of labels. This labels are shown on the X axis. There must be one label for each data point. More labels than datapoints are allowed, in which case the line ends at the last data point.
The data for line charts is broken up into an array of datasets. Each dataset has a colour for the fill, a colour for the line and colours for the points and strokes of the points. These colours are strings just like CSS. You can use RGBA, RGB, HEX or HSL notation.
The label key on each dataset is optional, and can be used when generating a scale for the chart.
@@ -66,6 +66,12 @@ These are the customisation options specific to Line charts. These options are m
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - Whether to show horizontal lines (except X axis)
scaleShowHorizontalLines: true,
//Boolean - Whether to show vertical lines (except Y axis)
scaleShowVerticalLines: true,
//Boolean - Whether the line is curved between points
bezierCurve : true,
@@ -94,8 +100,11 @@ These are the customisation options specific to Line charts. These options are m
datasetFill : true,
{% raw %}
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].lineColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"><%if(datasets[i].label){%><%=datasets[i].label%><%}%></span></li><%}%></ul>"
{% endraw %}
//Boolean - Whether to horizontally center the label and point dot inside the grid
offsetGridLines : false
};
```
+8 -2
Ver Arquivo
@@ -65,6 +65,12 @@ These are the customisation options specific to Bar charts. These options are me
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - Whether to show horizontal lines (except X axis)
scaleShowHorizontalLines: true,
//Boolean - Whether to show vertical lines (except Y axis)
scaleShowVerticalLines: true,
//Boolean - If there is a stroke on each bar
barShowStroke : true,
@@ -78,7 +84,7 @@ These are the customisation options specific to Bar charts. These options are me
barDatasetSpacing : 1,
{% raw %}
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].lineColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].fillColor%>\"><%if(datasets[i].label){%><%=datasets[i].label%><%}%></span></li><%}%></ul>"
{% endraw %}
}
```
@@ -140,4 +146,4 @@ Calling `removeData()` on your Chart instance will remove the first value for al
```javascript
myBarChart.removeData();
// The chart will now animate and remove the first bar
```
```
+5 -2
Ver Arquivo
@@ -76,6 +76,9 @@ These are the customisation options specific to Radar charts. These options are
//Number - Pixel width of the angle line
angleLineWidth : 1,
//Number - Interval at which to draw angle lines ("every Nth point")
angleLineInterval: 1,
//String - Point label font declaration
pointLabelFontFamily : "'Arial'",
@@ -110,7 +113,7 @@ These are the customisation options specific to Radar charts. These options are
datasetFill : true,
{% raw %}
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].lineColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"><%if(datasets[i].label){%><%=datasets[i].label%><%}%></span></li><%}%></ul>"
{% endraw %}
}
```
@@ -174,4 +177,4 @@ Calling `removeData()` on your Chart instance will remove the first value for al
```javascript
myRadarChart.removeData();
// Other points will now animate to their correct positions.
```
```
+3 -3
Ver Arquivo
@@ -83,7 +83,7 @@ These are the customisation options specific to Polar Area charts. These options
//Boolean - Stroke a line around each segment in the chart
segmentShowStroke : true,
//String - The colour of the stroke on each segement.
//String - The colour of the stroke on each segment.
segmentStrokeColor : "#fff",
//Number - The width of the stroke value in pixels
@@ -102,7 +102,7 @@ These are the customisation options specific to Polar Area charts. These options
animateScale : false,
{% raw %}
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"><%if(segments[i].label){%><%=segments[i].label%><%}%></span></li><%}%></ul>"
{% endraw %}
}
```
@@ -169,4 +169,4 @@ Calling `removeData(index)` on your Chart instance will remove segment at that p
```javascript
myPolarAreaChart.removeData();
// Other segments will update to fill the empty space left.
```
```
+10 -8
Ver Arquivo
@@ -3,11 +3,11 @@ title: Pie & Doughnut Charts
anchor: doughnut-pie-chart
---
###Introduction
Pie and doughnut charts are probably the most commonly used chart there are. They are divided into segments, the arc of each segment shows a the proportional value of each piece of data.
Pie and doughnut charts are probably the most commonly used chart there are. They are divided into segments, the arc of each segment shows the proportional value of each piece of data.
They are excellent at showing the relational proportions between data.
Pie and doughnut charts in are effectively the same class in Chart.js, but have one different default value - their `percentageInnerCutout`. This equates what percentage of the inner should be cut out. This defaults to `0` for pie charts, and `50` for doughnuts.
Pie and doughnut charts are effectively the same class in Chart.js, but have one different default value - their `percentageInnerCutout`. This equates what percentage of the inner should be cut out. This defaults to `0` for pie charts, and `50` for doughnuts.
They are also registered under two aliases in the `Chart` core. Other than their different default value, and different alias, they are exactly the same.
@@ -55,7 +55,7 @@ var data = [
]
```
For a pie chart, you must pass in an array of objects with a value and a color property. The value attribute should be a number, Chart.js will total all of the numbers and calculate the relative proportion of each. The color attribute should be a string. Similar to CSS, for this string you can use HEX notation, RGB, RGBA or HSL.
For a pie chart, you must pass in an array of objects with a value and an optional color property. The value attribute should be a number, Chart.js will total all of the numbers and calculate the relative proportion of each. The color attribute should be a string. Similar to CSS, for this string you can use HEX notation, RGB, RGBA or HSL.
### Chart options
@@ -88,7 +88,7 @@ These are the customisation options specific to Pie & Doughnut charts. These opt
animateScale : false,
{% raw %}
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"><%if(segments[i].label){%><%=segments[i].label%><%}%></span></li><%}%></ul>"
{% endraw %}
}
```
@@ -104,13 +104,13 @@ new Chart(ctx).Doughnut(data, {
// and the Doughnut chart defaults but this particular instance will have `animateScale` set to `true`.
```
We can also change these defaults values for each Doughnut type that is created, this object is available at `Chart.defaults.Doughnut`. Pie charts also have a clone of these defaults available to change at `Chart.defaults.Pie`, with the only difference being `percentageInnerCutout` being set to 0.
We can also change these default values for each Doughnut type that is created, this object is available at `Chart.defaults.Doughnut`. Pie charts also have a clone of these defaults available to change at `Chart.defaults.Pie`, with the only difference being `percentageInnerCutout` being set to 0.
### Prototype methods
#### .getSegmentsAtEvent( event )
Calling `getSegmentsAtEvent(event)` on your Chart instance passing an argument of an event, or jQuery event, will return the segment elements that are at that the same position of that event.
Calling `getSegmentsAtEvent(event)` on your Chart instance passing an argument of an event, or jQuery event, will return the segment elements that are at the same position of that event.
```javascript
canvas.onclick = function(evt){
@@ -135,7 +135,9 @@ myDoughnutChart.update();
#### .addData( segmentData, index )
Calling `addData(segmentData, index)` on your Chart instance passing an object in the same format as in the constructor. There is an option second argument of 'index', this determines at what index the new segment should be inserted into the chart.
Calling `addData(segmentData, index)` on your Chart instance passing an object in the same format as in the constructor. There is an optional second argument of 'index', this determines at what index the new segment should be inserted into the chart.
If you don't specify a color and highliht, one will be chosen from the global default array: segmentColorDefault and the corresponding segmentHighlightColorDefault. The index of the addded data is used to lookup a corresponding color from the defaults.
```javascript
// An object in the same format as the original data source
@@ -155,4 +157,4 @@ Calling `removeData(index)` on your Chart instance will remove segment at that p
```javascript
myDoughnutChart.removeData();
// Other segments will update to fill the empty space left.
```
```
+45 -2
Ver Arquivo
@@ -54,7 +54,7 @@ myLineChart.destroy();
#### .toBase64Image()
This returns a base 64 encoded string of the chart in it's current state.
This returns a base 64 encoded string of the chart in its current state.
```javascript
myLineChart.toBase64Image();
@@ -70,6 +70,39 @@ myLineChart.generateLegend();
// => returns HTML string of a legend for this chart
```
### External Tooltips
You can enable custom tooltips in the global or chart configuration like so:
```javascript
var myPieChart = new Chart(ctx).Pie(data, {
customTooltips: function(tooltip) {
// tooltip will be false if tooltip is not visible or should be hidden
if (!tooltip) {
return;
}
// Otherwise, tooltip will be an object with all tooltip properties like:
// tooltip.caretHeight
// tooltip.caretPadding
// tooltip.chart
// tooltip.cornerRadius
// tooltip.fillColor
// tooltip.font...
// tooltip.text
// tooltip.x
// tooltip.y
// etc...
}
});
```
See files `sample/pie-customTooltips.html` and `sample/line-customTooltips.html` for examples on how to get started.
### Writing new chart types
Chart.js 1.0 has been rewritten to provide a platform for developers to create their own custom chart types, and be able to share and utilise them through the Chart.js API.
@@ -92,6 +125,9 @@ Chart.Type.extend({
initialize: function(data){
this.chart.ctx // The drawing context for this chart
this.chart.canvas // the canvas node for this chart
},
// Used to draw something on the canvas
draw: function() {
}
});
@@ -120,6 +156,13 @@ new Chart(ctx).LineAlt(data);
// but this logs 'My Line chart extension' in the console.
```
### Community extensions
- <a href="https://github.com/Regaddi/Chart.StackedBar.js" target="_blank">Stacked Bar Chart</a> by <a href="https://twitter.com/Regaddi" target="_blank">@Regaddi</a>
- <a href="https://github.com/tannerlinsley/Chart.StackedArea.js" target="_blank">Stacked Bar Chart</a> by <a href="https://twitter.com/tannerlinsley" target="_blank">@tannerlinsley</a>
- <a href="https://github.com/CAYdenberg/Chart.js" target="_blank">Error bars (bar and line charts)</a> by <a href="https://twitter.com/CAYdenberg" target="_blank">@CAYdenberg</a>
- <a href="http://dima117.github.io/Chart.Scatter/" target="_blank">Scatter chart (number & date scales are supported)</a> by <a href="https://github.com/dima117" target="_blank">@dima117</a>
### Creating custom builds
Chart.js uses <a href="http://gulpjs.com/" target="_blank">gulp</a> to build the library into a single JavaScript file. We can use this same build script with custom parameters in order to build a custom version.
@@ -133,7 +176,7 @@ npm install -g gulp
This will install the local development dependencies for Chart.js, along with a CLI for the JavaScript task runner <a href="http://gulpjs.com/" target="_blank">gulp</a>.
Now, we can run the `gulp build` task, and pass in a comma seperated list of types as an argument to build a custom version of Chart.js with only specified chart types.
Now, we can run the `gulp build` task, and pass in a comma-separated list of types as an argument to build a custom version of Chart.js with only specified chart types.
Here we will create a version of Chart.js with only Line, Radar and Bar charts included:
+66 -6
Ver Arquivo
@@ -5,7 +5,15 @@ var gulp = require('gulp'),
jshint = require('gulp-jshint'),
size = require('gulp-size'),
connect = require('gulp-connect'),
exec = require('child_process').exec;
replace = require('gulp-replace'),
htmlv = require('gulp-html-validator'),
inquirer = require('inquirer'),
semver = require('semver'),
exec = require('child_process').exec,
fs = require('fs'),
package = require('./package.json'),
bower = require('./bower.json'),
livereload = require('gulp-livereload');
var srcDir = './src/';
/*
@@ -21,15 +29,17 @@ gulp.task('build', function(){
isCustom = !!(util.env.types),
outputDir = (isCustom) ? 'custom' : '.';
if (isCustom){
util.env.types.split(',').forEach(function(type){ return srcFiles.push(FileName(type))});
util.env.types.split(',').forEach(function(type){ return srcFiles.push(FileName(type));});
}
else{
// Seems gulp-concat remove duplicates - nice!
// So we can use this to sort out dependency order - aka include Core first!
srcFiles.push(srcDir+'*');
}
return gulp.src(srcFiles)
.pipe(concat('Chart.js'))
.pipe(replace('{{ version }}', package.version))
.pipe(gulp.dest(outputDir))
.pipe(uglify({preserveComments:'some'}))
.pipe(concat('Chart.min.js'))
@@ -37,7 +47,43 @@ gulp.task('build', function(){
function FileName(moduleName){
return srcDir+'Chart.'+moduleName+'.js';
};
}
});
/*
* Usage : gulp bump
* Prompts: Version increment to bump
* Output: - New version number written into package.json & bower.json
*/
gulp.task('bump', function(complete){
util.log('Current version:', util.colors.cyan(package.version));
var choices = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'].map(function(versionType){
return versionType + ' (v' + semver.inc(package.version, versionType) + ')';
});
inquirer.prompt({
type: 'list',
name: 'version',
message: 'What version update would you like?',
choices: choices
}, function(res){
var increment = res.version.split(' ')[0],
newVersion = semver.inc(package.version, increment);
// Set the new versions into the bower/package object
package.version = newVersion;
bower.version = newVersion;
// Write these to their own files, then build the output
fs.writeFileSync('package.json', JSON.stringify(package, null, 2));
fs.writeFileSync('bower.json', JSON.stringify(bower, null, 2));
complete();
});
});
gulp.task('release', ['build'], function(){
exec('git tag -a v' + package.version);
});
gulp.task('jshint', function(){
@@ -46,6 +92,11 @@ gulp.task('jshint', function(){
.pipe(jshint.reporter('default'));
});
gulp.task('valid', function(){
return gulp.src('samples/*.html')
.pipe(htmlv());
});
gulp.task('library-size', function(){
return gulp.src('Chart.min.js')
.pipe(size({
@@ -59,14 +110,23 @@ gulp.task('module-sizes', function(){
.pipe(size({
showFiles: true,
gzip: true
}))
}));
});
gulp.task('watch', function(){
gulp.watch('./src/*', ['build']);
livereload.listen(35729);
var reloadPage = function (evt) {
livereload.changed(evt.path);
};
gulp.watch(['Chart.js', 'samples/*'], reloadPage);
});
gulp.task('test', ['jshint']);
gulp.task('test', ['jshint', 'valid']);
gulp.task('size', ['library-size', 'module-sizes']);
@@ -74,7 +134,7 @@ gulp.task('default', ['build', 'watch']);
gulp.task('server', function(){
connect.server({
port: 8000,
port: 8000
});
});
+17 -7
Ver Arquivo
@@ -1,20 +1,30 @@
{
"name": "Chart.js",
"name": "chart.js",
"homepage": "http://www.chartjs.org",
"description": "Simple HTML5 charts using the canvas element.",
"version": "1.0.1-beta.2",
"version": "1.1.1",
"main": "Chart.js",
"repository": {
"type": "git",
"url": "https://github.com/nnnick/Chart.js.git"
},
"license": "MIT",
"dependences": {},
"devDependencies": {
"gulp": "3.5.x",
"gulp": "3.9.x",
"gulp-concat": "~2.1.x",
"gulp-uglify": "~0.2.x",
"gulp-util": "~2.2.x",
"gulp-connect": "~2.0.5",
"gulp-jshint": "~1.5.1",
"gulp-replace": "^0.4.0",
"gulp-size": "~0.4.0",
"gulp-connect": "~2.0.5"
"gulp-uglify": "~1.5.x",
"gulp-util": "~2.2.x",
"gulp-html-validator": "^0.0.2",
"inquirer": "^0.5.1",
"semver": "^3.0.1",
"gulp-livereload": "^3.8.0"
},
"spm": {
"main": "Chart.js"
}
}
}
+58
Ver Arquivo
@@ -0,0 +1,58 @@
<!doctype html>
<html>
<head>
<title>Doughnut Chart</title>
<script src="../src/Chart.Core.js"></script>
<script src="../src/Chart.Doughnut.js"></script>
<style>
body{
padding: 0;
margin: 0;
}
#canvas-holder{
width:30%;
}
</style>
</head>
<body>
<div id="canvas-holder">
<canvas id="chart-area" width="500" height="500"/>
</div>
<script>
var doughnutData = [
{
value: 1,
label: "One"
},
{
value: 2,
label: "Two"
},
{
value: 3,
label: "Three"
},
{
value: 4,
label: "Four"
},
{
value: 5,
label: "Five"
}
];
window.onload = function(){
var ctx = document.getElementById("chart-area").getContext("2d");
window.myDoughnut = new Chart(ctx).Doughnut(doughnutData, {responsive : true});
};
</script>
</body>
</html>
+129
Ver Arquivo
@@ -0,0 +1,129 @@
<!doctype html>
<html>
<head>
<title>Line Chart with Custom Tooltips</title>
<script src="../Chart.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<style>
#canvas-holder1 {
width: 300px;
margin: 20px auto;
}
#canvas-holder2 {
width: 50%;
margin: 20px 25%;
}
#chartjs-tooltip {
opacity: 1;
position: absolute;
background: rgba(0, 0, 0, .7);
color: white;
padding: 3px;
border-radius: 3px;
-webkit-transition: all .1s ease;
transition: all .1s ease;
pointer-events: none;
-webkit-transform: translate(-50%, 0);
transform: translate(-50%, 0);
}
.chartjs-tooltip-key{
display:inline-block;
width:10px;
height:10px;
}
</style>
</head>
<body>
<div id="canvas-holder1">
<canvas id="chart1" width="300" height="30" />
</div>
<div id="canvas-holder2">
<canvas id="chart2" width="450" height="600" />
</div>
<div id="chartjs-tooltip"></div>
<script>
Chart.defaults.global.pointHitDetectionRadius = 1;
Chart.defaults.global.customTooltips = function(tooltip) {
var tooltipEl = $('#chartjs-tooltip');
if (!tooltip) {
tooltipEl.css({
opacity: 0
});
return;
}
tooltipEl.removeClass('above below');
tooltipEl.addClass(tooltip.yAlign);
var innerHtml = '';
for (var i = tooltip.labels.length - 1; i >= 0; i--) {
innerHtml += [
'<div class="chartjs-tooltip-section">',
' <span class="chartjs-tooltip-key" style="background-color:' + tooltip.legendColors[i].fill + '"></span>',
' <span class="chartjs-tooltip-value">' + tooltip.labels[i] + '</span>',
'</div>'
].join('');
}
tooltipEl.html(innerHtml);
tooltipEl.css({
opacity: 1,
left: tooltip.chart.canvas.offsetLeft + tooltip.x + 'px',
top: tooltip.chart.canvas.offsetTop + tooltip.y + 'px',
fontFamily: tooltip.fontFamily,
fontSize: tooltip.fontSize,
fontStyle: tooltip.fontStyle,
});
};
var randomScalingFactor = function() {
return Math.round(Math.random() * 100);
};
var lineChartData = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()]
}, {
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()]
}]
};
window.onload = function() {
var ctx1 = document.getElementById("chart1").getContext("2d");
window.myLine = new Chart(ctx1).Line(lineChartData, {
showScale: false,
pointDot : true,
responsive: true
});
var ctx2 = document.getElementById("chart2").getContext("2d");
window.myLine = new Chart(ctx2).Line(lineChartData, {
responsive: true
});
};
</script>
</body>
</html>
+156
Ver Arquivo
@@ -0,0 +1,156 @@
<!doctype html>
<html>
<head>
<title>Pie Chart with Custom Tooltips</title>
<script src="../Chart.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<style>
#canvas-holder {
width: 100%;
margin-top: 50px;
text-align: center;
}
#chartjs-tooltip {
opacity: 1;
position: absolute;
background: rgba(0, 0, 0, .7);
color: white;
padding: 3px;
border-radius: 3px;
-webkit-transition: all .1s ease;
transition: all .1s ease;
pointer-events: none;
-webkit-transform: translate(-50%, 0);
transform: translate(-50%, 0);
}
#chartjs-tooltip.below {
-webkit-transform: translate(-50%, 0);
transform: translate(-50%, 0);
}
#chartjs-tooltip.below:before {
border: solid;
border-color: #111 transparent;
border-color: rgba(0, 0, 0, .8) transparent;
border-width: 0 8px 8px 8px;
bottom: 1em;
content: "";
display: block;
left: 50%;
position: absolute;
z-index: 99;
-webkit-transform: translate(-50%, -100%);
transform: translate(-50%, -100%);
}
#chartjs-tooltip.above {
-webkit-transform: translate(-50%, -100%);
transform: translate(-50%, -100%);
}
#chartjs-tooltip.above:before {
border: solid;
border-color: #111 transparent;
border-color: rgba(0, 0, 0, .8) transparent;
border-width: 8px 8px 0 8px;
bottom: 1em;
content: "";
display: block;
left: 50%;
top: 100%;
position: absolute;
z-index: 99;
-webkit-transform: translate(-50%, 0);
transform: translate(-50%, 0);
}
</style>
</head>
<body>
<div id="canvas-holder">
<canvas id="chart-area1" width="50" height="50" />
</div>
<div id="canvas-holder">
<canvas id="chart-area2" width="300" height="300" />
</div>
<div id="chartjs-tooltip"></div>
<script>
Chart.defaults.global.customTooltips = function(tooltip) {
// Tooltip Element
var tooltipEl = $('#chartjs-tooltip');
// Hide if no tooltip
if (!tooltip) {
tooltipEl.css({
opacity: 0
});
return;
}
// Set caret Position
tooltipEl.removeClass('above below');
tooltipEl.addClass(tooltip.yAlign);
// Set Text
tooltipEl.html(tooltip.text);
// Find Y Location on page
var top;
if (tooltip.yAlign == 'above') {
top = tooltip.y - tooltip.caretHeight - tooltip.caretPadding;
} else {
top = tooltip.y + tooltip.caretHeight + tooltip.caretPadding;
}
// Display, position, and set styles for font
tooltipEl.css({
opacity: 1,
left: tooltip.chart.canvas.offsetLeft + tooltip.x + 'px',
top: tooltip.chart.canvas.offsetTop + top + 'px',
fontFamily: tooltip.fontFamily,
fontSize: tooltip.fontSize,
fontStyle: tooltip.fontStyle,
});
};
var pieData = [{
value: 300,
color: "#F7464A",
highlight: "#FF5A5E",
label: "Red"
}, {
value: 50,
color: "#46BFBD",
highlight: "#5AD3D1",
label: "Green"
}, {
value: 100,
color: "#FDB45C",
highlight: "#FFC870",
label: "Yellow"
}, {
value: 40,
color: "#949FB1",
highlight: "#A8B3C5",
label: "Grey"
}, {
value: 120,
color: "#4D5360",
highlight: "#616774",
label: "Dark Grey"
}];
window.onload = function() {
var ctx1 = document.getElementById("chart-area1").getContext("2d");
window.myPie = new Chart(ctx1).Pie(pieData);
var ctx2 = document.getElementById("chart-area2").getContext("2d");
window.myPie = new Chart(ctx2).Pie(pieData);
};
</script>
</body>
</html>
+45 -36
Ver Arquivo
@@ -19,6 +19,12 @@
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - Whether to show horizontal lines (except X axis)
scaleShowHorizontalLines: true,
//Boolean - Whether to show vertical lines (except Y axis)
scaleShowVerticalLines: true,
//Boolean - If there is a stroke on each bar
barShowStroke : true,
@@ -32,7 +38,7 @@
barDatasetSpacing : 1,
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].fillColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span class=\"<%=name.toLowerCase()%>-legend-icon\" style=\"background-color:<%=datasets[i].fillColor%>\"></span><span class=\"<%=name.toLowerCase()%>-legend-text\"><%if(datasets[i].label){%><%=datasets[i].label%><%}%></span></li><%}%></ul>"
};
@@ -77,8 +83,10 @@
bar.restore(['fillColor', 'strokeColor']);
});
helpers.each(activeBars, function(activeBar){
activeBar.fillColor = activeBar.highlightFill;
activeBar.strokeColor = activeBar.highlightStroke;
if (activeBar) {
activeBar.fillColor = activeBar.highlightFill;
activeBar.strokeColor = activeBar.highlightStroke;
}
});
this.showTooltip(activeBars);
});
@@ -104,18 +112,16 @@
this.datasets.push(datasetObject);
helpers.each(dataset.data,function(dataPoint,index){
if (helpers.isNumber(dataPoint)){
//Add a new point for each piece of data, passing any required data to draw.
datasetObject.bars.push(new this.BarClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
strokeColor : dataset.strokeColor,
fillColor : dataset.fillColor,
highlightFill : dataset.highlightFill || dataset.fillColor,
highlightStroke : dataset.highlightStroke || dataset.strokeColor
}));
}
//Add a new point for each piece of data, passing any required data to draw.
datasetObject.bars.push(new this.BarClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
strokeColor : (typeof dataset.strokeColor == 'object') ? dataset.strokeColor[index] : dataset.strokeColor,
fillColor : (typeof dataset.fillColor == 'object') ? dataset.fillColor[index] : dataset.fillColor,
highlightFill : (dataset.highlightFill) ? (typeof dataset.highlightFill == 'object') ? dataset.highlightFill[index] : dataset.highlightFill : (typeof dataset.fillColor == 'object') ? dataset.fillColor[index] : dataset.fillColor,
highlightStroke : (dataset.highlightStroke) ? (typeof dataset.highlightStroke == 'object') ? dataset.highlightStroke[index] : dataset.highlightStroke : (typeof dataset.strokeColor == 'object') ? dataset.strokeColor[index] : dataset.strokeColor
}));
},this);
},this);
@@ -208,6 +214,8 @@
font : helpers.fontString(this.options.scaleFontSize, this.options.scaleFontStyle, this.options.scaleFontFamily),
lineWidth : this.options.scaleLineWidth,
lineColor : this.options.scaleLineColor,
showHorizontalLines : this.options.scaleShowHorizontalLines,
showVerticalLines : this.options.scaleShowVerticalLines,
gridLineWidth : (this.options.scaleShowGridLines) ? this.options.scaleGridLineWidth : 0,
gridLineColor : (this.options.scaleShowGridLines) ? this.options.scaleGridLineColor : "rgba(0,0,0,0)",
padding : (this.options.showScale) ? 0 : (this.options.barShowStroke) ? this.options.barStrokeWidth : 0,
@@ -230,19 +238,18 @@
addData : function(valuesArray,label){
//Map the values array for each of the datasets
helpers.each(valuesArray,function(value,datasetIndex){
if (helpers.isNumber(value)){
//Add a new point for each piece of data, passing any required data to draw.
this.datasets[datasetIndex].bars.push(new this.BarClass({
value : value,
label : label,
x: this.scale.calculateBarX(this.datasets.length, datasetIndex, this.scale.valuesCount+1),
y: this.scale.endPoint,
width : this.scale.calculateBarWidth(this.datasets.length),
base : this.scale.endPoint,
strokeColor : this.datasets[datasetIndex].strokeColor,
fillColor : this.datasets[datasetIndex].fillColor
}));
}
//Add a new point for each piece of data, passing any required data to draw.
this.datasets[datasetIndex].bars.push(new this.BarClass({
value : value,
label : label,
datasetLabel: this.datasets[datasetIndex].label,
x: this.scale.calculateBarX(this.datasets.length, datasetIndex, this.scale.valuesCount+1),
y: this.scale.endPoint,
width : this.scale.calculateBarWidth(this.datasets.length),
base : this.scale.endPoint,
strokeColor : this.datasets[datasetIndex].strokeColor,
fillColor : this.datasets[datasetIndex].fillColor
}));
},this);
this.scale.addXLabel(label);
@@ -279,13 +286,15 @@
//Draw all the bars for each dataset
helpers.each(this.datasets,function(dataset,datasetIndex){
helpers.each(dataset.bars,function(bar,index){
bar.base = this.scale.endPoint;
//Transition then draw
bar.transition({
x : this.scale.calculateBarX(this.datasets.length, datasetIndex, index),
y : this.scale.calculateY(bar.value),
width : this.scale.calculateBarWidth(this.datasets.length)
}, easingDecimal).draw();
if (bar.hasValue()){
bar.base = this.scale.endPoint;
//Transition then draw
bar.transition({
x : this.scale.calculateBarX(this.datasets.length, datasetIndex, index),
y : this.scale.calculateY(bar.value),
width : this.scale.calculateBarWidth(this.datasets.length)
}, easingDecimal).draw();
}
},this);
},this);
@@ -293,4 +302,4 @@
});
}).call(this);
}).call(this);
+507 -147
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+18 -8
Ver Arquivo
@@ -32,15 +32,14 @@
animateScale : false,
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span class=\"<%=name.toLowerCase()%>-legend-icon\" style=\"background-color:<%=segments[i].fillColor%>\"></span><span class=\"<%=name.toLowerCase()%>-legend-text\"><%if(segments[i].label){%><%=segments[i].label%><%}%></span></li><%}%></ul>"
};
Chart.Type.extend({
//Passing in a name registers this chart in the Chart namespace
name: "Doughnut",
//Providing a defaults will also register the deafults in the chart namespace
//Providing a defaults will also register the defaults in the chart namespace
defaults : defaultConfig,
//Initialize is fired when the chart is initialized - Data is passed in as a parameter
//Config is automatically merged by the core of Chart.js, and is available at this.options
@@ -73,6 +72,9 @@
this.calculateTotal(data);
helpers.each(data,function(datapoint, index){
if (!datapoint.color) {
datapoint.color = 'hsl(' + (360 * index / data.length) + ', 100%, 50%)';
}
this.addData(datapoint, index, true);
},this);
@@ -89,7 +91,11 @@
return segmentsArray;
},
addData : function(segment, atIndex, silent){
var index = atIndex || this.segments.length;
var index = atIndex !== undefined ? atIndex : this.segments.length;
if ( typeof(segment.color) === "undefined" ) {
segment.color = Chart.defaults.global.segmentColorDefault[index % Chart.defaults.global.segmentColorDefault.length];
segment.highlight = Chart.defaults.global.segmentHighlightColorDefaults[index % Chart.defaults.global.segmentHighlightColorDefaults.length];
}
this.segments.splice(index, 0, new this.SegmentArc({
value : segment.value,
outerRadius : (this.options.animateScale) ? 0 : this.outerRadius,
@@ -108,13 +114,17 @@
this.update();
}
},
calculateCircumference : function(value){
return (Math.PI*2)*(value / this.total);
calculateCircumference : function(value) {
if ( this.total > 0 ) {
return (Math.PI*2)*(value / this.total);
} else {
return 0;
}
},
calculateTotal : function(data){
this.total = 0;
helpers.each(data,function(segment){
this.total += segment.value;
this.total += Math.abs(segment.value);
},this);
},
update : function(){
@@ -181,4 +191,4 @@
defaults : helpers.merge(defaultConfig,{percentageInnerCutout : 0})
});
}).call(this);
}).call(this);
+96 -56
Ver Arquivo
@@ -16,6 +16,12 @@
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - Whether to show horizontal lines (except X axis)
scaleShowHorizontalLines: true,
//Boolean - Whether to show vertical lines (except Y axis)
scaleShowVerticalLines: true,
//Boolean - Whether the line is curved between points
bezierCurve : true,
@@ -44,7 +50,10 @@
datasetFill : true,
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span class=\"<%=name.toLowerCase()%>-legend-icon\" style=\"background-color:<%=datasets[i].strokeColor%>\"></span><span class=\"<%=name.toLowerCase()%>-legend-text\"><%if(datasets[i].label){%><%=datasets[i].label%><%}%></span></li><%}%></ul>",
//Boolean - Whether to horizontally center the label and point dot inside the grid
offsetGridLines : false
};
@@ -55,6 +64,7 @@
initialize: function(data){
//Declare the extension of the default point, to cater for the options passed in to the constructor
this.PointClass = Chart.Point.extend({
offsetGridLines : this.options.offsetGridLines,
strokeWidth : this.options.pointDotStrokeWidth,
radius : this.options.pointDotRadius,
display: this.options.pointDot,
@@ -98,19 +108,16 @@
helpers.each(dataset.data,function(dataPoint,index){
//Best way to do this? or in draw sequence...?
if (helpers.isNumber(dataPoint)){
//Add a new point for each piece of data, passing any required data to draw.
datasetObject.points.push(new this.PointClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
strokeColor : dataset.pointStrokeColor,
fillColor : dataset.pointColor,
highlightFill : dataset.pointHighlightFill || dataset.pointColor,
highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor
}));
}
datasetObject.points.push(new this.PointClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
strokeColor : dataset.pointStrokeColor,
fillColor : dataset.pointColor,
highlightFill : dataset.pointHighlightFill || dataset.pointColor,
highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor
}));
},this);
this.buildScale(data.labels);
@@ -173,6 +180,7 @@
width : this.chart.width,
ctx : this.chart.ctx,
textColor : this.options.scaleFontColor,
offsetGridLines : this.options.offsetGridLines,
fontSize : this.options.scaleFontSize,
fontStyle : this.options.scaleFontStyle,
fontFamily : this.options.scaleFontFamily,
@@ -193,6 +201,8 @@
font : helpers.fontString(this.options.scaleFontSize, this.options.scaleFontStyle, this.options.scaleFontFamily),
lineWidth : this.options.scaleLineWidth,
lineColor : this.options.scaleLineColor,
showHorizontalLines : this.options.scaleShowHorizontalLines,
showVerticalLines : this.options.scaleShowVerticalLines,
gridLineWidth : (this.options.scaleShowGridLines) ? this.options.scaleGridLineWidth : 0,
gridLineColor : (this.options.scaleShowGridLines) ? this.options.scaleGridLineColor : "rgba(0,0,0,0)",
padding: (this.options.showScale) ? 0 : this.options.pointDotRadius + this.options.pointDotStrokeWidth,
@@ -217,17 +227,16 @@
//Map the values array for each of the datasets
helpers.each(valuesArray,function(value,datasetIndex){
if (helpers.isNumber(value)){
//Add a new point for each piece of data, passing any required data to draw.
this.datasets[datasetIndex].points.push(new this.PointClass({
value : value,
label : label,
x: this.scale.calculateX(this.scale.valuesCount+1),
y: this.scale.endPoint,
strokeColor : this.datasets[datasetIndex].pointStrokeColor,
fillColor : this.datasets[datasetIndex].pointColor
}));
}
//Add a new point for each piece of data, passing any required data to draw.
this.datasets[datasetIndex].points.push(new this.PointClass({
value : value,
label : label,
datasetLabel: this.datasets[datasetIndex].label,
x: this.scale.calculateX(this.scale.valuesCount+1),
y: this.scale.endPoint,
strokeColor : this.datasets[datasetIndex].pointStrokeColor,
fillColor : this.datasets[datasetIndex].pointColor
}));
},this);
this.scale.addXLabel(label);
@@ -255,37 +264,65 @@
var ctx = this.chart.ctx;
// Some helper methods for getting the next/prev points
var hasValue = function(item){
return item.value !== null;
},
nextPoint = function(point, collection, index){
return helpers.findNextWhere(collection, hasValue, index) || point;
},
previousPoint = function(point, collection, index){
return helpers.findPreviousWhere(collection, hasValue, index) || point;
};
if (!this.scale) return;
this.scale.draw(easingDecimal);
helpers.each(this.datasets,function(dataset){
var pointsWithValues = helpers.where(dataset.points, hasValue);
//Transition each point first so that the line and point drawing isn't out of sync
//We can use this extra loop to calculate the control points of this dataset also in this loop
helpers.each(dataset.points,function(point,index){
point.transition({
y : this.scale.calculateY(point.value),
x : this.scale.calculateX(index)
}, easingDecimal);
helpers.each(dataset.points, function(point, index){
if (point.hasValue()){
point.transition({
y : this.scale.calculateY(point.value),
x : this.scale.calculateX(index)
}, easingDecimal);
}
},this);
// Control points need to be calculated in a seperate loop, because we need to know the current x/y of the point
// Control points need to be calculated in a separate loop, because we need to know the current x/y of the point
// This would cause issues when there is no animation, because the y of the next point would be 0, so beziers would be skewed
if (this.options.bezierCurve){
helpers.each(dataset.points,function(point,index){
//If we're at the start or end, we don't have a previous/next point
//By setting the tension to 0 here, the curve will transition to straight at the end
if (index === 0){
point.controlPoints = helpers.splineCurve(point,point,dataset.points[index+1],0);
helpers.each(pointsWithValues, function(point, index){
var tension = (index > 0 && index < pointsWithValues.length - 1) ? this.options.bezierCurveTension : 0;
point.controlPoints = helpers.splineCurve(
previousPoint(point, pointsWithValues, index),
point,
nextPoint(point, pointsWithValues, index),
tension
);
// Prevent the bezier going outside of the bounds of the graph
// Cap puter bezier handles to the upper/lower scale bounds
if (point.controlPoints.outer.y > this.scale.endPoint){
point.controlPoints.outer.y = this.scale.endPoint;
}
else if (index >= dataset.points.length-1){
point.controlPoints = helpers.splineCurve(dataset.points[index-1],point,point,0);
else if (point.controlPoints.outer.y < this.scale.startPoint){
point.controlPoints.outer.y = this.scale.startPoint;
}
else{
point.controlPoints = helpers.splineCurve(dataset.points[index-1],point,dataset.points[index+1],this.options.bezierCurveTension);
// Cap inner bezier handles to the upper/lower scale bounds
if (point.controlPoints.inner.y > this.scale.endPoint){
point.controlPoints.inner.y = this.scale.endPoint;
}
else if (point.controlPoints.inner.y < this.scale.startPoint){
point.controlPoints.inner.y = this.scale.startPoint;
}
},this);
}
@@ -295,12 +332,18 @@
ctx.lineWidth = this.options.datasetStrokeWidth;
ctx.strokeStyle = dataset.strokeColor;
ctx.beginPath();
helpers.each(dataset.points,function(point,index){
if (index>0){
helpers.each(pointsWithValues, function(point, index){
if (index === 0){
ctx.moveTo(point.x, point.y);
}
else{
if(this.options.bezierCurve){
var previous = previousPoint(point, pointsWithValues, index);
ctx.bezierCurveTo(
dataset.points[index-1].controlPoints.outer.x,
dataset.points[index-1].controlPoints.outer.y,
previous.controlPoints.outer.x,
previous.controlPoints.outer.y,
point.controlPoints.inner.x,
point.controlPoints.inner.y,
point.x,
@@ -310,19 +353,17 @@
else{
ctx.lineTo(point.x,point.y);
}
}
else{
ctx.moveTo(point.x,point.y);
}
},this);
ctx.stroke();
}, this);
if (this.options.datasetStroke) {
ctx.stroke();
}
if (this.options.datasetFill){
if (this.options.datasetFill && pointsWithValues.length > 0){
//Round off the line by going to the base of the chart, back to the start, then fill.
ctx.lineTo(dataset.points[dataset.points.length-1].x, this.scale.endPoint);
ctx.lineTo(this.scale.calculateX(0), this.scale.endPoint);
ctx.lineTo(pointsWithValues[pointsWithValues.length - 1].x, this.scale.endPoint);
ctx.lineTo(pointsWithValues[0].x, this.scale.endPoint);
ctx.fillStyle = dataset.fillColor;
ctx.closePath();
ctx.fill();
@@ -331,13 +372,12 @@
//Now draw the points over the line
//A little inefficient double looping, but better than the line
//lagging behind the point positions
helpers.each(dataset.points,function(point){
helpers.each(pointsWithValues,function(point){
point.draw();
});
},this);
}
});
}).call(this);
}).call(this);
+6 -4
Ver Arquivo
@@ -28,7 +28,7 @@
//Boolean - Stroke a line around each segment in the chart
segmentShowStroke : true,
//String - The colour of the stroke on each segement.
//String - The colour of the stroke on each segment.
segmentStrokeColor : "#fff",
//Number - The width of the stroke value in pixels
@@ -47,14 +47,14 @@
animateScale : false,
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span class=\"<%=name.toLowerCase()%>-legend-icon\" style=\"background-color:<%=segments[i].fillColor%>\"></span><span class=\"<%=name.toLowerCase()%>-legend-text\"><%if(segments[i].label){%><%=segments[i].label%><%}%></span></li><%}%></ul>"
};
Chart.Type.extend({
//Passing in a name registers this chart in the Chart namespace
name: "PolarArea",
//Providing a defaults will also register the deafults in the chart namespace
//Providing a defaults will also register the defaults in the chart namespace
defaults : defaultConfig,
//Initialize is fired when the chart is initialized - Data is passed in as a parameter
//Config is automatically merged by the core of Chart.js, and is available at this.options
@@ -195,6 +195,8 @@
helpers.each(this.segments,function(segment){
segment.save();
});
this.reflow();
this.render();
},
reflow : function(){
@@ -245,4 +247,4 @@
}
});
}).call(this);
}).call(this);
+40 -34
Ver Arquivo
@@ -28,6 +28,9 @@
//Number - Pixel width of the angle line
angleLineWidth : 1,
//Number - Interval at which to draw angle lines ("every Nth point")
angleLineInterval: 1,
//String - Point label font declaration
pointLabelFontFamily : "'Arial'",
@@ -62,7 +65,7 @@
datasetFill : true,
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span class=\"<%=name.toLowerCase()%>-legend-icon\" style=\"background-color:<%=datasets[i].strokeColor%>\"></span><span class=\"<%=name.toLowerCase()%>-legend-text\"><%if(datasets[i].label){%><%=datasets[i].label%><%}%></span></li><%}%></ul>"
},
@@ -111,25 +114,22 @@
this.datasets.push(datasetObject);
helpers.each(dataset.data,function(dataPoint,index){
//Best way to do this? or in draw sequence...?
if (helpers.isNumber(dataPoint)){
//Add a new point for each piece of data, passing any required data to draw.
var pointPosition;
if (!this.scale.animation){
pointPosition = this.scale.getPointPosition(index, this.scale.calculateCenterOffset(dataPoint));
}
datasetObject.points.push(new this.PointClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
x: (this.options.animation) ? this.scale.xCenter : pointPosition.x,
y: (this.options.animation) ? this.scale.yCenter : pointPosition.y,
strokeColor : dataset.pointStrokeColor,
fillColor : dataset.pointColor,
highlightFill : dataset.pointHighlightFill || dataset.pointColor,
highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor
}));
var pointPosition;
if (!this.scale.animation){
pointPosition = this.scale.getPointPosition(index, this.scale.calculateCenterOffset(dataPoint));
}
datasetObject.points.push(new this.PointClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
x: (this.options.animation) ? this.scale.xCenter : pointPosition.x,
y: (this.options.animation) ? this.scale.yCenter : pointPosition.y,
strokeColor : dataset.pointStrokeColor,
fillColor : dataset.pointColor,
highlightFill : dataset.pointHighlightFill || dataset.pointColor,
highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor
}));
},this);
},this);
@@ -177,12 +177,14 @@
showLabels: this.options.scaleShowLabels,
showLabelBackdrop: this.options.scaleShowLabelBackdrop,
backdropColor: this.options.scaleBackdropColor,
backgroundColors: this.options.scaleBackgroundColors,
backdropPaddingY : this.options.scaleBackdropPaddingY,
backdropPaddingX: this.options.scaleBackdropPaddingX,
lineWidth: (this.options.scaleShowLine) ? this.options.scaleLineWidth : 0,
lineColor: this.options.scaleLineColor,
angleLineColor : this.options.angleLineColor,
angleLineWidth : (this.options.angleShowLineOut) ? this.options.angleLineWidth : 0,
angleLineInterval: (this.options.angleLineInterval) ? this.options.angleLineInterval : 1,
// Point labels at the edge of each line
pointLabelFontColor : this.options.pointLabelFontColor,
pointLabelFontSize : this.options.pointLabelFontSize,
@@ -244,17 +246,16 @@
//Map the values array for each of the datasets
this.scale.valuesCount++;
helpers.each(valuesArray,function(value,datasetIndex){
if (helpers.isNumber(value)){
var pointPosition = this.scale.getPointPosition(this.scale.valuesCount, this.scale.calculateCenterOffset(value));
this.datasets[datasetIndex].points.push(new this.PointClass({
value : value,
label : label,
x: pointPosition.x,
y: pointPosition.y,
strokeColor : this.datasets[datasetIndex].pointStrokeColor,
fillColor : this.datasets[datasetIndex].pointColor
}));
}
var pointPosition = this.scale.getPointPosition(this.scale.valuesCount, this.scale.calculateCenterOffset(value));
this.datasets[datasetIndex].points.push(new this.PointClass({
value : value,
label : label,
datasetLabel: this.datasets[datasetIndex].label,
x: pointPosition.x,
y: pointPosition.y,
strokeColor : this.datasets[datasetIndex].pointStrokeColor,
fillColor : this.datasets[datasetIndex].pointColor
}));
},this);
this.scale.labels.push(label);
@@ -301,7 +302,9 @@
//Transition each point first so that the line and point drawing isn't out of sync
helpers.each(dataset.points,function(point,index){
point.transition(this.scale.getPointPosition(index, this.scale.calculateCenterOffset(point.value)), easeDecimal);
if (point.hasValue()){
point.transition(this.scale.getPointPosition(index, this.scale.calculateCenterOffset(point.value)), easeDecimal);
}
},this);
@@ -322,13 +325,16 @@
ctx.stroke();
ctx.fillStyle = dataset.fillColor;
ctx.fill();
if(this.options.datasetFill){
ctx.fill();
}
//Now draw the points over the line
//A little inefficient double looping, but better than the line
//lagging behind the point positions
helpers.each(dataset.points,function(point){
point.draw();
if (point.hasValue()){
point.draw();
}
});
},this);
@@ -341,4 +347,4 @@
}).call(this);
}).call(this);