Commit Graph

82 Commits

Author SHA1 Message Date
Jukka Kurkela
97136d0cbf Add textAlign for legend labels (#8665)
* Add textAlign for legend labels

* Update tests
2021-03-18 07:37:03 -04:00
Jukka Kurkela
aa5e0fe413 Remove core plugin fallbacks to root options (#8462)
* Remove core plugin fallbacks to root options
* Legend font color default fallbacks
2021-02-19 17:53:01 -05:00
Jukka Kurkela
cfd9c98575 Option resolution with proxies (#8374)
* Option resolution with proxies

* Remove plugin fallback to root options/defaults

* Update core plugins, reduntant font fallbacks

* Add some notes
2021-02-15 14:42:32 -05:00
Jukka Kurkela
ddfbcf777a Update eslint-config-chartjs to v0.3.0 (#8406) 2021-02-10 08:21:39 -05:00
Jukka Kurkela
ad84d285d8 Rename LayoutItem.fullWidth to fullSize (#8358) 2021-01-31 13:44:44 -05:00
Evert Timberg
988b3c5d2b Create standardized text render method (#8227)
* Create standardized text render method
* Document renderText options and enable configurable decoration width
* Add tests for font rendering
* Split color definition to it's own file
* renderText supports setting styles
* Mock context needs to track textBaseline
* renderText can set textAlign and textBaseline
* renderText does not mutate the context + translate/rotate
* Explicitly set the text decoration style
* Move useStroke logic into renderText
* Cartesian scale: Update computeLabelItems to avoid duplicate allocations
2020-12-26 11:23:02 -05:00
Jukka Kurkela
7a2acebc28 Layout: enforce box limits, reject <0 chartArea (#8193)
* Skip chartArea boxes when chartArea <= 0
* Legend: limit to maxWidth/maxHeight
* Layout: enforce box limits, reject <0 chartArea
* Update legend fixtures
2020-12-18 12:56:04 -05:00
Jukka Kurkela
979cd4131b Fix legend alignment issues (#8168) 2020-12-15 08:50:13 +02:00
Jukka Kurkela
8ab62f57be Use correct color for legend labels (#8167)
* Legend colors fallback
* Update test
2020-12-14 16:08:40 -05:00
Jukka Kurkela
e1a3303c67 Legend plugin cleanup (#8109)
* Legend plugin cleanup

* cc1

* cc2

* cc3

* start/stop
2020-12-14 15:35:04 +02:00
Evert Timberg
e268845c7b Quick exit the legend fit function when the legend is not displayed (#8161)
When the legend is not displayed, there are no guarantees that the
format of the options dictionary is correct. Rather than performing
computations and then exiting without using the results, we can instead
exit quickly since the size of the legend will be (0, 0) if not displayed
2020-12-14 12:04:10 +02:00
LeeLenaleee
ae04fcf3c3 fix default font color for legend (#8139)
* fix default font color for legend
* adjusted docs to be consistent with fontColor to color
2020-12-05 14:34:34 -05:00
Jukka Kurkela
78dbeea1f0 Add new hooks for plugins (#8103)
* Notify beforeUpdate on disabled plugins

cc?

cc2

cc3

typo

* init, unInit, enabled, disabled

self review :)

update the new hook signatures to unified

merge error

* Review update

* start/stop, cc

* types, jsdoc

* stop between destroy and uninstall
2020-11-28 22:57:45 +02:00
Jukka Kurkela
61aea761f4 Unify signature of plugin hooks (#8102) 2020-11-28 09:45:43 +02:00
Jukka Kurkela
913a01a3a6 Move title, tooltip and legend to options.plugins (#8089)
* Move title, tooltip and legend to options.plugins

* Update tooltip.md

* Update legend.md and title.md

* Add migration notes

* typo

* Types

* Restore plurals

* One more s, restore tabs

* All plugins disabled

* lint

* cc
2020-11-25 08:50:12 +02:00
Jukka Kurkela
ddc72fcfbb Align font options with CSS (#8066)
* Align font options with CSS

* Review comments
2020-11-19 20:59:24 +02:00
Jukka Kurkela
910158055f Drop legacy browser support (#8009)
* Drop legacy browser support

* Docs

* Use rollup-plugin-istanbul for coverage

* exclude node_modules from coverage

* No cleanup() when doing coverage
2020-11-16 21:01:33 +02:00
Evert Timberg
17f6edb650 Remove I prefix from TS types (#8017)
* Remove I prefix from TS types
* Update missing `ILayoutItem` typedefs
* IEvent should become ChartEvent
* Prevent FillTarget collision
* Import FontSpec instead of IFontSpec
* Prevent recursive DateAdapter problem
2020-11-07 08:35:19 -05:00
stockiNail
ea047f5cf2 Legend item lineWidth is the average of borderWidth when set as object (Bar) (#7964)
* fixed default of tension property of line element

* Fix #7942

* Fixes some lint errors

* fixes "Expected property shorthand" error
2020-10-28 13:12:52 +02:00
Evert Timberg
4ed650acbe Enable overriding the legend pointStyle using new pointStyle option (#7959) 2020-10-26 14:16:00 +02:00
Jukka Kurkela
73b4e82fd5 Use Object.create(null) as merge target, to prevent prototype pollution (#7917)
Use Object.create(null) as merge target to prevent polluting `Object.prototype`
2020-10-18 13:31:01 -04:00
Jukka Kurkela
06b5325778 Add maxWidth/maxHeight options for legend (#7852) 2020-10-06 07:41:16 -04:00
Evert Timberg
168965fa38 Enable custom sorting of the legend items (#7851) 2020-10-05 22:15:38 -04:00
Jukka Kurkela
e756fb93a3 Resolve fonts through options.font (#7674)
* Resolve fonts through options.font
* Remove defaultRoutes from Tooltip fonts
2020-08-03 12:32:58 -04:00
Evert Timberg
70c2b07eb2 Do not use line defaults in legend (#7649) 2020-07-19 12:52:59 -04:00
Jukka Kurkela
b8ad2a6a0a Registry bugs (#7608)
* Stop failing early when no scales are registered
* Move filler defaults
* Move legend defaults
* Remove legendHitBoxes from title
* Move @kurkle/color to devDependencies
2020-07-13 09:41:42 -04:00
Evert Timberg
537cd74919 Update the legend object during beforeUpdate (#7528)
* Update the legend object during beforeUpdate

When the legend is updated in afterUpdate, the position is not updated
before the layout system runs. When the event that the legend position
was changed, the legend would not move to the new position in the layout
system. This causes the chart to render incorrectly because the layout
system handled the layout as if the legend was still at the original position.

The update is split into two passes to ensure that labels still update correctly
after datasets (#6968)
2020-06-20 07:30:31 -04:00
Evert Timberg
0703d78286 Enable custom legend box heights (#7459)
Enable custom legend box heights
2020-06-04 19:53:40 -04:00
Evert Timberg
13b8924ac3 Legend onClick callback supports arrow functions (#7410)
#7409 Legend callbacks support arrow functions
The `Legend` is no longer implicitly found through `this` and instead
passed as an explicit argument to the callback functions.
2020-05-24 10:28:41 -04:00
Jukka Kurkela
5a83a80811 Move font* to font.* (#7383) 2020-05-21 17:07:06 -04:00
Jukka Kurkela
d801e56106 Update dependencies and alter privacy of functions (#7138)
* Update dependencies

* Fix privacy problems

* color lib & consistency

* Review update

* getLabelCapacity

* Review update
2020-02-22 08:35:16 -05:00
Ben McCann
e2145e3b55 Turn on excludeNotExported (#7121) 2020-02-20 12:18:21 -05:00
Ben McCann
028ee30505 Make margins private (#7123) 2020-02-19 14:15:48 -05:00
Jukka Kurkela
7c1fb37c61 Babel @kurkle/color for IE support (#7099)
Babel @kurkle/color for IE support
2020-02-14 12:29:33 -05:00
Jukka Kurkela
25a9969489 Enable esnext and fix all lint errors (#7094)
* enable esnext and fix all lint errors

* Review update

* Missed some

* Some cleanup still

* Remove leftover eslint disable
2020-02-13 18:41:49 -05:00
Ben McCann
40b8254ca4 Cleanup private methods on Scales (#7082) 2020-02-11 19:18:13 -05:00
Jukka Kurkela
25002f2763 Defaults as ES6 class (#7074)
* Defaults as ES6 class

* Review comments
2020-02-09 08:52:18 -05:00
Ben McCann
795c86e95b Fix errors reported by TypeScript compiler (#7030) 2020-02-07 18:03:33 -05:00
Jukka Kurkela
70b6eab563 Configurable hide/show animations (#7055)
Configurable hide/show animations
2020-02-06 18:16:24 -05:00
Evert Timberg
93757a53e5 Fix legend title drawing + update sample (#7060) 2020-02-06 07:31:33 -05:00
Ben McCann
1c18a74ea0 Fix some JSDoc errors (#7026)
* Fix some JSDoc errors

* Fix helpers.dom JSDoc errors

* Add scale JSDoc errors

* Address review comment

* Fix additional errors

* Document optional parameters

* JSDoc fixes for datasetController

* Remove undefined
2020-02-03 07:52:55 -05:00
Ben McCann
771fe52095 Update legend imports (#7048) 2020-02-01 08:29:39 -05:00
Dominic Jean
95345d01dc fix drawPoints parameter (#6975) 2020-01-18 08:32:09 -05:00
Jukka Kurkela
2e880ed99d Rebuild legend after datasets are updated (#6969) 2020-01-16 16:20:22 -05:00
Evert Timberg
d04cdfc21f Add the ability to add a title to the legend (#6906)
* Add the ability to add a title to the legend

- Legend title can be specified
- Font & color options added
- Padding option added
- Positioning option added
- Legend title sample file added
2020-01-10 18:28:51 -05:00
Ben McCann
c6c4a52257 Switch most requires to imports (#6935) 2020-01-09 07:23:53 -05:00
Ben McCann
ecb0784f0d Remove minSize (#6910) 2020-01-05 10:42:42 -05:00
Jukka Kurkela
f4792306e0 Remove global from defaults (#6893) 2020-01-03 14:07:38 -05:00
Evert Timberg
e96ad6f249 Remove HTML legend that is mostly unsupported. (#6887)
* Remove HTML legend that is mostly unsupported.

Resolves the discussion in #5070

* Add migration docs
2020-01-03 13:56:11 -05:00
Jukka Kurkela
b83f64b16e Rewrite animation logic (#6845)
* Rewrite animation logic

* Review update 1

* Review update 2

* Review update 3

* Add 'none' to api.md
2019-12-27 17:13:24 -05:00