Commit Graph

19 Commits

Author SHA1 Message Date
Simon Brunel
4b421a50bf Add support to fill between datasets (#4008)
The `fill` option now accepts the index of the target dataset (number) or a string starting by "+" or "-" followed by a number representing the dataset index relative to the current one (e.g. `fill: "-2"` on dataset at index 3 will fill to dataset at index 1). It's also possible to "propagate" the filling to the target of an hidden dataset (`options.plugins.filler.propagate`). Fill boundaries `zero`, `top` and `bottom` have been deprecated and replaced by `origin`, `start` and `end`.

Implementation has been moved out of the line element into a new plugin (`src/plugins/plugin.filler.js`) and does not rely anymore on the deprecated model `scaleTop`, `scaleBottom` and `scaleZero` values. Drawing Bézier splines has been refactored in the canvas helpers (note that `Chart.helpers.canvas` is now an alias of `Chart.canvasHelpers`).

Add 3 new examples and extend utils with a pseudo-random number generator that can be initialized with `srand`. That makes possible to design examples starting always with the same initial data.
2017-03-18 11:08:57 +01:00
etimberg
8c90b9f2de Fix issue with how Chart.PluginBase is defined 2017-02-09 17:36:32 -05:00
Simon Brunel
312773ba7b Platform event API abstraction
Move base platform definition and logic in src/platform/platform.js and simplify the browser -> Chart.js event mapping by listing only different naming then fallback to the native type.

Replace `createEvent` by `add/removeEventListener` methods which dispatch Chart.js IEvent objects instead of native events. Move `add/removeResizeListener` implementation into the DOM platform which is now accessible via `platform.add/removeEventListener(chart, 'resize', listener)`.

Finally, remove `bindEvent` and `unbindEvent` from the helpers since the implementation is specific to the chart controller (and should be private).
2017-01-15 14:25:38 -05:00
Evert Timberg
ecc35c527b Refactoring to put browser specific code in a new class (#3718)
Refactoring to put browser specific code in a new class, BrowserPlatform.
BrowserPlatform implements IPlatform. Chart.Platform is the constructor for the platform object that is attached to the chart instance.

Plugins are notified about the event using the `onEvent` call. The legend plugin was converted to use onEvent instead of the older private `handleEvent` method.
Wrote test to check that plugins are notified about events
2016-12-21 10:22:05 -05:00
Simon Brunel
3187a788e1 Add support for local plugins and plugin options
Plugins can now be declared in the chart `config.plugins` array and will only be applied to the associated chart(s), after the globally registered plugins. Plugin specific options are now scoped under the `config.options.plugins` options. Hooks now receive the chart instance as first argument and the plugin options as last argument.
2016-12-18 08:46:15 -05:00
Evert Timberg
03735563f4 Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y'
2016-10-03 16:05:21 -04:00
Evert Timberg
d09a17a2b1 Better number -> string callback for the radial linear scale (#3281)
Also create a new Chart.Ticks namespace to host common tick generators and formatters.
2016-09-24 22:56:16 +02:00
Shayne Linhart
0dccc85e3a Added usePointStyle option to label boxes
- Closes #2252
- Allows label boxes to match the shape(pointStyle) of the corresponding data.
* Removed unused varaible from legend's draw()
2016-07-05 20:08:29 -06:00
Simon Brunel
7a419af4c2 Rename plugin service and notification method
Rename `Chart.pluginService` to `Chart.plugins` (so move the old Chart.plugins array as a private member of the service), and rename `notifyPlugins` to `notify` for consistency with other service methods.
2016-06-10 22:26:35 +02:00
Evert Timberg
3cd21c8053 Linear and RadialLinear scales now derive from a common base class 2016-05-29 10:16:47 -04:00
Evert Timberg
d6289c6129 Convert title block to a plugin 2016-05-25 21:28:02 -04:00
Evert Timberg
1ae0f5e4d4 Legend is attached to the graph as a plugin. 2016-05-25 21:23:46 -04:00
Simon Brunel
7108f78d2f Refactor addElements and addElementAndReset
Data controllers should now rarely implement addElements and addElementAndReset but instead should define dataElementType (and optionally datasetElementType). Also remove some dead code (e.g. numBars, colorForNewElement, etc.).
2016-05-22 00:25:51 +02:00
Zach Panzarino
900d249646 Fix build to include comment at top of file 2016-04-22 15:03:52 +00:00
Evert Timberg
16570b0c0c Plugin system + tests 2016-04-17 12:02:33 -04: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