Commit Graph

280 Commits

Author SHA1 Message Date
Evert Timberg
ee383ef4a6 Logarithmic scale improvements 2016-05-08 09:24:45 -04:00
Evert Timberg
e86a13dcef More linear scale work 2016-05-08 08:32:48 -04:00
Evert Timberg
b35b246414 Merge branch 'master' into file-size-reduction 2016-05-08 08:11:16 -04:00
Evert Timberg
4ef5d942e6 Linear scale improvements 2016-05-08 07:55:29 -04:00
Evert Timberg
bc505b1a9d beginAtZero and linear scales with no data should play nice 2016-05-07 16:56:04 -04:00
Evert Timberg
8d88e9c3b7 Fix time scale grid lines 2016-05-06 07:57:28 -04:00
Evert Timberg
38373300ee Improve time scale for zoom and pan
* Improve time scale for zoom and pan
Improve category scale when zoomed

* Fix CI test
2016-05-01 11:40:14 -05:00
Evert Timberg
cb54f30c97 Implement getValueForPixel for category scale 2016-04-30 08:39:18 -04:00
Evert Timberg
6df9b24ecd Merge from feature/pan-support
All tests are passing
2016-04-29 20:03:15 -04:00
Lighnat0r
200abc184b update isDatasetVisible call 2016-04-27 23:18:03 +02:00
Lighnat0r
6b32466a19 update time scale range only for visible datasets 2016-04-27 22:46:49 +02:00
Evert Timberg
450a08420b Merge pull request #2371 from chartjs/fix-time-scale-cutoff-bug
Time scale now compensates for rounded tick units
2016-04-27 15:39:02 -04:00
Simon Brunel
29115c9d2c Handle data visibility per chart
New Chart.Element.hidden bool flag storing the visibility state of its associated data. Since elements belong to a specific chart, this change allows to manage data visibility per chart (e.g. when clicking the legend of some charts).

This commit also changes (fixes?) the polar chart animation when data visibility changes. Previous implementation was affected by an edge effect due to the use of NaN as hidden implementation.
2016-04-26 12:46:29 +02:00
Simon Brunel
82b1e5cd99 Handle effective dataset visibility per chart
Introduced a new meta.hidden 3 states flag (null|true|false) to be able to override dataset.hidden when interacting with the chart (i.e., true or false to ignore the dataset.hidden value). This is required in order to be able to correctly share dataset.hidden between multiple charts.

For example: 2 charts are sharing the same data and dataset.hidden is initially false: the dataset will be displayed on both charts because meta.hidden is null. If the user clicks the legend of the first chart, meta.hidden is changed to true and the dataset is only hidden on the first chart. If dataset.hidden changes, only the second chart will have the dataset visibility updated and that until the user click again on the first chart legend, switching the meta.hidden to null.
2016-04-26 12:46:27 +02:00
Simon Brunel
f3457c9941 Handle dataset type per chart
Dataset effective type is now stored under meta.type, allowing many charts to share the same dataset but with different types. Also move dataset.bar flag to meta.bar.
2016-04-26 12:46:26 +02:00
Simon Brunel
51aa9b4a27 Allow multiple charts sharing the same data
Meta info are now scoped by chart and moved under the dataset._meta map { chart.id -> meta }. Meta for a specific chart (and dataset) can be accessed using chart.getDatasetMeta(datasetIndex) or from the dataset controller using getMeta(). Note that helpers.uid() now generates an int (instead of a string) to make lookups in the _meta map faster.
2016-04-26 12:46:24 +02:00
Tanner Linsley
da90e2f670 Time scale now compensates for rounded tick units
Closes #2277
2016-04-25 17:48:21 -05:00
Evert Timberg
bbd4364f64 Only use valid label moments 2016-04-24 09:14:21 -04:00
Evert Timberg
c31c90b2e4 Backwards pixel to value API 2016-04-23 13:27:10 -04:00
Evert Timberg
bc90aaa522 Start on pan support 2016-04-21 07:48:47 -04:00
Evert Timberg
1a49872ce4 More prework for zoom/pan 2016-04-17 10:33:38 -04:00
Tanner Linsley
4f60eecc01 Better default tick rotation and tick autoskip settings (#2258)
* Better default tick rotation and tick autoskip settings

* scale.time: Use ctx to measure label, and <= instead of < for unit fitting

* Test Changes

* Passing Tests with new defaults
2016-04-16 17:38:03 -05:00
Evert Timberg
a7fede4f46 Fix jshint error 2016-04-03 09:15:11 -04:00
Evert Timberg
9ee70d6d48 Category scale supports min / max 2016-04-02 23:05:48 -04:00
etimberg
998c6939bf Instead of showing a warning on load, throw an error on create if moment is not defined. 2016-03-16 19:59:20 -04:00
etimberg
21a33f0e41 Better conversion to ticks to make it easier to use callbacks 2016-03-16 19:39:09 -04:00
Evert Timberg
9bcc3ca34c Allow ticks.fixedStepSize or ticks.stepSize options to mean the same thing 2016-03-06 08:56:31 -05:00
Evert Timberg
c3f765857e Fix some time rounding problems 2016-03-05 22:58:34 -05:00
Matthias Winkelmann
b69b388b31 fixed travis built 2016-03-02 14:16:52 +01:00
Matthias Winkelmann
d5f837843e Fixes nnnick/Chart.js#2086 by introducing a new time.parser option with high priority to replace the (deprecated) time.format 2016-03-02 13:53:35 +01:00
Evert Timberg
8d5b3809f6 Fix global font settings 2016-02-28 13:41:17 -05:00
Evert Timberg
b812bcc8a5 Fix #2009 2016-02-27 08:58:27 -05:00
Evert Timberg
309ab1f477 Disable autoskipper for time scales 2016-02-15 09:41:35 -05:00
etimberg
01b88f19df Clean up code climate style issues and formatting. 2016-02-14 17:06:00 -05:00
etimberg
f6951816a0 Improve joshing reporting. Added a JSHint config file.
Fixed JSHint warnings.
2016-02-13 20:12:26 -05:00
Tanner Linsley
813d18bd78 Passing All Tests, Updated Dependencies 2016-02-11 23:16:43 -07:00
Tanner Linsley
007d029837 Bundled builds
Possible usages are:

src/Chart.js (umd)
dist/Chart.js (ChartJS)
dist/Chart.min.js (ChartJS minified)
dist/Chart.bundle.js (ChartJS with Moment.js)
dist/Chart.bundle.min.js (ChartJS with Moment.js minified)
2016-02-11 21:29:26 -07:00
Tanner Linsley
f2780bb825 Browserify for easier UMD consumptions and vanilla builds 2016-02-11 20:30:53 -07:00
Robert Becker
e9c18f603d Merged remote-tracking branch 'upstream/v2.0-dev' into v2.0-dev to fix conflicts.
Refactored linear scale fixed step size implementation.
Added nbproject to .gitignore
2016-02-09 12:56:16 +01:00
Evert Timberg
61ca178e2b Write an almost equals function and use it in the linear scale. Added a test for this new function. 2016-02-06 09:38:44 -05:00
Robert Becker
098b05f1b2 Further reformatted scale.linear.js to match original indenting.
Refactored and fixed scale calculation.
Added dist files to commit.
2016-02-05 09:41:45 +01:00
Robert Becker
85de9fbe9c Further reformatted scale.linear.js to match original indenting. 2016-02-05 09:33:57 +01:00
Robert Becker
80ede9b9bb Added documentation for fixedStepSize.
Reformatted scale.linear.js to match original indenting.
2016-02-05 09:28:50 +01:00
Robert Becker
09721407d2 Removed debug log. 2016-02-04 15:28:06 +01:00
Robert Becker
9a20381af4 Fixed typo in core.helpers.js.
Added ticks.fixedStepSize configuration parameter to force linear scale steps.
2016-02-04 15:20:17 +01:00
Evert Timberg
d16f4fc5ce Add default font options 2016-02-01 21:06:54 -05:00
Evert Timberg
0e8babf1d7 Fix stacked bar data limit calculation 2016-02-01 18:44:39 -05:00
Evert Timberg
172c088c6b Minor fix 2016-01-30 17:19:32 -05:00
Evert Timberg
f75116a91e Update millisecond default format. Removed unnecessary space at right edge of time scale. 2016-01-30 16:35:10 -05:00
Evert Timberg
68ab74a46d Fix linear scale stacked mode 2016-01-24 09:22:28 -05:00
Evert Timberg
c312835eb1 Add some tests for scales. Cleaned up some minor bugs in the time scale. Wrote better helpers for helpers.min and helpers.max 2016-01-23 12:44:55 -05:00
Evert Timberg
1de0435feb Fix reversed ticks on linear scale + update test 2016-01-17 20:37:43 -05:00
Evert Timberg
0ed27d4474 Make sure tick string could be null / undefined 2016-01-09 14:42:55 -05:00
Evert Timberg
5070059ac1 Add template option for point labels + test + doc update 2016-01-09 14:39:43 -05:00
etimberg
8dca052a16 Add suggestedMin, suggestedMax, min, and max options to radialLinear scale 2016-01-02 21:03:09 -05:00
etimberg
ff11975648 Fix issues identified in PR 2015-12-27 11:48:14 -05:00
Tore Lervik
a0c359ee80 min/max should have precedence over suggestedMin/suggestedMax 2015-12-25 13:53:09 +01:00
Tore Lervik
c078ae15f0 Fixed a typo 2015-12-21 22:43:20 +01:00
Tore Lervik
86ca455cb6 Refactored firstTick null check 2015-12-21 22:40:33 +01:00
Tore Lervik
477fc72693 firstTick and lastTick can be null if the chart is empty. 2015-12-21 22:34:31 +01:00
Tore Lervik
3577d959d0 Have to check for undefined because "if (0.0)" would equal false. 2015-12-21 20:28:20 +01:00
Evert Timberg
c8d3831152 Split out data limits step of scales into it's own step. Wire up callbacks from the options to those in the scale life-cycle. Updated the docs accordingly 2015-12-17 09:21:04 -05:00
Evert Timberg
f51d7753bd Update logarithmic algorithm 2015-12-15 19:18:18 -05:00
Evert Timberg
3e3912973c Slight improvement to new min/max options so that linear scales look right 2015-12-15 18:58:05 -05:00
Mattias Lyckne
968db4e783 Adds min and max setting to axes 2015-12-14 09:22:34 +01:00
Evert Timberg
28fc6841f3 Add tooltipFormat option to time scale options.
Fix bars when displayed on a time scale.
Updated sample files.
2015-12-05 19:33:33 -05:00
Tanner Linsley
62bc4e42ec Merge pull request #1736 from nnnick/umd-build
Umd build
2015-12-02 20:37:04 -07:00
etimberg
40c8289ce8 Time scale uses moment loaded through UMD 2015-12-02 21:10:51 -05:00
etimberg
25f061f340 Fix test failures 2015-12-01 21:07:53 -05:00
etimberg
6b3fd19fa9 Time scale will now scale units. For example, it will try 1hr then 2hrs then 3 hrs then 6 hrs then 12 hrs ... until it finds a unit that fits. 2015-12-01 20:02:44 -05:00
etimberg
f609452727 Allow the user to change the time label display formats 2015-11-30 20:42:48 -05:00
Evert Timberg
a90aac7b26 Change scale show properties to display and update tests 2015-11-24 19:18:15 -05:00
Evert Timberg
ead6247cd8 Make sure data is converted to a number in scales when determining min and max. Add tests for this condition to linear, radialLinear, and logarithmic scales. 2015-11-17 18:43:18 -05:00
Tanner Linsley
ae9db841f9 Merge pull request #1646 from nnnick/fix/1640
Can now replace entire chart data object on the fly
2015-11-16 16:10:01 -07:00
Evert Timberg
045d8f6c2a Keep this as NaN so point._view.skip is set correctly 2015-11-15 11:16:17 -05:00
Evert Timberg
d61745a311 Handle transitioning NaNs 2015-11-14 22:49:53 -05:00
Evert Timberg
66bc1dc492 Reference data from the main controller wherever possible. Updated tests to account for this. 2015-11-13 09:38:35 -05:00
Pascal Richier
d5d63070c6 Add options.ticks.maxTicksLimit
To be able to change default '11' value
2015-11-07 01:39:30 +01:00
Pascal Richier
97da3347be Add options.ticks.maxTicksLimit
To be able to change default '11' value
2015-11-07 01:37:09 +01:00
Evert Timberg
4267d01bc2 Log scale + tests 2015-11-01 09:07:18 -05:00
Evert Timberg
8324b35506 Update linear scale + tests 2015-11-01 08:45:12 -05:00
Evert Timberg
cf587122da Merge pull request #1586 from nnnick/fix/begin-at-zero-issue-with-constant-data
Scale expansion if min === max will only occur after ticks.beginAtZero is handled
2015-10-31 20:23:57 -04:00
etimberg
3aaa3e27f3 suggestedMin and suggestedMax options for scales 2015-10-31 11:01:40 -04:00
etimberg
1017934dce tooltips for radar charts are working 2015-10-30 20:35:36 -04:00
etimberg
988034cef6 Scale expansion if min === max will only occur after ticks.beginAtZero is handled 2015-10-27 20:04:21 -04:00
Tanner Linsley
559ee6291e Merge pull request #1567 from nnnick/fix/rounding
Better linear scale tick formatter + small tick generation
2015-10-24 01:40:43 -06:00
Tanner Linsley
2cd4b13135 radialLInear getPointPosition now rounds crazy decimals
This particular part of testing was succeeding in chrome, and failing
in firefox.  It should be rounded anyway.
2015-10-24 01:23:13 -06:00
etimberg
0c3d9ec5dd Improved number format function. Also improved the generation of small tick values 2015-10-23 22:00:59 -04:00
Tanner Linsley
ea571003d9 Scale min/max calculations now disregard bad values 2015-10-23 16:41:11 -06:00
etimberg
24e8fe3a4b Merge remote-tracking branch 'origin/v2.0-dev' into v2.0-dev-tooltip-refactor 2015-10-21 20:18:23 -04:00
etimberg
e46a2cb074 Fix JSHint errors 2015-10-20 20:33:51 -04:00
Tanner Linsley
35011e5ae3 Support min and max dates on time scale 2015-10-19 21:23:01 -06:00
etimberg
bfabac945f Labels are now optional for the time scale. 2015-10-19 19:20:08 -04:00
Evert Timberg
86a52d0302 Fix some test failures 2015-10-18 19:34:56 -04:00
etimberg
2b057cf690 Merge remote-tracking branch 'origin/v2.0-dev' into v2.0-dev-tooltip-refactor 2015-10-18 18:17:39 -04:00
etimberg
7603b3cc36 Time scales now support passing in data as points. Added this to the time scale sample file. 2015-10-18 18:00:46 -04:00
etimberg
180209e55c Factor out getLabelForIndex into each scale so we can return appropriate data based on the scale type 2015-10-18 16:13:57 -04:00
Tanner Linsley
e0918817ae Testing fixes for time scale 2015-10-16 21:14:07 -06:00
Evert Timberg
aaec5efd52 Scales will only consider visible datasets when calculating data max and min values 2015-10-07 19:37:53 -04:00
Tanner Linsley
ef5cec7f5e Tooltips now using new lineArray format 2015-10-06 20:40:25 -06:00
Tanner Linsley
e24406fc9d Ensure tickUnit and displayFormat set before format loop 2015-09-29 10:54:42 -06:00
Tanner Linsley
1bdf5edc24 Time Scale now requires and warns for Moment.js dep 2015-09-28 11:27:47 -06:00
Evert Timberg
bc7d1d39fd Convert the radialLinear scale to derive from Core.scale. Radial linear scale is now fit using the scale service. Added tests for the radialLinear scale. 2015-09-27 11:58:20 -04:00
Evert Timberg
be4facdea9 Time scale tests. 2015-09-27 09:38:11 -04:00
Evert Timberg
5156e633ca Category scale tests 2015-09-26 16:52:14 -04:00
Evert Timberg
3d1e1b1605 Updated core.scale draw code with minor improvements and features that broke during integration (such as mirror option for labels). Updated linear and logarithmic tests. Update config merge to use scaleMerge since it prevents overriding the default entirely. 2015-09-25 21:04:45 -04:00
Evert Timberg
cf944ae651 Make sure ticks are converted to strings. Handle this in the core. Updated linear scale tests & fixed some minor issues. Only 3 fails now in the linear scale. 2015-09-24 22:08:25 -04:00
Tanner Linsley
4c2027aabb Horizontal Log Scale 2015-09-24 12:59:03 -06:00
Tanner Linsley
440703efff Log Scale Working Again 2015-09-24 12:31:18 -06:00
Tanner Linsley
d198157fb8 Time Scale working, troubleshooting log scale 2015-09-24 12:07:40 -06:00
Tanner Linsley
ca48caa8b0 checkpoint for the morning check
made some good progress.  Just need some more eyes on it, cuz I’m
literally typing without my glasses on right now.
2015-09-24 02:25:21 -06:00
Tanner Linsley
e2a96501b7 Vertical Scales are a bit better now 2015-09-23 23:23:20 -06:00
Tanner Linsley
c7107677d2 Stuck on shared vertical scale draw logic
Trying to make all scales share the same draw function for both
horizontal and vertical.  For some reason the vertical linear scale on
line.html has a width that is too small
2015-09-23 21:52:31 -06:00
Tanner Linsley
9b9ebca246 Checkpoint 1, Pew!!!! 2015-09-22 19:31:26 -06:00
Tanner Linsley
301efac8dd Merge pull request #1477 from etimberg/feature/scale-labels
Scale Labels
2015-09-21 17:52:09 -06:00
Tanner Linsley
8c94ae0441 Ensure bar width at least 1px 2015-09-21 13:17:27 -06:00
Tanner Linsley
01fdd387d9 Merge pull request #1474 from nnnick/v2.0-feature-dynamic-bar-spacing
Bar spacing is now dynamic at small sizes.
2015-09-21 13:08:09 -06:00
Tanner Linsley
e3e66d2425 Time scale support 2015-09-21 13:04:41 -06:00
Tanner Linsley
154083b875 Bar spacing is now dynamic at small sizes.
Closes #1468
2015-09-21 12:57:04 -06:00
Tanner Linsley
2a76ff0037 Time scale now draws all ticks, instead of half of them
Closes #1463
2015-09-21 11:52:17 -06:00
Evert Timberg
f4cdd20a38 Time scale has a label now 2015-09-20 19:24:46 -04:00
Evert Timberg
b7c7f1d6a4 Category scale has labels 2015-09-20 19:18:59 -04:00
Evert Timberg
2667807c1d Logarithmic scale now has labels 2015-09-20 19:06:09 -04:00
Evert Timberg
b1060f20ec Linear scale has labels 2015-09-20 18:59:58 -04:00
Tanner Linsley
862045e49a Merge pull request #1465 from nnnick/v2.0-dev-time-scale-bars-and-combo
Bar and combo support for time scale
2015-09-18 18:59:58 -06:00
Tanner Linsley
677c249b61 Bar and combo support for time scale 2015-09-18 11:31:25 -06:00
Evert Timberg
723c85320f Unit tests for logarithmic scale. Fixed some issues in stacked mode since it's not possible for a 0 crossing to occur with a log scale. 2015-09-17 20:29:41 -04:00
Tanner Linsley
92682abbae Merge pull request #1459 from nnnick/v2.0-dev-feature-time-axis
V2.0 dev feature time axis
2015-09-17 15:54:44 -06:00
Tanner Linsley
2598446d54 Time Scale Rewrite 2015-09-15 11:40:01 -06:00
Evert Timberg
eb657bce36 Hide labels when the user returns null from the userCallback. This is the same as the category scale 2015-09-14 20:34:49 -04:00
Evert Timberg
c1f0a39982 Fixes to show all lines but not all labels. Added a variable in the template function to make debugging nicer. 2015-09-14 20:32:23 -04:00
Evert Timberg
b172a382f1 Remove dead code in logarithmic scale. Fixed a padding bug that had previously been fixed in the linear scale 2015-09-14 19:45:13 -04:00
Evert Timberg
77f90a85ef Merge remote-tracking branch 'upstream/v2.0-dev' into feature/logarithmic_scale 2015-09-14 18:59:52 -04:00
Tanner Linsley
88d30d8c93 Let tooltips use time formatted labels if they exist 2015-09-11 12:20:32 -06:00
Tanner Linsley
c2a7e4c251 Time Scale Base 2015-09-10 22:48:48 -06:00
Evert Timberg
4d51f21831 Merge pull request #1436 from honza889/reverse-radar
Reverse scale on radar / polar area
2015-09-02 17:46:35 -04:00
Jan Kalina
ef539bf4a7 Reverse scale on radar/polar area 2015-09-02 23:21:39 +02:00
Evert Timberg
c8d5856216 Start testing the linear scale fit code 2015-08-30 21:49:39 -04:00
Tanner Linsley
bc3948ce59 Merge pull request #1408 from etimberg/feature/unit-test
Initial unit test framework + linear scale test starting point
2015-08-28 16:26:10 -06:00
Tanner Linsley
bade753fe3 Don't account for paddingLeft until after rotated 2015-08-28 15:12:35 -06:00
Evert Timberg
b4b3bf60b8 Remove wrong addition of padding 2015-08-23 17:17:21 -04:00
Evert Timberg
04d1f0f710 Category scale filter function will hide the grid line if null or undefined returned. 2015-08-23 13:20:43 -04:00
Evert Timberg
02abc46d5e Count the number of bars when determining the bar width 2015-08-22 16:56:02 -04:00
Evert Timberg
de413294ca Category scale now takes a smaller size if no labels are being displayed.
Updated linear scale code to use proper bottom padding. This is important when not displaying x axis labels
2015-08-22 14:30:30 -04:00
Evert Timberg
dd62944b79 Fix bracket placement 2015-08-15 10:54:34 -04:00
Fabian Strachanski
94c1ec4b84 Fix for #1373 2015-08-13 10:50:56 +02:00
Evert Timberg
eb833723cd initial logarithmic scale 2015-08-08 18:34:19 -04:00
Evert Timberg
87ac933c10 Linear scale has proper padding in both vertical and horizontal orientations. Should prevent labels from getting cut off even when axes are not displayed. 2015-08-08 11:52:20 -04:00
Michaël Gallego
0c6f37fff7 Add support for mirror option 2015-08-05 17:40:44 +02:00
Tanner Linsley
452ef8b6e7 No Logs 2015-08-03 13:06:53 -06:00