Commit Graph

37 Commits

Author SHA1 Message Date
Jukka Kurkela
6bd5ad5518
Generic registry for controllers, scales, elements and plugins (#7435)
* Generic registry for controllers, scales, elements and plugins
* Remove references to scale service
2020-07-06 17:38:04 -04:00
Ben McCann
919e50b9fc
Generate ticks from small to large (#7559)
* Generate ticks from small to large
* Add note to migration guide
2020-06-29 07:52:28 -04:00
Jukka Kurkela
59a1af91ac
Replace horizontalBar with indexAxis: 'y' (#7514)
* Replace horizontalBar with indexAxis: 'y'
* Fix drawing of line for last x-position
* Consistently determine axis of scale
* Add test
2020-06-18 17:35:52 -04:00
Jukka Kurkela
0b3ef9c1a6
Replace ineffective test with a fixture (#7491) 2020-06-11 18:21:10 -04:00
Ben McCann
f5d9892ad8
Improved formatting of numeric scale labels (#7007)
* Improved formatting of numeric scale labels

* Put locale on options

* Use scientific notation for big ticks

* Remove extra parameter
2020-02-03 07:36:30 -05:00
Ben McCann
1ae11c4d40 Format numbers in tooltip (#7004)
* Format numbers in tooltip
* Add check for typeof number
* Implement only for linear and log scales
2020-01-27 17:58:58 -05:00
Evert Timberg
b097fe43c9
Linear scale with min/max/stepSize set should use all 3 if the range fits (#6966)
When (max - min) / stepSize is an integer, we can do a very simple
tick generation method.
2020-01-18 08:35:30 -05:00
Jose Raul Pérez
b1421c6ea1 Add stroke lines option around ticks to improve readability (#6787)
Enable stroking of text on of axis labels
2020-01-12 14:22:51 -05:00
Evert Timberg
b464999851
Bar chart defaults to begin at zero (#6917)
* Bar chart defaults to begin at zero

* Add bar beginAtZero test
2020-01-05 15:50:24 -05:00
Jukka Kurkela
03f65d4e7f Linear scale: use suggested limits as defaults (#6892)
* Linear scale: use suggested limits as defaults

* Review update
2020-01-03 09:07:33 -05:00
Evert Timberg
374b7491a3
Allow axes to be centered on the chart area (#6818)
Allow axes to be centered on the chart area or at a dynamic position based on another axis
2019-12-16 18:17:42 -05:00
Jukka Kurkela
ce74eb76a1 Convert axis options from arrays to objects (#6773)
* Convert axis options from arrays to objects

* Updated all chart type defaults
* Throw errors when axis type or position are not specified
* Avoid raising unnecessary errors when merging options into the default configs

* Fix additional tests

* Ensure scale defaults are set if type is not explicitly defined

* Another step

* Include `scale` as `firstIDs.r`

* update docs

* Update for buildOrUpdateScales

* Update migration guide

* Add test back
2019-11-21 18:46:49 -05:00
Jukka Kurkela
7f97adf5a0 Move scale defining options up from ticks (#6738)
* Move scale defining options up from `ticks`
* Include `ticks.reverse` in v3-migration
2019-11-15 12:11:13 -05:00
Evert Timberg
94afa63450
Remove zeroLineIndex functionality (#6697)
* Remove zeroLineIndex functionality

* Remove docs

* Code review updates
2019-11-07 06:27:49 -05:00
Jukka Kurkela
72df272234 Early data parsing, stacking by value and support object data (#6576)
* Early data parsing + stacking by value
* Review comments
* review comments
* Remove reduntant parsing
* Couple CC warnings
* Optimize filterBetween
* More migration info
2019-11-04 18:07:01 -05:00
Ben McCann
99811328dc Make all ticks objects (#6645)
Make all ticks object
2019-10-31 18:45:13 -04:00
Ben McCann
9ff1c845f2 Bar options should not be defined on scale (#6249)
* Bar options should not be defined on scale

* Improve minimization

* Add tests

* Multiple datasets in test
2019-10-25 12:17:41 -04:00
Akihiko Kusanagi
626d8cc714 Draw the rightmost grid line when offsetGridLines is true (#6326)
* Draw the rightmost grid line when offsetGridLines is true

* Refactor based on feedback

* Replace helpers.each with for loop

* Minor refactoring

* Refactor _computeItemsToDraw
2019-07-18 18:25:33 -04:00
Jukka Kurkela
cbace1cfe2 Handle reverse support in core.scale (#6343)
* Move log10 from core.helpers to helpers.math

* Refactor scales
2019-07-15 17:20:16 -04:00
Ben McCann
07109b674b [performance] replace helpers.each calls with for-loops (#6301)
* [performance] replace helpers.each calls with for-loops

* Use Math.min/max instead of if statement

* Rename variable
2019-06-22 09:55:46 -04:00
Jukka Kurkela
db6a6d5989 Refactor core.layouts (#6304) 2019-06-19 18:08:07 -04:00
Jukka Kurkela
9d7eacd251 Fix generateTicks when working with tiny numbers (#5948) 2019-01-09 07:58:13 +01:00
Akihiko Kusanagi
aae05a08da Improve tick generation for linear scales (#5938)
* Improve tick generation for linear scales
* Simplify the tick generation code
* Refactor getTickLimit
2019-01-01 08:38:09 -05:00
Akihiko Kusanagi
d29ec5a485 Add scale.pointLabels.lineHeight and scale.ticks.lineHeight options (#5914) 2018-12-20 09:56:06 +01:00
Akihiko Kusanagi
637c2176ec Support decimal stepSize (#5786) 2018-11-12 21:12:09 +01:00
Alexandre Dubé
5816770e45 Introduce the 'minBarLength' bar option (#5741) 2018-10-18 22:28:56 +02:00
Carl Osterwisch
7a65546629 Fix scale when data is all small numbers (#5723)
* Add test for correct handling of small numbers

* Calculate tick precision for arbitrarily small numbers

* Use scientific notation for very small tick numbers

* Calculate significant digits for exponential tick values
2018-09-16 11:33:48 +02:00
Colin
352268616b Fix min and max option checks in linear scales (#5209)
When 0, the min and max options was considered not being set, instead we should check for null or undefined.
2018-07-29 18:09:16 +02:00
Evert Timberg
9fbac88938 Add ticks.precision option to linear scale. (#4841)
If defined and `stepSize` is not specified, the step size will be rounded to this many decimal places.
2018-04-01 18:56:45 +02:00
andig
ea703a54bf Implement scale label padding (#4646) 2017-09-10 13:15:47 -04:00
Akihiko Kusanagi
7dc71d009b Make offsetGridLines consistent and add new offset scale option (#4545)
Add a new `offset` option to scales to add extra space at edges and remove the `includeOffset` argument from `getPixelForValue()` and `getPixelForTick()`. The bar controller now automatically calculates the bar width to avoid overlaps. When `offsetGridLines` is true, grid lines move to the left by one half of the tick interval, and labels don't move.
2017-08-14 10:09:33 +02:00
Simon Brunel
090196c07c Add support for line height CSS values (#4531)
The title plugin and scale title now accept lineHeight specified using unitless value (1.4), length ('1.4em' or '12px'), percentage ('200%') or keyword ('normal' === 1.2). The line height parsing has been refactored under the 'Chart.helpers.options' namespace. Also fix incorrect text positioning in the title plugin.

https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
2017-07-20 19:20:54 +02:00
etimberg
ccb2898539 When all datasets are hidden, the linear scale defaults to a range of 0 - 1.
If `ticks.min` was set this would not set the range correctly.
Added a test to cover this case as well
2017-06-25 13:32:08 -04:00
Andrew
2d7c1f0d2c Time axis tick formatting with major and minor units (#4268)
Working towards creating the TimeSeries scale, this PR adds formatting for major and minor ticks on axes.
2017-06-15 07:20:16 -04:00
GabrielMancik
254bd4bf86 Fixed calculation of scale min and max when dataset contains no values (#4064)
* Fixed different calculation of scale min and max when dataset contains no values
* Removed trailing spaces
* Added test for correct min/max calculation
* Removed trailing spaces
2017-04-15 12:37:49 -04:00
Lee N Dobryden
20a832809e Zero line dash options (#4019)
* Add of zero line border dash options
* Update Readme with zero line border dash config options
2017-03-21 06:38:09 -04:00
Simon Brunel
c216c0af76 Cleanup and upgrade unit tests environment
`karma.conf.ci.js` has been merged into `karma.conf.js` for local testing consistency: `gulp unittestWatch` has been replaced by `gulp unittest --watch` and thus use exactly the same config file. Upgrade to latest jasmine and karma packages and remove deprecated `gulp-karma` dependency (directly use `karma.Server` in gulp).

Split `test/mockContext.js` into smaller `test/jasmine.*` modules to make easier unit tests maintenance and finally, move all `*.test.js` files under the `test/specs` folder.
2017-03-04 11:39:48 -05:00