Commit Graph

1228 Commits

Author SHA1 Message Date
Tarqwyn
34d26ea497 Fix bug when calculating if steps fit into scale as a whole number then smal floating point errors make the consition pass false 2016-12-13 21:22:02 -05:00
etimberg
6f40d04964 Fix infinite loop in logarithmic tick generation 2016-12-07 18:47:30 -05:00
etimberg
75d15ff98b Fix newly introduced drawing bug when tick marks are not drawn 2016-12-07 18:47:30 -05:00
Jonathon Hill
152ce9c9f8 Pass the hover event to the onHover event handler (#3669)
Pass the hover event to the onHover event handler

This makes the behavior of the `onHover` handler consistent with the `onClick` handler:

```
function(event, activeElements) {
    var chartInstance = this;
}
```
2016-12-03 17:42:33 -05:00
SAiTO TOSHiKi
5a24bfa500 Implement clipping (#3658)
Implements clipping of items outside the chart area. Resolves #3506 #3491 #2873
2016-12-03 16:09:45 -05:00
Toshiki Saito
bdcdbc2abf Fixed miscalculation of Bar width.
for Bar and horizontalBar type,
include stacked scale.
issue #3589
2016-12-02 07:57:59 -05:00
Evert Timberg
b39c0e1f93 Fix rotated label meaasurements (#2879, #3354). When measuring the first width and last width, the fact that arrays of text are
present must be considered. In addition to fixing this, I did some general code cleanup in the fit and calculateLabelRotation methods.
2016-12-02 07:56:54 -05:00
Evert Timberg
3ff58e5065 Revert "Fixed tooltip labelling on Bar Chart when min is defined (#3618)" 2016-12-01 07:58:39 -05:00
Evert Timberg
5bf203037c Do not notify plugins when a silent resize occurs (#3650)
Prevent the resize method from notifying plugins if it is a silent resize. A silent resize occurs during startup and we do not want plugins to do anything here because the chart is not set up.
2016-11-29 10:43:52 +01:00
Jerry Chang
b6807b2dd9 fixed tooltip labelling on Bar Chart when min is defined
added helper method to adjust the index

pass in chartConfig rather than access within method, make it easier to
test

added semi-colon at the end of helper method

added test for adjustIndex helper method

fixed lint issues

added integration test for the interaction of trigger an event over the
bar

.

.

moved adjustIndex into element helper

removed method from helper and adjusted method in core.interaction

added test for the element adjustIndex helper

added a skipIndexAdjustment method to handle when to skip the adjustment
along with test cases

fixed lint issues

removed the test for the helper method
2016-11-28 18:29:56 -05:00
SAiTO TOSHiKi
d39ac38ce1 Fix : Tooltip label for category scale. (#3649) 2016-11-28 18:28:39 -05:00
etimberg
7a8f20e88f Fix monotone cubic interpolation when two adjacent points are at the exact same x pixel value 2016-11-28 18:28:06 -05:00
Christopher Moeller
97f6c8f12d Add rectRounded point style 2016-11-26 12:58:49 -05:00
etimberg
2e5df0ff42 Allow updating the config of a chart at runtime 2016-11-25 07:19:59 -05:00
Evert Timberg
7e5e29e3ee Improve radial scale (#3625)
Clean up radial linear scale. It now supports multiple lines for point labels. Fixes #3225
2016-11-25 07:19:43 -05:00
etimberg
68b00b2dc5 Labels can get bigger when the 2nd fit happens. Don't arbitrarily force the size to change 2016-11-20 13:49:44 -05:00
etimberg
58afbe428c Properly use the ticks.padding option. To correctly fix the issue, the default padding was changed from 0 to 10. This change caused all of the test changes since the width of a vertical scale was lowered by 10px 2016-11-20 11:52:08 -05:00
Jerry Chang
4fbb1bdbbc Fixed Issue with tooltip label display when given null data value (#3528)
When datasets.data contains a null value, the label displays incorrect
value.

code additions:
- unit tests for truthy label values (when data is null)
- checks to ensure handling of null value in getLabelByIndex method

added mock data sets from issue #3528 example

expect the return value from getLabelForIndex method to be valid (truthy)

added check for null of first data value in getLabelForIndex

fixed indentation and null comparison operator in code

fixed mistake in definition of firstData variable

changed testing for data on index 0 to using index variable

changed firstData to use value instead

condense the statments to use value variable
2016-11-19 09:29:15 -05:00
etimberg
48cb8b78e7 Remove unnecessary padding usages and update category scale tests 2016-11-18 17:58:07 -05:00
Evert Timberg
5dd1c77cf5 Take vertical padding into account 2016-11-18 17:58:07 -05:00
Evert Timberg
eaf109c2b1 When an axis needs padding due to a long, rotated, label it should be added inside the layout system rather than in each axis. 2016-11-18 17:58:07 -05:00
Jeff Carey
fd2e40ce11 Fixed vertical alignment in legend text (#3387) 2016-11-18 07:35:31 -05:00
etimberg
f7d60c2606 Allow line chart to use pointBorderWidth of 0 correctly 2016-11-17 21:05:47 -05:00
etimberg
339265d21e use correct option for setting tension on radar charts 2016-11-14 07:27:01 -05:00
Evert Timberg
68a2c8240f remove unused cancel animation frame method 2016-11-13 08:16:40 -05:00
etimberg
3f2d7efc70 Add a function to filter items out of the legend 2016-11-12 18:48:25 -05:00
Simon Brunel
6b449a9e7c Fix retina scale when display size is implicit
The retinaScale helper now enforces the display size to the correct values because if no style has been set on the canvas, the render size is used as display size, making the chart bigger (or smaller) when deviceAspectRatio is different of 1.
2016-11-11 18:10:19 -05:00
Simon Brunel
efced4780c Fix context state restoration on destroy
In many cases, the canvas render size is changed by the lib, causing the state stack to be discarded, meaning that we can't use save() and restore() to release the context with its initial state (i.e. before creating the chart). Since we don't need (want) to manually save / restore the context initial state, simply make sure to reset it to the default state to give a fresh context back to the user. That also means we don't need to revert the scale when the pixel device ratio is not 1.
2016-11-07 19:16:45 -05:00
etimberg
74d4dbc608 X and Y interaction modes now use the intersect option 2016-11-05 08:19:07 -04:00
Simon Brunel
a94885e32d Fix the event handler when legend is disabled (#3544)
When legend is disabled (i.e. {options: {legend: false}}), me.legend is null. Add the same test on me.tooltip even if the tooltip object is always created in case of {options: {tooltips: false}}.
2016-11-03 22:43:52 +01:00
Simon Brunel
5012dcbdae Fix iframe resize handler when re-attached to DOM (#3527)
When the iframe is attached to the DOM, its content is reloaded (invaliding the resize listener) so make sure to install the handler after the iframe is loaded. Optimize resize events by throttling resize process until the next animation frame. Rewrite the unit test "waitForResize" method, the previous one (timeout) was too weak and most tests was failing on FF.
2016-10-31 08:47:28 +01:00
etimberg
f288bc727b When an event triggers an update while the bufferedUpdate state is true, we need to do that render with priority over any other renders that take place for animations and tooltips 2016-10-30 16:58:40 -05:00
Josh Soref
67934920be Spelling fixes (#3522)
Including: actually, aspect, bottom, changes, characters, datasets, divisible, downward, guidelines, instance, instances, interrupted, item, javascript, label, lifecycle, lines, plugins, manually, milliseconds, nearest, occurring, position, predefined, recalculate, tooltip, those
2016-10-27 21:18:31 +02:00
etimberg
274aa290ca Fix bug in 'y' tooltip mode 2016-10-23 16:33:25 -05:00
etimberg
5ae268e942 Add a way to filter items in the tooltip 2016-10-23 16:33:08 -05:00
bydooweedoo
3bd4d283f7 Custom tooltip: add data points infos (#3201)
Expose tooltip items from tooltip model and added `x` and `y` properties to `TooltipItemInterface`
2016-10-19 08:48:17 -05:00
etimberg
a0388eff4c Add new properties for the caretX,caretY point of a tooltip. Useful for custom tooltips.
The custom tooltip sample was updated as well to use the new properties.
2016-10-19 06:30:41 -05:00
etimberg
596ff3718c Layout service now supports configurable padding on left, top, right and bottom.
Re-enabled the layout service tests and then properly disabled the tests that
fail on the CI.
2016-10-17 16:59:47 -05:00
etimberg
16f23b2c44 Add reset method to chart prototype 2016-10-17 06:40:29 -05:00
Simon Brunel
4a5b5a0e7e Enhance context acquisition on chart creation
Add support for creating a chart from the canvas id and prevent exceptions, at construction time, when the given item doesn't provide a valid CanvasRenderingContext2D or when the getContext API is not accessible (e.g. undefined by add-ons to prevent fingerprinting). New jasmine matcher to verify chart validity.
2016-10-16 08:25:13 -05:00
Evert Timberg
6ec6a929f0 Make index mode only work with the horizontal distance to an element (#3471)
Make index mode only work with the horizontal distance to an element if intersect is off
2016-10-15 16:49:35 -05:00
Evert Timberg
a86c47cf48 Configurable Tooltip Position Modes (#3453)
Adds new tooltip position option that allows configuring where a tooltip is displayed on the graph in relation to the elements that appear in it
2016-10-14 16:36:49 -05:00
etimberg
3365ba6d29 Bar chart performance improvements 2016-10-14 06:20:08 -05:00
Evert Timberg
f8e90b1c2d New fill modes for lines (#3460)
New fill modes for lines allowing the user to customize where the fill goes to
2016-10-14 06:19:47 -05:00
etimberg
0817199f45 No longer merge arrays during the config merge. Simply replace the property 2016-10-10 08:14:58 -04:00
Evert Timberg
d21a853f30 Fix/3061 (#3446)
Solve weird animation issues with the tooltip. The optimization in Chart.Element.transition when the animation finishes to set `_view = _model` caused problems during update because we were using `helpers.extend` all over the place.

I changed to code so that we regenerate the model variable rather than continuously extending the old version. I also removed unnecessary tooltip reinitializations from the controller which should improve overall performance during interaction.
2016-10-09 12:26:59 -04:00
Evert Timberg
65a06e4735 Properly merge colors for the label colors in the tooltip. I added a private helper to simplify the code in the tooltip 2016-10-08 07:28:45 -04:00
Evert Timberg
4d2772e313 Fix bubble chart tooltip callback to use correct labels (#3421)
Fix bubble chart tooltip callback to use correct label parsed from scales. Fixes #3029
2016-10-06 08:54:50 -04:00
Mickael Jeanroy
b64cab0046 Refactor tooltip draw function to extract drawBackground method
See issue #3416.
2016-10-04 14:10:56 -04:00
Aidan Fewster
365bdbb346 If tick options have min, max and stepSize use them to generate evenly spaced ticks 2016-10-04 09:30:28 -04:00
Evert Timberg
c15fa98978 Display tooltip color boxes for all tooltips. Added a new displayColors option to turn them off 2016-10-04 09:20:20 -04: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
Simon Brunel
1484520692 Better animation when adding or removing data
In order to simulate real-time chart updates (i.e. horizontal animation), it's necessary to distinguish a removed or added value from a simple update. The dataset controller now hooks array methods that alter the data array length to synchronize metadata accordingly. Also remove the duplicate calls of updateBezierControlPoints() for line and radar charts.
2016-10-03 16:01:38 -04:00
Simon Brunel
9deebf8371 Fix config initialization and add unit tests 2016-09-29 17:55:04 -04:00
Simon Brunel
806a3832ef Inject iframe for responsive charts only
Responsiveness is currently based on the use of an iframe, however this method causes performance issues and could be troublesome when used with ad blockers. So make sure that the user is still able to create a chart without iframe when responsive is false.
2016-09-28 15:43:15 -04:00
Evert Timberg
d3d9573af5 Fixes HTML legend string for polar area charts to match doughnut charts. (#3361)
Fixes HTML legend string for polar area charts to match doughnut charts
2016-09-25 08:30:39 -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
Simon Brunel
d407da4e36 Merge pull request #3325 from chartjs/fix/3269
Improve multiline labeling for tooltips in doughnut charts
2016-09-24 22:31:29 +02:00
Evert Timberg
c3d7a3328d In the doughnut chart, specifically handle multiline strings. 2016-09-24 22:25:04 +02:00
Evert Timberg
62ef40ebf6 skip non finite data points when determining scale sizes. Fixes #3125 2016-09-24 12:19:49 -04:00
Evert Timberg
ba133876c2 Merge pull request #3356 from simonbrunel/aspect-ratio
Fix aspect ratio and add responsive unit tests
2016-09-24 12:06:45 -04:00
Evert Timberg
11e8c50f72 Compute correct tooltip size when there is no title present (#3324) 2016-09-24 10:58:31 +02:00
Evert Timberg
9015e72ae1 Fix the legend drawing when labels.usePointStyle is true (#3323) 2016-09-24 10:57:33 +02:00
dylan-kerr
fb302d5f00 Set maxWidth during title draw to avoid overflow
CanvasRenderingContext2D.fillText() accepts a fourth parameter called maxWidth that sets the maximum width of the drawn text, enforced by scaling the entire line.

This commit uses the title element's layout dimensions to set maxWidth and avoid overflow outside of the canvas.
2016-09-23 22:15:23 +01:00
Simon Brunel
d610987cfb Fix radar default aspect ratio and samples
Now that the aspect ratio is correctly handled, fix samples for charts with aspect ratio of 1 which was vertically too large. Also fix the default aspect ratio for radar charts which wasn't applied when creating a chart directly using new Chart(ctx, { type: 'radar' }).
2016-09-23 17:47:36 +02:00
Simon Brunel
16bcd6adc5 Fix initial aspect ratio when not responsive
When responsive is false and no canvas height explicitly set, the aspectRatio option wasn't applied because of the canvas default height. Prevent the retinaScale method to change the canvas display size since this method is called for none responsive charts, but instead make the resize() responsible of these changes. Also, as discussed some time ago, moved most of the core.js logic into core.controller.js. Clean up the destroy process and make sure that initial canvas values are properly saved and restored.
2016-09-23 17:47:35 +02:00
Simon Brunel
84da2e0a10 Make charts vertically responsive (#3105) (#3326)
Ensure that the hidden iframe is stretched vertically in order to detect height changes. Remove the classlist check/call since it was incorrectly spelled (should be classList), but also useless since the iframe has just been generated. Also remove the callback check: addResizeListener should never be called w/o a valid callback.
2016-09-23 17:46:17 +02:00
Zach Panzarino
051f5b015b Fix bug with pie/doughnut chart legends
Fixes a rendering issue when there are multiple datasets on a pie chart and they do not all contain the same number of data in their datasets
Fixes #3309
2016-09-16 01:29:01 +00:00
Zach Panzarino
8207027743 Implement eslint changes proposed by @simonbrunel in code review 2016-09-15 12:49:11 +00:00
Zach Panzarino
a929fd473e Include changes suggested by @etimberg in code review 2016-09-15 01:21:45 +00:00
Zach Panzarino
bddd4cd94b Fix style issues in core and scales 2016-09-15 00:23:30 +00:00
Zach Panzarino
dd8fa78b45 Fix more style errors in controllers, elements, and scales 2016-09-14 22:34:41 +00:00
Zach Panzarino
11739234a4 Add keyword spacing to eslint and update code 2016-09-14 18:12:23 +00:00
Zach Panzarino
2d2f475a7a First round of eslint fixes 2016-09-14 18:05:19 +00:00
Evert Timberg
d8b13ca4ab Merge pull request #3261 from desowin/3211
Implement moment diff cache in time scale
2016-09-12 19:37:50 -04:00
Tomasz Moń
0514ed4793 Fix check for undefined
Use '!==' instead of '!='. This fixes eqeqeq error reported by gulp-eslint.
2016-09-12 10:41:27 +03:00
Evert Timberg
eb5bca6a4a When the category scale is used as the non main scale, return the correct data for the tooltip 2016-09-09 21:03:59 -04:00
Lubomir Sotirov
38f85c98b5 Fix 3267 Add "onHover" functionality for legend (#3271)
Add "onHover" to the legend options that will hold a user defined function (default is null) and called when a "mousemove" event is registered on top of a label item, with same parameters as the "onClick" option.

Also introduced logic that determines if the type of event passed to the legend "handleEvent" function is one we can handle. Currently allowing "click" and "mousemove" events. If the event is not one of those we stop the function execution (this is for the sake of reusing the legend hitbox calculations).
2016-09-08 14:42:42 +02:00
Simon Brunel
52cdff5fc1 Merge pull request #3254 from ianks/minDisplayFormat
Suport minUnit for time scale
2016-09-08 13:34:53 +02:00
Ian Ker-Seymer
7af6e7f192
Suport minUnit for time scale
When dealing with time-delineated datasets, often we have data for known
intervals of time. For example, we may have a dataset which represents number
of purchases per day:

```json
{
	labels: ['2016-01-01', '2016-01-02', '2016-01-03']
	datasets: [
		{
			data: [12, 87, 42]
		}
	],
	'...': '...'
}
```

In this case, Chart.js will attempt to figure out the best interval to display
the data, and could pick `hours` as the unit. However, in this case, we would
prefer to just use the `days` interval since our data's granularity can not be
represented well with `hours`.

To remedy this, this commit adds the `minUnit` option which allows
users to (optionally) specify what the minimum unit they would like
to use.
2016-09-06 13:11:06 -04:00
Tomasz Moń
cd24895cd1 Build labelDiffs cache once per update (#3211)
Previously buildLabelDiffs() was called at the end of buildTicks() and
hence labelDiffs cache was calculated twice (in getMinimumBoxSize() and
then in fitBox()).
2016-09-04 10:22:27 +03:00
Tomasz Moń
020ac35852 Build label diff lookup table
This reduces number of calls to momentjs diff() if there are multiple
datasets sharing the same labels (#3211).
2016-09-03 22:30:05 +03:00
Simon Brunel
7c93255b16 Enforce curly braces for single statement block
curly: [error, all] (http://eslint.org/docs/rules/curly)
2016-09-03 18:42:28 +02:00
Simon Brunel
3d40774c7d Enforce consistent tab indentation
indent: [error, tab] (http://eslint.org/docs/rules/indent)
2016-09-03 18:42:26 +02:00
Simon Brunel
69ab0d3e23 Use gulp-eslint instead of gulp-jshint
Change the linter in gulp tasks to be consistent with Code Climate results which are based on ESLint using .eslintrc options. However, defaults Code Climate rules are too strict, so turn as warnings the 'complexity' and 'max-statements' rules (other errors has been fixed). Note that the Gulp task name has been changed for `gulp lint`.
2016-09-03 18:42:22 +02:00
courchef
6269e2c437 Error possible when using the plugin Chart.Zoom.js used with time scale (#3194)
Zooming in can cause the params `datasetIndex` and `index` to be null in method `getLabelMoment`. This happens when no ticks are visible on scale. It also throws an error and the chart becomes broken.
2016-09-03 18:06:09 +02:00
Evert Timberg
2268bef321 Merge pull request #3242 from Pikamander2/new_branch
Fix zero border width not working (issue #3241)
2016-09-02 18:46:16 -04:00
Ekaterina Dontsova
6408ba426c Fix #3022 Multi-lines label alignment (#3239) 2016-09-03 00:26:02 +02:00
Pikamander2
f3c51fc624 Fix zero border width not working (issue #3241) 2016-09-01 02:28:10 -04:00
Pikamander2
2002ca058b Fix zero border width not working (issue #3241) 2016-09-01 02:18:42 -04:00
Ekaterina Dontsova
4a4dccd6c1 Fix #3044 Line chart single data point centering (#3166)
In line charts, when there is only one label and data point, both are now horizontally centered.
2016-08-25 18:52:12 +02:00
Evert Timberg
8afac7bd3c Merge pull request #3191 from chartjs/fix/2994
Fix issues with repeated labels in the category scale and added a tes…
2016-08-23 17:09:31 -04:00
etimberg
904f19fb7e When drawTicks is false, we should not include their size in the size of the axis 2016-08-22 20:09:09 -04:00
Evert Timberg
1749d90faf Fix issues with repeated labels in the category scale and added a test to cover this case. 2016-08-22 18:03:56 -04:00
Evert Timberg
b33aff2091 Merge pull request #3131 from Lighnat0r/master
Use parser options in getPixelForValue for time scale
2016-08-22 17:53:55 -04:00
Evert Timberg
89531c6b93 Merge pull request #3112 from MatthieuRivaud/MonotoneCubicInterpolation
Monotone cubic interpolation
2016-08-22 17:53:31 -04:00
Evert Timberg
c94673e55a Merge pull request #3128 from vermeeca/3127-tooltip-sort
Accept chart data to itemSort callback for Tooltips
2016-08-22 17:53:11 -04:00
Tomasz Moń
c283867f73 Remove smallestLabelSeparation from TimeScale (#3186)
In case of charts with over 4000 points, smallestLabelSeparation
calculation contributes significantly to total cpu usage (about 25% according
to built-in Chrome profiler). Important thing to note is that result
of this calculation is not used at all.

Related commits:
  * 677c249b61
    introduced smallestLabelSeparation. It was used in calculateBaseWidth
    function.
  * d198157fb8
    removed last use of smallestLabelSeparation. Since then the calculated
    value was never used.
2016-08-22 14:50:48 -04:00
Karthik Iyengar
349a8a33ea Added borderDash support for grid lines (#3136) (#3142)
* Added borderDash support for grid lines (#3136)

* Save and restore context to prevent border dash being applied to other elements

* Adds support for borderDashOffset, checks for setLineDash (IE9/IE10)

* Fixes tests
2016-08-12 12:31:54 -04:00
Ekaterina Dontsova
31197978b7 Fix #2966: 0 values in logarithmic scale for line and vertical bar charts (#3016) 2016-08-11 21:40:25 +02:00
Lighnat0r
ff0e8eadab Use parser options in getPixelForValue for time scale 2016-08-10 19:14:02 +02:00
Craig Vermeer
88de438c0e 3127 - Modify the itemSort callback for tooltips to accept a third parameter of the data object passed to the chart 2016-08-10 09:54:21 -04:00
Evert Timberg
5fea5a1156 Merge pull request #3094 from chartjs/fix/3090
Make the iframe not focusable by using tabIndex of -1
2016-08-09 23:00:50 -04:00
Zach Panzarino
c20d391b49 Remove empty if statement in element.line.js 2016-08-10 01:39:03 +00:00
Zach Panzarino
abfbdd5f31 Remove unneeded trailing commas 2016-08-10 01:35:34 +00:00
MatthieuRivaud
7635ab4a4e Calling |helpers.sign| instead of |Math.sign| directly for IE and Safari compatibility. 2016-08-09 09:32:10 +02:00
MatthieuRivaud
3869dd110a Fix spanGaps probing in updateBezierControlPoints 2016-08-09 09:28:09 +02:00
MatthieuRivaud
4aabc0cb82 Recovered a fix lost when branching. 2016-08-08 15:56:53 +02:00
MatthieuRivaud
d06fbc772f - Added dataset option |cubicInterpolationMode| to allow for curves with different interpolation modes on the same graph (updated doc accordingly)
- Added new sample file to demonstrate the monotone cubic interpolation mode
- Fixed a typo in a comment in updateBezierControlPoints
2016-08-08 15:35:46 +02:00
MatthieuRivaud
2409908027 Implement monotone cubic interpolation (see issue #3086). 2016-08-08 14:01:30 +02:00
Evert Timberg
554f31a1bb Make the iframe not focusable by using tabIndex of -1 2016-08-04 18:55:32 -04:00
Evert Timberg
d47ef17736 Handle the case where all points are skipped in a line 2016-07-30 14:46:28 -04:00
Evert Timberg
cec8d8b7d5 Merge pull request #3064 from chartjs/fix/2560
Recalculate the size of the scale in units when the end point is chan…
2016-07-30 12:59:59 -04:00
Evert Timberg
eb6124fea8 Fix 2 line drawing issues and add new tests for these cases 2016-07-30 12:55:42 -04:00
Evert Timberg
b86e42f2ae Fix JS Hint warning 2016-07-30 11:33:59 -04:00
Evert Timberg
0bb2e478db Recalculate the size of the scale in units when the end point is changed. 2016-07-30 11:06:13 -04:00
Evert Timberg
51518a7149 Handle possibility of a undefined arc element in the doughnut chart 2016-07-30 09:41:35 -04:00
Evert Timberg
f60344dfdb Fix line controller stacking with multiple axes and add a test 2016-07-28 18:10:07 -04:00
Evert Timberg
7ebc533cdc Merge pull request #3028 from chartjs/fix/span-gaps
Refactoring of the line drawing function to make `spanGaps` work correctly
2016-07-28 18:02:56 -04:00
Evert Timberg
23ca08184e Merge pull request #3045 from IonutLaceanu/master
getElementAtEvent: enforce one element limit
2016-07-28 18:02:31 -04:00
Jeff Esp
1e5cdc6188 Fix #2922 Make the XAxis based hover/tooltip pick the item at the same x-axis value 2016-07-27 21:09:13 +02:00
Ionut Laceanu
f46a9472b5 getElementAtEvent: enforce one element limit 2016-07-27 19:27:08 +03:00
Ian Ker-Seymer
e4dd158b24
Fix out of bounds index access in getLabelMoment
Previously, calling getLabelMoment with an out of bound index would cause an
error such as this:

```
Uncaught TypeError: Cannot read property 'null' of undefined
```

This happens because there is not always guaranteed to be a labelMoment on
at the current datasetIndex.

One example of this is practice comes from a this function call:

```js
// since the are not always guaranteed to be at least two labelMoments
//                                \ / this index can be out of bounds
//                                 |
var tickWidth = me.getPixelForTick(1) - me.getPixelForTick(0) - 6;
```

This patch simply ensures that the `labelMoments` for the `datasetIndex` are
defined before accessing properties on it.
2016-07-26 14:45:05 -04:00
Evert Timberg
47b5ad60ae Fix JSHint warnings 2016-07-24 18:21:24 -04:00
Evert Timberg
2016630daa Refactoring of the line drawing function to make spanGaps work correctly. Added a lot more test conditions to the line element tests. Ensured that the line controller correctly calculated bezier control points when there was a point to be skipped 2016-07-24 18:12:36 -04:00
Evert Timberg
e94d3c0730 Merge pull request #2947 from chartjs/fix/524
Add polar area start angle setting
2016-07-19 18:56:09 -04:00
Evert Timberg
88d9398982 Merge pull request #2984 from slinhart/master
Issue #1012. Added offsetAngle option for radar charts.
2016-07-18 22:25:54 -04:00
Tiago Roldão
9df06e8c2e Check for existence of data element before accessing property 2016-07-18 22:05:44 +01:00
unknown
1a63113bc0 changed option name for radar chart from offsetAngle to startAngle. Added test to make sure correct angles are computed for all points in the radar chart (with and without startAngle option set). 2016-07-17 23:11:30 -06:00
unknown
d7733b2221 Merge remote-tracking branch 'chartjs-origin/master' 2016-07-16 18:59:22 -06:00
unknown
ad7ed249af Add an option for radar chart to have offsetAngle. Issue #1012 2016-07-16 18:58:04 -06:00
Evert Timberg
7930137afa Merge pull request #2925 from Joshuabaker2/master
Ability to manually set bar chart bar width
2016-07-16 14:46:59 -04:00
Evert Timberg
bfa37e7d68 Merge pull request #2926 from chartjs/fix/2915
Fix bar and line controllers to convert strings to numbers when stacking
2016-07-13 18:22:11 -04:00
Evert Timberg
3dd15f64d2 Merge pull request #2918 from chartjs/fix/2916
Fix time point lines. Improved logic for using the value in the time …
2016-07-13 18:21:57 -04:00
Josh Baker
191c280387 Added support for manually specifying bar thickness in bar charts 2016-07-12 17:31:50 -07:00
Evert Timberg
524493fe06 Merge pull request #2883 from Mesonyx/mesonyx/bugfix/null-tooltips
Fix for null value label/x-axis multi-tooltip bug
2016-07-11 10:34:20 -04:00
Evert Timberg
49c4169010 Bring back capping of bezier curve points and have an option to disable it (#2948) 2016-07-09 15:24:41 -06:00
Evert Timberg
b6686f00f4 Non numeric y (#2849)
* Category scale can now read from the xLabels and yLabels properties.

* Update docs with section regarding the data object.

* Add sample file with non numeric Y and fix animations
2016-07-09 09:22:25 -06:00
Evert Timberg
72813d5112 Merge branch 'amlethojalen-master' 2016-07-09 10:02:08 -04:00
Evert Timberg
6f392639c2 Merge branch 'master' of https://github.com/amlethojalen/Chart.js into amlethojalen-master 2016-07-09 09:39:43 -04:00
Evert Timberg
609df5fb16 Merge pull request #2885 from neilmacintyre/master
cached index and length
2016-07-09 09:12:57 -04:00
Evert Timberg
8226f3432b Fix JSHint warnings and remove commented code 2016-07-09 09:08:41 -04:00
Evert Timberg
a452094f5d Add polar area start angle setting 2016-07-09 09:05:02 -04:00
Evert Timberg
7ca5f91b10 Fix bar and line controllers to convert strings to numbers when considering the values for stacking the chart. Simplified the base calculation for the bar charts and added test coverage to ensure that strings will work correctly. 2016-07-06 18:22:42 -04:00
Evert Timberg
fca419e075 Merge pull request #2924 from jeffesp/master
Fixes #2923: swapped tooltip xAlign & yAlign
2016-07-06 17:57:31 -04:00
Evert Timberg
44a9866bd8 Merge pull request #2870 from chartjs/fix/2802
Consider left and top when determining value from pixel in category s…
2016-07-06 17:53:50 -04:00
jeffesp
0c5a17af00 Fixes #2923: swapped tooltip xAlign & yAlign 2016-07-06 09:49:31 -04: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
amlethojalen
68728fc9a7 Added ability to render a line chart as a stepped line chart.
Added option.elements.line.stepped
Added dataset.steppedLine
Added Sample, and updated documentation.
2016-07-06 11:13:12 +10:00
Evert Timberg
758698c354 Fix time point lines. Improved logic for using the value in the time scale. Improve value passing in the line and bubble controllers/ 2016-07-05 20:52:17 -04:00
amlethojalen
bddc870201 Added ability for drawing a Line Chart as a stepped Line Chart. (reverted from commit efd06c886d) 2016-07-06 10:25:01 +10:00
amlethojalen
efd06c886d Added ability for drawing a Line Chart as a stepped Line Chart. 2016-07-05 19:50:53 +10:00
Evert Timberg
3cdd66ca58 Merge pull request #2867 from mtanda/fix_stacked_scatter_line_chart
Fix to work stacked scatter line chart (fixes #2878)
2016-07-04 22:57:40 -04:00
Neil Macintyre
8bd0c56b84 cached index and length 2016-06-30 18:10:11 -04:00
Adam Templeton
6f1344d4e9 fix for null tooltip bug 2016-06-30 11:34:53 -05:00
Mitsuhiro Tanda
2bf2be7a9c fix stacked scatter line chart 2016-06-30 22:28:21 +09:00
Evert Timberg
f2bbe32150 Merge pull request #2865 from nmac143/master
Pie chart borders truncated #2844
2016-06-29 20:30:02 -04:00
nmac143
426466d051 Fixed truncation of pie chart borders 2016-06-29 19:39:10 -04:00
Evert Timberg
3660d9be39 Consider left and top when determining value from pixel in category scale 2016-06-29 07:00:09 -04:00
Evert Timberg
35e3f01f01 Merge pull request #2857 from chartjs/fix/2809
Polar area graph scale should start at 0 by default
2016-06-28 21:59:39 -04:00
Adam Templeton
103957c4e0 adds x-axis hover option for charts and tooltips, highlights all dots on x-axis upon x-axis hover 2016-06-28 14:15:12 -05:00
André Wallat
72f423fb95 Fix tooltip not shown for missing dataset
When two datasets are shown and they don't have the same x-coordinates, then the position of the tooltip is not calculated correctly, when using mode 'label' or 'dataset'. This fix checks if the position of every dataset exists, before it is used.
2016-06-28 09:45:08 +02:00
Evert Timberg
c2e37ce8e2 Polar area graph scale should start at 0 by default 2016-06-27 22:25:38 -04:00
William Entriken
f2270ed8db Merge pull request #2741 from duerahan/master
time type xAxis height crah in line chart #2622
2016-06-27 13:59:41 -04:00
Evert Timberg
be32a4c6f0 Merge pull request #2823 from chartjs/fix/2708
Use the scale center point for the polar area chart center
2016-06-22 22:07:53 -04:00
Evert Timberg
3cf1cfa3de Fix JSHint warning 2016-06-22 21:48:49 -04:00
Evert Timberg
3280003f86 Merge pull request #2811 from chartjs/fix/span-gaps-global
Span gaps option should be specified at the chart level
2016-06-22 21:46:12 -04:00
Evert Timberg
0e276c968a Merge pull request #2821 from chartjs/fix/2526
Gracefully handle creating the chart with no config
2016-06-22 21:46:06 -04:00
Evert Timberg
05d41daa9e Merge pull request #2822 from chartjs/fix/2604
Allow passing a value to the time scale getPixelForValue method
2016-06-22 21:45:59 -04:00
Alexey Kopleman Dvurechensky
a9e0f2cae6 Fix statements in for() in tooltips's getAveragePosition. 2016-06-22 14:58:12 +03:00
Evert Timberg
0871dd96a5 Use the scale center point for the polar area chart center 2016-06-21 19:57:13 -04:00
Evert Timberg
48ac791a0c Allow passing a value to the time scale getPixelForValue method 2016-06-21 19:03:30 -04:00
Evert Timberg
553b20dc44 Gracefully handle creating the chart with no config 2016-06-21 18:45:22 -04:00
Evert Timberg
db8ed6a6c0 Span gaps option should be specified at the chart level 2016-06-20 14:42:09 -04:00
Simon Brunel
47912f49b4 Remove duplicated function names 2016-06-18 11:15:25 +02:00
Simon Brunel
f36123925c Fix #2734 Cleanup unused variables 2016-06-18 11:00:11 +02:00
Evert Timberg
f106e1bf2d fix tooltip with array returns 2016-06-14 19:19:15 -04:00
Evert Timberg
f3d4ee9333 Capping these to the chart bounds causes lines to bend during pan and zoom 2016-06-12 09:19:33 -04:00
Simon Brunel
53eb7667dd New datasets update plugin extensions
Add `beforeDatasetsUpdate` and `afterDatasetsUpdate` plugin notifications during the chart update. Plugins are able to cancel the datasets update by explicitly returning false to `beforeDatasetsUpdate`. For consistency, rename `(before|after)DatasetDraw` to `(before|after)DatasetsDraw`.
2016-06-11 00:17:48 +02:00
Simon Brunel
dfdbd4465c Allow to register/unregister an array of plugins
The plugins service now accepts an array of plugin instances to register or unregister (for consistency, renamed `Chart.plugins.remove` to `unregister`). Also added a few methods to manipulate registered plugins, such as `count`, `getAll` and `clear` (mainly used by our unit tests).
2016-06-11 00:17:44 +02:00
Simon Brunel
a55c17d73f Enhance plugin notification system
Change the plugin notification behavior: this method now returns false as soon as a plugin *explicitly* returns false, else returns true. Also, plugins are now called in their own scope (so remove the never used `scope` parameter).
2016-06-10 22:26:55 +02: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
e7834442ac Merge pull request #2739 from msimulcik/master
Fix of radial linear scale font family settings bug
2016-06-09 18:36:26 -04:00
Evert Timberg
b1c50ed0c2 Merge pull request #2732 from chartjs/scale-colors-per-line
Scale colors per line
2016-06-09 18:35:48 -04:00
Evert Timberg
3aeddf5239 Merge pull request #2723 from chartjs/vertical-legend
Vertical legend
2016-06-09 18:35:29 -04:00
Jack Valuntine
7d63bf085a time type xAxis height crah in line chart
if input only one data in dataset and xAxis type is date make offset crash.
check offset value and don't devide 0 value.
Add xAxis check test case.
2016-06-09 13:34:15 +09:00
Evert Timberg
8d94e3e427 Merge pull request #2712 from simonbrunel/helpers-cleanup
Rewrite a few helpers to be more efficient
2016-06-08 20:08:44 -04:00
Jack Valentine
29bc3b0b8b ChartJS tooltip fontColor fix
fixed global variable name fix
callback variable name fix
- 'titleColor' to 'titleFontColor'
- 'bodyColor' to 'bodyFontColor'
- 'footerColor' to 'footerFontColor'
2016-06-09 00:04:20 +09:00
Miroslav Simulcik
6e3c6c05ad Fixed radial linear scale font family settings bug 2016-06-08 15:21:54 +02:00
Evert Timberg
fbecfa2baf Reduce duplicated code in core scale draw method 2016-06-07 22:03:36 -04:00
문승찬
7ebf85eacf change tooltip font color option
bodyColor  -> bodyFontColor
titleColor -> titleFontColor
footerColor -> footerFontColor
2016-06-08 10:16:38 +09:00
Evert Timberg
6b2cfd5e11 Support arrays of colors and line widths in cartesian axes 2016-06-07 20:22:06 -04:00
Evert Timberg
a687749ed4 Radial linear scale array properties for line width and color 2016-06-07 20:09:33 -04:00
Ryan M. Poe
77357e57d6 Refactor spanGaps for line graphs with sparse data (#2721)
Fix #2435, this very slim patch (including its relevant documentation addition) adds a small option to line chart datasets (spanGaps) that allows users trying to graph sparse datasets to have lines between null entries drawn, rather than omitted.
2016-06-07 09:15:26 +02:00
Evert Timberg
71cbc4c5c1 Optimize legend drawing 2016-06-06 22:14:42 -04:00
Evert Timberg
80bd7d3f60 Initial vertical legend mode 2016-06-06 21:41:40 -04:00
Evert Timberg
959b4eedf6 Merge pull request #2716 from thebenedict/master
Make canvas element display: block by default, with config option to …
2016-06-06 10:14:59 -04:00
thebenedict
0b19689b00 style canvas element display: block by default 2016-06-06 17:05:44 +03:00
Simon Brunel
287cefc9b9 Rewrite a few helpers to be more efficient
Resolve at definition time if a browser built-in method or our polyfill should be used, so avoid checking it for each call. Also, `helpers.extend` doesn't need to iterate two times on the function arguments. Finally, remove helpers never referenced.
2016-06-05 23:23:19 +02:00
Evert Timberg
76d284c4ae Merge branch 'multiline_labels' of https://github.com/Tarqwyn/Chart.js into Tarqwyn-multiline_labels
Conflicts:
	src/core/core.scale.js
2016-06-04 20:48:26 -04:00