Tom Loudon [Thu, 12 May 2016 21:24:20 +0000 (22:24 +0100)]
Added CanvasPattern global flag for jshint
The core.helpers file was failing linting checks as the global CanvasPattern was not defined. Added the `/* global CanvasGradient */` statement to make linting pass. Updates chartjs/Chart.js#1323
Tom Loudon [Thu, 12 May 2016 21:24:20 +0000 (22:24 +0100)]
Added CanvasPattern global flag for jshint
The core.helpers file was failing linting checks as the global CanvasPattern was not defined. Added the `/* global CanvasGradient */` statement to make linting pass. Updates chartjs/Chart.js#1323
Tom Loudon [Tue, 10 May 2016 16:25:24 +0000 (17:25 +0100)]
Allow pattern hover state in all chart types
Updated all chart types to use the helper.getHoverColor. Pattern fills can now be specified for both fill and line portions of a chart. Updates chartjs/Chart.js#1323
Tom Loudon [Sat, 7 May 2016 21:24:00 +0000 (22:24 +0100)]
Added helper to allow a CanvasPattern for hover. Updates chartjs/Chart.js#1323
When a hover background isn't specified in the config for a chart a modified version of the default color is used. If the background color is a CanvasPattern object an error is triggered.
With this change the default background color will no longer be modified if it is a CanvasPattern.
Simon Brunel [Mon, 25 Apr 2016 17:58:12 +0000 (19:58 +0200)]
New test helpers to acquire and release charts
Since we changed the way how meta data are stores, now unit tests need to work on real Chart instances. This commit brings some helpers to inject/cleanup HTML canvas and it's wrapper into/from the DOM.
Simon Brunel [Mon, 25 Apr 2016 17:49:49 +0000 (19:49 +0200)]
Avoid meta data access in calculateCircumference
Fix access of uninitialized meta data while calculating circumference in the polar area chart by caching the number of visible elements in the update() method. Also make the calculateTotal() of the doughnut chart tolerant of uninitialized meta data.
Simon Brunel [Sat, 23 Apr 2016 08:57:29 +0000 (10:57 +0200)]
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.
Simon Brunel [Thu, 21 Apr 2016 17:12:12 +0000 (19:12 +0200)]
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.
Simon Brunel [Thu, 21 Apr 2016 21:43:47 +0000 (23:43 +0200)]
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.
Simon Brunel [Thu, 21 Apr 2016 15:11:52 +0000 (17:11 +0200)]
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.