highcharts-rails 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +5 -0
- data/highcharts-rails.gemspec +1 -1
- data/lib/highcharts/version.rb +1 -1
- data/vendor/assets/images/highcharts/snow.png +0 -0
- data/vendor/assets/images/highcharts/sun.png +0 -0
- data/vendor/assets/javascripts/highcharts.js +313 -216
- data/vendor/assets/javascripts/highcharts/adapters/mootools.js +10 -1
- data/vendor/assets/javascripts/highcharts/adapters/prototype.js +5 -1
- data/vendor/assets/javascripts/highcharts/modules/canvas-tools.js +1 -1
- data/vendor/assets/javascripts/highcharts/modules/exporting.js +5 -2
- metadata +11 -9
data/CHANGELOG.markdown
CHANGED
data/highcharts-rails.gemspec
CHANGED
@@ -17,6 +17,6 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
19
|
s.add_dependency "railties", "~> 3.1"
|
20
|
-
s.add_development_dependency "bundler", "~> 1.0
|
20
|
+
s.add_development_dependency "bundler", "~> 1.0"
|
21
21
|
s.add_development_dependency "rails", "~> 3.1"
|
22
22
|
end
|
data/lib/highcharts/version.rb
CHANGED
Binary file
|
Binary file
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// @compilation_level SIMPLE_OPTIMIZATIONS
|
3
3
|
|
4
4
|
/**
|
5
|
-
* @license Highcharts JS v2.2.
|
5
|
+
* @license Highcharts JS v2.2.2 (2012-04-26)
|
6
6
|
*
|
7
7
|
* (c) 2009-2011 Torstein Hønsi
|
8
8
|
*
|
@@ -124,6 +124,7 @@ var UNDEFINED,
|
|
124
124
|
addEvent = adapter.addEvent,
|
125
125
|
removeEvent = adapter.removeEvent,
|
126
126
|
fireEvent = adapter.fireEvent,
|
127
|
+
washMouseEvent = adapter.washMouseEvent,
|
127
128
|
animate = adapter.animate,
|
128
129
|
stop = adapter.stop,
|
129
130
|
|
@@ -749,10 +750,15 @@ function placeBox(boxWidth, boxHeight, outerLeft, outerTop, outerWidth, outerHei
|
|
749
750
|
if (alignedRight && pointY >= y && pointY <= (y + boxHeight)) {
|
750
751
|
y = pointY + outerTop + distance; // below
|
751
752
|
}
|
752
|
-
}
|
753
|
+
}
|
754
|
+
|
755
|
+
// Now if the tooltip is below the chart, move it up. It's better to cover the
|
756
|
+
// point than to disappear outside the chart. #834.
|
757
|
+
if (y + boxHeight > outerTop + outerHeight) {
|
753
758
|
y = outerTop + outerHeight - boxHeight - distance; // below
|
754
759
|
}
|
755
760
|
|
761
|
+
|
756
762
|
return {x: x, y: y};
|
757
763
|
}
|
758
764
|
|
@@ -929,9 +935,10 @@ pathAnim = {
|
|
929
935
|
}
|
930
936
|
|
931
937
|
// if shifting points, prepend a dummy point to the end path
|
932
|
-
if (shift
|
933
|
-
|
934
|
-
|
938
|
+
if (shift <= end.length / numParams) {
|
939
|
+
while (shift--) {
|
940
|
+
end = [].concat(end).splice(0, numParams).concat(end);
|
941
|
+
}
|
935
942
|
}
|
936
943
|
elem.shift = 0; // reset for following animations
|
937
944
|
|
@@ -1145,6 +1152,13 @@ if (!globalAdapter && win.jQuery) {
|
|
1145
1152
|
}
|
1146
1153
|
};
|
1147
1154
|
|
1155
|
+
/**
|
1156
|
+
* Extension method needed for MooTools
|
1157
|
+
*/
|
1158
|
+
washMouseEvent = function (e) {
|
1159
|
+
return e;
|
1160
|
+
};
|
1161
|
+
|
1148
1162
|
/**
|
1149
1163
|
* Animate a HTML element or SVG element wrapper
|
1150
1164
|
* @param {Object} el
|
@@ -1270,7 +1284,7 @@ defaultOptions = {
|
|
1270
1284
|
},
|
1271
1285
|
global: {
|
1272
1286
|
useUTC: true,
|
1273
|
-
canvasToolsURL: 'http://code.highcharts.com/2.2.
|
1287
|
+
canvasToolsURL: 'http://code.highcharts.com/2.2.2/modules/canvas-tools.js'
|
1274
1288
|
},
|
1275
1289
|
chart: {
|
1276
1290
|
//animation: true,
|
@@ -1673,8 +1687,8 @@ defaultBottomAxisOptions = { // horizontal axis
|
|
1673
1687
|
labels: {
|
1674
1688
|
align: 'center',
|
1675
1689
|
x: 0,
|
1676
|
-
y: 14
|
1677
|
-
overflow:
|
1690
|
+
y: 14
|
1691
|
+
// overflow: undefined // docs - can be 'justify'
|
1678
1692
|
// staggerLines: null
|
1679
1693
|
},
|
1680
1694
|
title: {
|
@@ -2008,6 +2022,7 @@ SVGElement.prototype = {
|
|
2008
2022
|
nodeName = element.nodeName,
|
2009
2023
|
renderer = wrapper.renderer,
|
2010
2024
|
skipAttr,
|
2025
|
+
titleNode,
|
2011
2026
|
attrSetters = wrapper.attrSetters,
|
2012
2027
|
shadows = wrapper.shadows,
|
2013
2028
|
hasSetSymbolSize,
|
@@ -2143,9 +2158,12 @@ SVGElement.prototype = {
|
|
2143
2158
|
|
2144
2159
|
// Title requires a subnode, #431
|
2145
2160
|
} else if (key === 'title') {
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2161
|
+
titleNode = element.getElementsByTagName('title')[0];
|
2162
|
+
if (!titleNode) {
|
2163
|
+
titleNode = doc.createElementNS(SVG_NS, 'title');
|
2164
|
+
element.appendChild(titleNode);
|
2165
|
+
}
|
2166
|
+
titleNode.textContent = value;
|
2149
2167
|
}
|
2150
2168
|
|
2151
2169
|
// jQuery animate changes case
|
@@ -2159,7 +2177,7 @@ SVGElement.prototype = {
|
|
2159
2177
|
}
|
2160
2178
|
|
2161
2179
|
// symbols
|
2162
|
-
if (wrapper.symbolName && /^(x|y|r|start|end|innerR|anchorX|anchorY)/.test(key)) {
|
2180
|
+
if (wrapper.symbolName && /^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(key)) {
|
2163
2181
|
|
2164
2182
|
|
2165
2183
|
if (!hasSetSymbolSize) {
|
@@ -2951,6 +2969,32 @@ SVGRenderer.prototype = {
|
|
2951
2969
|
renderer.gradients = {}; // Object where gradient SvgElements are stored
|
2952
2970
|
|
2953
2971
|
renderer.setSize(width, height, false);
|
2972
|
+
|
2973
|
+
|
2974
|
+
|
2975
|
+
// Issue 110 workaround:
|
2976
|
+
// In Firefox, if a div is positioned by percentage, its pixel position may land
|
2977
|
+
// between pixels. The container itself doesn't display this, but an SVG element
|
2978
|
+
// inside this container will be drawn at subpixel precision. In order to draw
|
2979
|
+
// sharp lines, this must be compensated for. This doesn't seem to work inside
|
2980
|
+
// iframes though (like in jsFiddle).
|
2981
|
+
var subPixelFix, rect;
|
2982
|
+
if (isFirefox && container.getBoundingClientRect) {
|
2983
|
+
renderer.subPixelFix = subPixelFix = function () {
|
2984
|
+
css(container, { left: 0, top: 0 });
|
2985
|
+
rect = container.getBoundingClientRect();
|
2986
|
+
css(container, {
|
2987
|
+
left: (-(rect.left - pInt(rect.left))) + PX,
|
2988
|
+
top: (-(rect.top - pInt(rect.top))) + PX
|
2989
|
+
});
|
2990
|
+
};
|
2991
|
+
|
2992
|
+
// run the fix now
|
2993
|
+
subPixelFix();
|
2994
|
+
|
2995
|
+
// run it on resize
|
2996
|
+
addEvent(win, 'resize', subPixelFix);
|
2997
|
+
}
|
2954
2998
|
},
|
2955
2999
|
|
2956
3000
|
/**
|
@@ -2972,6 +3016,9 @@ SVGRenderer.prototype = {
|
|
2972
3016
|
renderer.defs = rendererDefs.destroy();
|
2973
3017
|
}
|
2974
3018
|
|
3019
|
+
// Remove sub pixel fix handler
|
3020
|
+
removeEvent(win, 'resize', renderer.subPixelFix);
|
3021
|
+
|
2975
3022
|
renderer.alignedObjects = null;
|
2976
3023
|
|
2977
3024
|
return null;
|
@@ -3014,7 +3061,14 @@ SVGRenderer.prototype = {
|
|
3014
3061
|
textLineHeight = textStyles && textStyles.lineHeight,
|
3015
3062
|
lastLine,
|
3016
3063
|
GET_COMPUTED_STYLE = 'getComputedStyle',
|
3017
|
-
i = childNodes.length
|
3064
|
+
i = childNodes.length,
|
3065
|
+
linePositions = [];
|
3066
|
+
|
3067
|
+
// Needed in IE9 because it doesn't report tspan's offsetHeight (#893)
|
3068
|
+
function getLineHeightByBBox(lineNo) {
|
3069
|
+
linePositions[lineNo] = textNode.getBBox().height;
|
3070
|
+
return mathRound(linePositions[lineNo] - (linePositions[lineNo - 1] || 0));
|
3071
|
+
}
|
3018
3072
|
|
3019
3073
|
// remove old text
|
3020
3074
|
while (i--) {
|
@@ -3092,7 +3146,7 @@ SVGRenderer.prototype = {
|
|
3092
3146
|
pInt(win[GET_COMPUTED_STYLE](lastLine, null).getPropertyValue('line-height'));
|
3093
3147
|
|
3094
3148
|
if (!lineHeight || isNaN(lineHeight)) {
|
3095
|
-
lineHeight = textLineHeight || lastLine.offsetHeight || 18;
|
3149
|
+
lineHeight = textLineHeight || lastLine.offsetHeight || getLineHeightByBBox(lineNo) || 18;
|
3096
3150
|
}
|
3097
3151
|
attr(tspan, 'dy', lineHeight);
|
3098
3152
|
}
|
@@ -3453,7 +3507,8 @@ SVGRenderer.prototype = {
|
|
3453
3507
|
|
3454
3508
|
imageRegex = /^url\((.*?)\)$/,
|
3455
3509
|
imageSrc,
|
3456
|
-
imageSize
|
3510
|
+
imageSize,
|
3511
|
+
centerImage;
|
3457
3512
|
|
3458
3513
|
if (path) {
|
3459
3514
|
|
@@ -3474,14 +3529,19 @@ SVGRenderer.prototype = {
|
|
3474
3529
|
// image symbols
|
3475
3530
|
} else if (imageRegex.test(symbol)) {
|
3476
3531
|
|
3477
|
-
|
3532
|
+
// On image load, set the size and position
|
3533
|
+
centerImage = function (img, size) {
|
3478
3534
|
img.attr({
|
3479
3535
|
width: size[0],
|
3480
3536
|
height: size[1]
|
3481
|
-
})
|
3482
|
-
|
3483
|
-
|
3484
|
-
|
3537
|
+
});
|
3538
|
+
|
3539
|
+
if (!img.alignByTranslate) { // #185
|
3540
|
+
img.translate(
|
3541
|
+
-mathRound(size[0] / 2),
|
3542
|
+
-mathRound(size[1] / 2)
|
3543
|
+
);
|
3544
|
+
}
|
3485
3545
|
};
|
3486
3546
|
|
3487
3547
|
imageSrc = symbol.match(imageRegex)[1];
|
@@ -3889,11 +3949,12 @@ SVGRenderer.prototype = {
|
|
3889
3949
|
* @param {Number} anchorY
|
3890
3950
|
* @param {Boolean} baseline Whether to position the label relative to the text baseline,
|
3891
3951
|
* like renderer.text, or to the upper border of the rectangle.
|
3952
|
+
* @param {String} className Class name for the group
|
3892
3953
|
*/
|
3893
|
-
label: function (str, x, y, shape, anchorX, anchorY, useHTML, baseline) {
|
3954
|
+
label: function (str, x, y, shape, anchorX, anchorY, useHTML, baseline, className) {
|
3894
3955
|
|
3895
3956
|
var renderer = this,
|
3896
|
-
wrapper = renderer.g(),
|
3957
|
+
wrapper = renderer.g(className),
|
3897
3958
|
text = renderer.text('', 0, 0, useHTML)
|
3898
3959
|
.attr({
|
3899
3960
|
zIndex: 1
|
@@ -3901,7 +3962,7 @@ SVGRenderer.prototype = {
|
|
3901
3962
|
.add(wrapper),
|
3902
3963
|
box,
|
3903
3964
|
bBox,
|
3904
|
-
|
3965
|
+
alignFactor = 0,
|
3905
3966
|
padding = 3,
|
3906
3967
|
width,
|
3907
3968
|
height,
|
@@ -3923,8 +3984,8 @@ SVGRenderer.prototype = {
|
|
3923
3984
|
|
3924
3985
|
bBox = (width === undefined || height === undefined || wrapper.styles.textAlign) &&
|
3925
3986
|
text.getBBox(true);
|
3926
|
-
wrapper.width = (width || bBox.width) + 2 * padding;
|
3927
|
-
wrapper.height = (height || bBox.height) + 2 * padding;
|
3987
|
+
wrapper.width = (width || bBox.width || 0) + 2 * padding;
|
3988
|
+
wrapper.height = (height || bBox.height || 0) + 2 * padding;
|
3928
3989
|
|
3929
3990
|
// update the label-scoped y offset
|
3930
3991
|
baselineOffset = padding + renderer.fontMetrics(style && style.fontSize).b;
|
@@ -3935,8 +3996,8 @@ SVGRenderer.prototype = {
|
|
3935
3996
|
boxY = baseline ? -baselineOffset : 0;
|
3936
3997
|
|
3937
3998
|
wrapper.box = box = shape ?
|
3938
|
-
renderer.symbol(shape,
|
3939
|
-
renderer.rect(
|
3999
|
+
renderer.symbol(shape, -alignFactor * padding, boxY, wrapper.width, wrapper.height) :
|
4000
|
+
renderer.rect(-alignFactor * padding, boxY, wrapper.width, wrapper.height, 0, deferredAttr[STROKE_WIDTH]);
|
3940
4001
|
box.add(wrapper);
|
3941
4002
|
}
|
3942
4003
|
|
@@ -3954,7 +4015,7 @@ SVGRenderer.prototype = {
|
|
3954
4015
|
function updateTextPadding() {
|
3955
4016
|
var styles = wrapper.styles,
|
3956
4017
|
textAlign = styles && styles.textAlign,
|
3957
|
-
x = padding,
|
4018
|
+
x = padding * (1 - alignFactor),
|
3958
4019
|
y;
|
3959
4020
|
|
3960
4021
|
// determin y based on the baseline
|
@@ -4031,7 +4092,7 @@ SVGRenderer.prototype = {
|
|
4031
4092
|
|
4032
4093
|
// change local variable and set attribue as well
|
4033
4094
|
attrSetters.align = function (value) {
|
4034
|
-
|
4095
|
+
alignFactor = { left: 0, center: 0.5, right: 1 }[value];
|
4035
4096
|
return false; // prevent setting text-anchor on the group
|
4036
4097
|
};
|
4037
4098
|
|
@@ -4066,8 +4127,9 @@ SVGRenderer.prototype = {
|
|
4066
4127
|
|
4067
4128
|
// rename attributes
|
4068
4129
|
attrSetters.x = function (value) {
|
4069
|
-
|
4070
|
-
|
4130
|
+
wrapper.x = value; // for animation getter
|
4131
|
+
value -= alignFactor * ((width || bBox.width) + padding);
|
4132
|
+
wrapperX = mathRound(value);
|
4071
4133
|
|
4072
4134
|
wrapper.attr('translateX', wrapperX);
|
4073
4135
|
return false;
|
@@ -4487,12 +4549,19 @@ var VMLElement = {
|
|
4487
4549
|
*/
|
4488
4550
|
clip: function (clipRect) {
|
4489
4551
|
var wrapper = this,
|
4490
|
-
clipMembers = clipRect.members
|
4552
|
+
clipMembers = clipRect.members,
|
4553
|
+
element = wrapper.element;
|
4491
4554
|
|
4492
4555
|
clipMembers.push(wrapper);
|
4493
4556
|
wrapper.destroyClip = function () {
|
4494
4557
|
erase(clipMembers, wrapper);
|
4495
4558
|
};
|
4559
|
+
|
4560
|
+
// Issue #863 workaround - related to #140, #61, #74
|
4561
|
+
if (element.parentNode.className === 'highcharts-tracker' && !docMode8) {
|
4562
|
+
css(element, { visibility: HIDDEN });
|
4563
|
+
}
|
4564
|
+
|
4496
4565
|
return wrapper.css(clipRect.getCSS(wrapper.inverted));
|
4497
4566
|
},
|
4498
4567
|
|
@@ -4706,6 +4775,7 @@ var VMLRendererExtension = { // inherit SVGRenderer
|
|
4706
4775
|
height: bottom + PX
|
4707
4776
|
});
|
4708
4777
|
}
|
4778
|
+
|
4709
4779
|
return ret;
|
4710
4780
|
},
|
4711
4781
|
|
@@ -5451,7 +5521,7 @@ function Chart(userOptions, callback) {
|
|
5451
5521
|
getLabelSize: function () {
|
5452
5522
|
var label = this.label;
|
5453
5523
|
return label ?
|
5454
|
-
((this.labelBBox = label.getBBox()))[horiz ? 'height' : 'width'] :
|
5524
|
+
((this.labelBBox = label.getBBox(true)))[horiz ? 'height' : 'width'] :
|
5455
5525
|
0;
|
5456
5526
|
},
|
5457
5527
|
|
@@ -5589,7 +5659,7 @@ function Chart(userOptions, callback) {
|
|
5589
5659
|
// If the parameter 'old' is set, the current call will be followed
|
5590
5660
|
// by another call, therefore do not do any animations this time
|
5591
5661
|
if (!old && gridLine && gridLinePath) {
|
5592
|
-
gridLine.animate({
|
5662
|
+
gridLine[tick.isNew ? 'attr' : 'animate']({
|
5593
5663
|
d: gridLinePath
|
5594
5664
|
});
|
5595
5665
|
}
|
@@ -6426,6 +6496,12 @@ function Chart(userOptions, callback) {
|
|
6426
6496
|
});
|
6427
6497
|
minRange = mathMin(closestDataRange * 5, dataMax - dataMin);
|
6428
6498
|
}
|
6499
|
+
|
6500
|
+
// A hook for resetting the minRange in series.setData (#878)
|
6501
|
+
// TODO: remove this in protofy, where xAxis.minRange can be set directly
|
6502
|
+
axis.setMinRange = function (newMinRange) {
|
6503
|
+
minRange = newMinRange;
|
6504
|
+
};
|
6429
6505
|
}
|
6430
6506
|
|
6431
6507
|
// if minRange is exceeded, adjust
|
@@ -6620,7 +6696,6 @@ function Chart(userOptions, callback) {
|
|
6620
6696
|
* number of ticks in that group
|
6621
6697
|
*/
|
6622
6698
|
function adjustTickAmount() {
|
6623
|
-
|
6624
6699
|
if (maxTicks && maxTicks[xOrY] && !isDatetimeAxis && !categories && !isLinked && options.alignTicks !== false) { // only apply to linear scale
|
6625
6700
|
var oldTickAmount = tickAmount,
|
6626
6701
|
calculatedTickAmount = tickPositions.length;
|
@@ -6661,7 +6736,8 @@ function Chart(userOptions, callback) {
|
|
6661
6736
|
oldAxisLength = axisLength;
|
6662
6737
|
|
6663
6738
|
// set the new axisLength
|
6664
|
-
|
6739
|
+
axis.setAxisSize();
|
6740
|
+
//axisLength = horiz ? axisWidth : axisHeight;
|
6665
6741
|
isDirtyAxisLength = axisLength !== oldAxisLength;
|
6666
6742
|
|
6667
6743
|
// is there new data?
|
@@ -6794,7 +6870,7 @@ function Chart(userOptions, callback) {
|
|
6794
6870
|
axisHeight = pick(options.height, plotHeight);
|
6795
6871
|
axisBottom = chartHeight - axisHeight - axisTop;
|
6796
6872
|
axisRight = chartWidth - axisWidth - axisLeft;
|
6797
|
-
axisLength = horiz ? axisWidth : axisHeight;
|
6873
|
+
axisLength = mathMax(horiz ? axisWidth : axisHeight, 0); // mathMax fixes #905
|
6798
6874
|
|
6799
6875
|
// expose to use in Series object and navigator
|
6800
6876
|
axis.left = axisLeft;
|
@@ -7149,10 +7225,13 @@ function Chart(userOptions, callback) {
|
|
7149
7225
|
visibility: VISIBLE,
|
7150
7226
|
zIndex: 6
|
7151
7227
|
})
|
7152
|
-
.translate(plotLeft, plotTop)
|
7153
7228
|
.add();
|
7154
7229
|
}
|
7155
7230
|
|
7231
|
+
// plotLeft/Top will change when y axis gets wider so we need to translate the
|
7232
|
+
// stackTotalGroup at every render call. See bug #506 and #516
|
7233
|
+
stackTotalGroup.translate(plotLeft, plotTop);
|
7234
|
+
|
7156
7235
|
// Render each stack total
|
7157
7236
|
for (stackKey in stacks) {
|
7158
7237
|
oneStack = stacks[stackKey];
|
@@ -7200,7 +7279,7 @@ function Chart(userOptions, callback) {
|
|
7200
7279
|
|
7201
7280
|
// hide tooltip and hover states
|
7202
7281
|
if (tracker.resetTracker) {
|
7203
|
-
tracker.resetTracker();
|
7282
|
+
tracker.resetTracker(true);
|
7204
7283
|
}
|
7205
7284
|
|
7206
7285
|
// render the axis
|
@@ -7355,7 +7434,7 @@ function Chart(userOptions, callback) {
|
|
7355
7434
|
style.padding = 0;
|
7356
7435
|
|
7357
7436
|
// create the label
|
7358
|
-
var label = renderer.label('', 0, 0, null, null, null, options.useHTML)
|
7437
|
+
var label = renderer.label('', 0, 0, null, null, null, options.useHTML, null, 'tooltip')
|
7359
7438
|
.attr({
|
7360
7439
|
padding: padding,
|
7361
7440
|
fill: options.backgroundColor,
|
@@ -7658,8 +7737,6 @@ function Chart(userOptions, callback) {
|
|
7658
7737
|
*/
|
7659
7738
|
function normalizeMouseEvent(e) {
|
7660
7739
|
var ePos,
|
7661
|
-
chartPosLeft,
|
7662
|
-
chartPosTop,
|
7663
7740
|
chartX,
|
7664
7741
|
chartY;
|
7665
7742
|
|
@@ -7684,16 +7761,14 @@ function Chart(userOptions, callback) {
|
|
7684
7761
|
|
7685
7762
|
// get mouse position
|
7686
7763
|
chartPosition = offset(container);
|
7687
|
-
chartPosLeft = chartPosition.left;
|
7688
|
-
chartPosTop = chartPosition.top;
|
7689
7764
|
|
7690
7765
|
// chartX and chartY
|
7691
|
-
if (
|
7766
|
+
if (ePos.pageX === UNDEFINED) { // IE < 9. #886.
|
7692
7767
|
chartX = e.x;
|
7693
7768
|
chartY = e.y;
|
7694
7769
|
} else {
|
7695
|
-
chartX = ePos.pageX -
|
7696
|
-
chartY = ePos.pageY -
|
7770
|
+
chartX = ePos.pageX - chartPosition.left;
|
7771
|
+
chartY = ePos.pageY - chartPosition.top;
|
7697
7772
|
}
|
7698
7773
|
|
7699
7774
|
return extend(e, {
|
@@ -7741,7 +7816,8 @@ function Chart(userOptions, callback) {
|
|
7741
7816
|
i,
|
7742
7817
|
j,
|
7743
7818
|
distance = chartWidth,
|
7744
|
-
index
|
7819
|
+
// the index in the tooltipPoints array, corresponding to pixel position in plot area
|
7820
|
+
index = inverted ? plotHeight + plotTop - e.chartY : e.chartX - plotLeft;
|
7745
7821
|
|
7746
7822
|
// shared tooltip
|
7747
7823
|
if (tooltip && options.shared && !(hoverSeries && hoverSeries.noSharedTooltip)) {
|
@@ -7794,24 +7870,34 @@ function Chart(userOptions, callback) {
|
|
7794
7870
|
/**
|
7795
7871
|
* Reset the tracking by hiding the tooltip, the hover series state and the hover point
|
7796
7872
|
*/
|
7797
|
-
function resetTracker() {
|
7873
|
+
function resetTracker(allowMove) {
|
7798
7874
|
var hoverSeries = chart.hoverSeries,
|
7799
|
-
hoverPoint = chart.hoverPoint
|
7875
|
+
hoverPoint = chart.hoverPoint,
|
7876
|
+
tooltipPoints = chart.hoverPoints || hoverPoint;
|
7800
7877
|
|
7801
|
-
|
7802
|
-
|
7803
|
-
|
7878
|
+
// Just move the tooltip, #349
|
7879
|
+
if (allowMove && tooltip && tooltipPoints) {
|
7880
|
+
tooltip.refresh(tooltipPoints);
|
7804
7881
|
|
7805
|
-
|
7806
|
-
|
7807
|
-
}
|
7882
|
+
// Full reset
|
7883
|
+
} else {
|
7808
7884
|
|
7809
|
-
|
7810
|
-
|
7811
|
-
|
7812
|
-
}
|
7885
|
+
if (hoverPoint) {
|
7886
|
+
hoverPoint.onMouseOut();
|
7887
|
+
}
|
7813
7888
|
|
7814
|
-
|
7889
|
+
if (hoverSeries) {
|
7890
|
+
hoverSeries.onMouseOut();
|
7891
|
+
}
|
7892
|
+
|
7893
|
+
if (tooltip) {
|
7894
|
+
tooltip.hide();
|
7895
|
+
tooltip.hideCrosshairs();
|
7896
|
+
}
|
7897
|
+
|
7898
|
+
hoverX = null;
|
7899
|
+
|
7900
|
+
}
|
7815
7901
|
}
|
7816
7902
|
|
7817
7903
|
/**
|
@@ -7825,7 +7911,8 @@ function Chart(userOptions, callback) {
|
|
7825
7911
|
},
|
7826
7912
|
selectionBox = selectionMarker.getBBox(),
|
7827
7913
|
selectionLeft = selectionBox.x - plotLeft,
|
7828
|
-
selectionTop = selectionBox.y - plotTop
|
7914
|
+
selectionTop = selectionBox.y - plotTop,
|
7915
|
+
runZoom;
|
7829
7916
|
|
7830
7917
|
|
7831
7918
|
// a selection has been made
|
@@ -7855,23 +7942,30 @@ function Chart(userOptions, callback) {
|
|
7855
7942
|
0,
|
7856
7943
|
1
|
7857
7944
|
);
|
7858
|
-
|
7859
|
-
|
7860
|
-
|
7861
|
-
|
7862
|
-
|
7863
|
-
|
7945
|
+
if (!isNaN(selectionMin) && !isNaN(selectionMax)) { // #859
|
7946
|
+
selectionData[isXAxis ? 'xAxis' : 'yAxis'].push({
|
7947
|
+
axis: axis,
|
7948
|
+
min: mathMin(selectionMin, selectionMax), // for reversed axes,
|
7949
|
+
max: mathMax(selectionMin, selectionMax)
|
7950
|
+
});
|
7951
|
+
runZoom = true;
|
7952
|
+
}
|
7864
7953
|
}
|
7865
7954
|
});
|
7866
|
-
|
7955
|
+
if (runZoom) {
|
7956
|
+
fireEvent(chart, 'selection', selectionData, zoom);
|
7957
|
+
}
|
7867
7958
|
|
7868
7959
|
}
|
7869
7960
|
selectionMarker = selectionMarker.destroy();
|
7870
7961
|
}
|
7871
7962
|
|
7872
|
-
|
7963
|
+
if (chart) { // it may be destroyed on mouse up - #877
|
7964
|
+
css(container, { cursor: 'auto' });
|
7965
|
+
chart.cancelClick = hasDragged; // #370
|
7966
|
+
chart.mouseIsDown = mouseIsDown = hasDragged = false;
|
7967
|
+
}
|
7873
7968
|
|
7874
|
-
chart.mouseIsDown = mouseIsDown = hasDragged = false;
|
7875
7969
|
removeEvent(doc, hasTouch ? 'touchend' : 'mouseup', drop);
|
7876
7970
|
|
7877
7971
|
}
|
@@ -7880,12 +7974,14 @@ function Chart(userOptions, callback) {
|
|
7880
7974
|
* Special handler for mouse move that will hide the tooltip when the mouse leaves the plotarea.
|
7881
7975
|
*/
|
7882
7976
|
function hideTooltipOnMouseMove(e) {
|
7883
|
-
var pageX = defined(e.pageX) ? e.pageX : e.page.x, // In mootools the event is wrapped and the page x/y position is named e.page.x
|
7884
|
-
pageY = defined(e.pageX) ? e.pageY : e.page.y; // Ref: http://mootools.net/docs/core/Types/DOMEvent
|
7885
7977
|
|
7978
|
+
// Get e.pageX and e.pageY back in MooTools
|
7979
|
+
washMouseEvent(e);
|
7980
|
+
|
7981
|
+
// If we're outside, hide the tooltip
|
7886
7982
|
if (chartPosition &&
|
7887
|
-
!isInsidePlot(pageX - chartPosition.left - plotLeft,
|
7888
|
-
pageY - chartPosition.top - plotTop)) {
|
7983
|
+
!isInsidePlot(e.pageX - chartPosition.left - plotLeft,
|
7984
|
+
e.pageY - chartPosition.top - plotTop)) {
|
7889
7985
|
resetTracker();
|
7890
7986
|
}
|
7891
7987
|
}
|
@@ -7916,6 +8012,7 @@ function Chart(userOptions, callback) {
|
|
7916
8012
|
|
7917
8013
|
// record the start position
|
7918
8014
|
chart.mouseIsDown = mouseIsDown = true;
|
8015
|
+
chart.cancelClick = false;
|
7919
8016
|
chart.mouseDownX = mouseDownX = e.chartX;
|
7920
8017
|
mouseDownY = e.chartY;
|
7921
8018
|
|
@@ -8087,7 +8184,7 @@ function Chart(userOptions, callback) {
|
|
8087
8184
|
e.cancelBubble = true; // IE specific
|
8088
8185
|
|
8089
8186
|
|
8090
|
-
if (!
|
8187
|
+
if (!chart.cancelClick) {
|
8091
8188
|
|
8092
8189
|
// Detect clicks on trackers or tracker groups, #783
|
8093
8190
|
if (hoverPoint && (attr(e.target, 'isTracker') || attr(e.target.parentNode, 'isTracker'))) {
|
@@ -8121,8 +8218,6 @@ function Chart(userOptions, callback) {
|
|
8121
8218
|
|
8122
8219
|
|
8123
8220
|
}
|
8124
|
-
// reset mouseIsDown and hasDragged
|
8125
|
-
hasDragged = false;
|
8126
8221
|
};
|
8127
8222
|
|
8128
8223
|
}
|
@@ -8832,7 +8927,7 @@ function Chart(userOptions, callback) {
|
|
8832
8927
|
fireEvent(axis, 'afterSetExtremes', axis.getExtremes()); // #747, #751
|
8833
8928
|
}
|
8834
8929
|
|
8835
|
-
if (axis.isDirty || isDirtyBox) {
|
8930
|
+
if (axis.isDirty || isDirtyBox || hasStackedSeries) {
|
8836
8931
|
axis.redraw();
|
8837
8932
|
isDirtyBox = true; // #792
|
8838
8933
|
}
|
@@ -8866,9 +8961,9 @@ function Chart(userOptions, callback) {
|
|
8866
8961
|
});
|
8867
8962
|
|
8868
8963
|
|
8869
|
-
//
|
8964
|
+
// move tooltip or reset
|
8870
8965
|
if (tracker && tracker.resetTracker) {
|
8871
|
-
tracker.resetTracker();
|
8966
|
+
tracker.resetTracker(true);
|
8872
8967
|
}
|
8873
8968
|
|
8874
8969
|
// redraw if canvas
|
@@ -9213,7 +9308,7 @@ function Chart(userOptions, callback) {
|
|
9213
9308
|
// remove previous chart
|
9214
9309
|
renderTo.innerHTML = '';
|
9215
9310
|
|
9216
|
-
// If the container doesn't have an offsetWidth, it
|
9311
|
+
// If the container doesn't have an offsetWidth, it ha s or is a child of a node
|
9217
9312
|
// that has display:none. We need to temporarily move it out to a visible
|
9218
9313
|
// state to determine the size, else the legend and tooltips won't render
|
9219
9314
|
// properly
|
@@ -9222,7 +9317,7 @@ function Chart(userOptions, callback) {
|
|
9222
9317
|
css(renderToClone, {
|
9223
9318
|
position: ABSOLUTE,
|
9224
9319
|
top: '-9999px',
|
9225
|
-
display: ''
|
9320
|
+
display: 'block'
|
9226
9321
|
});
|
9227
9322
|
doc.body.appendChild(renderToClone);
|
9228
9323
|
}
|
@@ -9257,35 +9352,6 @@ function Chart(userOptions, callback) {
|
|
9257
9352
|
// to get the tracker for translating mouse events
|
9258
9353
|
renderer.create(chart, container, chartWidth, chartHeight);
|
9259
9354
|
}
|
9260
|
-
|
9261
|
-
// Issue 110 workaround:
|
9262
|
-
// In Firefox, if a div is positioned by percentage, its pixel position may land
|
9263
|
-
// between pixels. The container itself doesn't display this, but an SVG element
|
9264
|
-
// inside this container will be drawn at subpixel precision. In order to draw
|
9265
|
-
// sharp lines, this must be compensated for. This doesn't seem to work inside
|
9266
|
-
// iframes though (like in jsFiddle).
|
9267
|
-
var subPixelFix, rect;
|
9268
|
-
if (isFirefox && container.getBoundingClientRect) {
|
9269
|
-
subPixelFix = function () {
|
9270
|
-
css(container, { left: 0, top: 0 });
|
9271
|
-
rect = container.getBoundingClientRect();
|
9272
|
-
css(container, {
|
9273
|
-
left: (-(rect.left - pInt(rect.left))) + PX,
|
9274
|
-
top: (-(rect.top - pInt(rect.top))) + PX
|
9275
|
-
});
|
9276
|
-
};
|
9277
|
-
|
9278
|
-
// run the fix now
|
9279
|
-
subPixelFix();
|
9280
|
-
|
9281
|
-
// run it on resize
|
9282
|
-
addEvent(win, 'resize', subPixelFix);
|
9283
|
-
|
9284
|
-
// remove it on chart destroy
|
9285
|
-
addEvent(chart, 'destroy', function () {
|
9286
|
-
removeEvent(win, 'resize', subPixelFix);
|
9287
|
-
});
|
9288
|
-
}
|
9289
9355
|
}
|
9290
9356
|
|
9291
9357
|
/**
|
@@ -9663,6 +9729,8 @@ function Chart(userOptions, callback) {
|
|
9663
9729
|
axis.setScale();
|
9664
9730
|
});
|
9665
9731
|
getMargins();
|
9732
|
+
|
9733
|
+
maxTicks = null; // reset for second pass
|
9666
9734
|
each(axes, function (axis) {
|
9667
9735
|
axis.setTickPositions(true); // update to reflect the new margins
|
9668
9736
|
});
|
@@ -10080,19 +10148,23 @@ Point.prototype = {
|
|
10080
10148
|
destroy: function () {
|
10081
10149
|
var point = this,
|
10082
10150
|
series = point.series,
|
10083
|
-
|
10151
|
+
chart = series.chart,
|
10152
|
+
hoverPoints = chart.hoverPoints,
|
10084
10153
|
prop;
|
10085
10154
|
|
10086
|
-
|
10155
|
+
chart.pointCount--;
|
10087
10156
|
|
10088
10157
|
if (hoverPoints) {
|
10089
10158
|
point.setState();
|
10090
10159
|
erase(hoverPoints, point);
|
10160
|
+
if (!hoverPoints.length) {
|
10161
|
+
chart.hoverPoints = null;
|
10162
|
+
}
|
10163
|
+
|
10091
10164
|
}
|
10092
|
-
if (point ===
|
10165
|
+
if (point === chart.hoverPoint) {
|
10093
10166
|
point.onMouseOut();
|
10094
10167
|
}
|
10095
|
-
series.chart.hoverPoints = null;
|
10096
10168
|
|
10097
10169
|
// remove all events
|
10098
10170
|
if (point.graphic || point.dataLabel) { // removeEvent and destroyElements are performance expensive
|
@@ -10101,7 +10173,7 @@ Point.prototype = {
|
|
10101
10173
|
}
|
10102
10174
|
|
10103
10175
|
if (point.legendItem) { // pies have legend items
|
10104
|
-
|
10176
|
+
chart.legend.destroyItem(point);
|
10105
10177
|
}
|
10106
10178
|
|
10107
10179
|
for (prop in point) {
|
@@ -10772,7 +10844,7 @@ Series.prototype = {
|
|
10772
10844
|
// Shift the first point off the parallel arrays
|
10773
10845
|
// todo: consider series.removePoint(i) method
|
10774
10846
|
if (shift) {
|
10775
|
-
if (data[0]) {
|
10847
|
+
if (data[0] && data[0].remove) {
|
10776
10848
|
data[0].remove(false);
|
10777
10849
|
} else {
|
10778
10850
|
data.shift();
|
@@ -10803,11 +10875,12 @@ Series.prototype = {
|
|
10803
10875
|
initialColor = series.initialColor,
|
10804
10876
|
chart = series.chart,
|
10805
10877
|
firstPoint = null,
|
10878
|
+
xAxis = series.xAxis,
|
10806
10879
|
i;
|
10807
10880
|
|
10808
10881
|
// reset properties
|
10809
10882
|
series.xIncrement = null;
|
10810
|
-
series.pointRange = (
|
10883
|
+
series.pointRange = (xAxis && xAxis.categories && 1) || options.pointRange;
|
10811
10884
|
|
10812
10885
|
if (defined(initialColor)) { // reset colors for pie
|
10813
10886
|
chart.counters.color = initialColor;
|
@@ -10884,6 +10957,13 @@ Series.prototype = {
|
|
10884
10957
|
}
|
10885
10958
|
}
|
10886
10959
|
|
10960
|
+
// reset minRange (#878)
|
10961
|
+
// TODO: In protofy, run this code instead:
|
10962
|
+
// if (xAxis) xAxis.minRange = UNDEFINED;
|
10963
|
+
if (xAxis && xAxis.setMinRange) {
|
10964
|
+
xAxis.setMinRange(); // to undefined
|
10965
|
+
}
|
10966
|
+
|
10887
10967
|
// redraw
|
10888
10968
|
series.isDirty = series.isDirtyData = chart.isDirtyBox = true;
|
10889
10969
|
if (pick(redraw, true)) {
|
@@ -11172,10 +11252,9 @@ Series.prototype = {
|
|
11172
11252
|
setTooltipPoints: function (renew) {
|
11173
11253
|
var series = this,
|
11174
11254
|
chart = series.chart,
|
11175
|
-
inverted = chart.inverted,
|
11176
11255
|
points = [],
|
11177
11256
|
pointsLength,
|
11178
|
-
plotSize =
|
11257
|
+
plotSize = chart.plotSizeX,
|
11179
11258
|
low,
|
11180
11259
|
high,
|
11181
11260
|
xAxis = series.xAxis,
|
@@ -11201,10 +11280,10 @@ Series.prototype = {
|
|
11201
11280
|
// loop the concatenated points and apply each point to all the closest
|
11202
11281
|
// pixel positions
|
11203
11282
|
if (xAxis && xAxis.reversed) {
|
11204
|
-
points = points.reverse()
|
11283
|
+
points = points.reverse();
|
11205
11284
|
}
|
11206
11285
|
|
11207
|
-
//each
|
11286
|
+
// Assign each pixel position to the nearest point
|
11208
11287
|
pointsLength = points.length;
|
11209
11288
|
for (i = 0; i < pointsLength; i++) {
|
11210
11289
|
point = points[i];
|
@@ -11214,7 +11293,7 @@ Series.prototype = {
|
|
11214
11293
|
plotSize;
|
11215
11294
|
|
11216
11295
|
while (low <= high) {
|
11217
|
-
tooltipPoints[
|
11296
|
+
tooltipPoints[low++] = point;
|
11218
11297
|
}
|
11219
11298
|
}
|
11220
11299
|
series.tooltipPoints = tooltipPoints;
|
@@ -11777,7 +11856,7 @@ Series.prototype = {
|
|
11777
11856
|
fill: options.backgroundColor,
|
11778
11857
|
stroke: options.borderColor,
|
11779
11858
|
'stroke-width': options.borderWidth,
|
11780
|
-
r: options.borderRadius,
|
11859
|
+
r: options.borderRadius || 0,
|
11781
11860
|
rotation: options.rotation,
|
11782
11861
|
padding: options.padding,
|
11783
11862
|
zIndex: 1
|
@@ -12691,13 +12770,17 @@ var ColumnSeries = extendClass(Series, {
|
|
12691
12770
|
cursor = options.cursor,
|
12692
12771
|
css = cursor && { cursor: cursor },
|
12693
12772
|
trackerGroup = series.drawTrackerGroup(),
|
12694
|
-
rel
|
12773
|
+
rel,
|
12774
|
+
plotY,
|
12775
|
+
validPlotY;
|
12695
12776
|
|
12696
12777
|
each(series.points, function (point) {
|
12697
12778
|
tracker = point.tracker;
|
12698
12779
|
shapeArgs = point.trackerArgs || point.shapeArgs;
|
12780
|
+
plotY = point.plotY;
|
12781
|
+
validPlotY = !series.isCartesian || (plotY !== UNDEFINED && !isNaN(plotY));
|
12699
12782
|
delete shapeArgs.strokeWidth;
|
12700
|
-
if (point.y !== null) {
|
12783
|
+
if (point.y !== null && validPlotY) {
|
12701
12784
|
if (tracker) {// update
|
12702
12785
|
tracker.attr(shapeArgs);
|
12703
12786
|
|
@@ -13040,10 +13123,13 @@ var PieSeries = extendClass(Series, {
|
|
13040
13123
|
* Extend the basic setData method by running processData and generatePoints immediately,
|
13041
13124
|
* in order to access the points from the legend.
|
13042
13125
|
*/
|
13043
|
-
setData: function () {
|
13044
|
-
Series.prototype.setData.
|
13126
|
+
setData: function (data, redraw) {
|
13127
|
+
Series.prototype.setData.call(this, data, false);
|
13045
13128
|
this.processData();
|
13046
13129
|
this.generatePoints();
|
13130
|
+
if (pick(redraw, true)) {
|
13131
|
+
this.chart.redraw();
|
13132
|
+
}
|
13047
13133
|
},
|
13048
13134
|
/**
|
13049
13135
|
* Do translation for pie slices
|
@@ -13315,7 +13401,7 @@ var PieSeries = extendClass(Series, {
|
|
13315
13401
|
// assume equal label heights
|
13316
13402
|
labelHeight = halves[0][0] && halves[0][0].dataLabel && halves[0][0].dataLabel.getBBox().height;
|
13317
13403
|
|
13318
|
-
/* Loop over the points in each
|
13404
|
+
/* Loop over the points in each half, starting from the top and bottom
|
13319
13405
|
* of the pie to detect overlapping labels.
|
13320
13406
|
*/
|
13321
13407
|
while (i--) {
|
@@ -13328,115 +13414,126 @@ var PieSeries = extendClass(Series, {
|
|
13328
13414
|
length = points.length,
|
13329
13415
|
slotIndex;
|
13330
13416
|
|
13331
|
-
|
13332
|
-
|
13333
|
-
|
13334
|
-
slots
|
13335
|
-
|
13336
|
-
|
13337
|
-
|
13338
|
-
|
13339
|
-
|
13340
|
-
|
13341
|
-
|
13342
|
-
|
13343
|
-
|
13344
|
-
|
13345
|
-
|
13346
|
-
|
13347
|
-
|
13348
|
-
|
13349
|
-
|
13350
|
-
|
13351
|
-
|
13352
|
-
}
|
13353
|
-
slotsLength = slots.length;
|
13354
|
-
|
13355
|
-
// if there are more values than available slots, remove lowest values
|
13356
|
-
if (length > slotsLength) {
|
13357
|
-
// create an array for sorting and ranking the points within each quarter
|
13358
|
-
rankArr = [].concat(points);
|
13359
|
-
rankArr.sort(sort);
|
13360
|
-
j = length;
|
13361
|
-
while (j--) {
|
13362
|
-
rankArr[j].rank = j;
|
13363
|
-
}
|
13364
|
-
j = length;
|
13365
|
-
while (j--) {
|
13366
|
-
if (points[j].rank >= slotsLength) {
|
13367
|
-
points.splice(j, 1);
|
13417
|
+
// Only do anti-collision when we are outside the pie and have connectors (#856)
|
13418
|
+
if (distanceOption > 0) {
|
13419
|
+
|
13420
|
+
// build the slots
|
13421
|
+
for (pos = centerY - radius - distanceOption; pos <= centerY + radius + distanceOption; pos += labelHeight) {
|
13422
|
+
slots.push(pos);
|
13423
|
+
// visualize the slot
|
13424
|
+
/*
|
13425
|
+
var slotX = series.getX(pos, i) + chart.plotLeft - (i ? 100 : 0),
|
13426
|
+
slotY = pos + chart.plotTop;
|
13427
|
+
if (!isNaN(slotX)) {
|
13428
|
+
chart.renderer.rect(slotX, slotY - 7, 100, labelHeight)
|
13429
|
+
.attr({
|
13430
|
+
'stroke-width': 1,
|
13431
|
+
stroke: 'silver'
|
13432
|
+
})
|
13433
|
+
.add();
|
13434
|
+
chart.renderer.text('Slot '+ (slots.length - 1), slotX, slotY + 4)
|
13435
|
+
.attr({
|
13436
|
+
fill: 'silver'
|
13437
|
+
}).add();
|
13368
13438
|
}
|
13439
|
+
// */
|
13440
|
+
}
|
13441
|
+
slotsLength = slots.length;
|
13442
|
+
|
13443
|
+
// if there are more values than available slots, remove lowest values
|
13444
|
+
if (length > slotsLength) {
|
13445
|
+
// create an array for sorting and ranking the points within each quarter
|
13446
|
+
rankArr = [].concat(points);
|
13447
|
+
rankArr.sort(sort);
|
13448
|
+
j = length;
|
13449
|
+
while (j--) {
|
13450
|
+
rankArr[j].rank = j;
|
13451
|
+
}
|
13452
|
+
j = length;
|
13453
|
+
while (j--) {
|
13454
|
+
if (points[j].rank >= slotsLength) {
|
13455
|
+
points.splice(j, 1);
|
13456
|
+
}
|
13457
|
+
}
|
13458
|
+
length = points.length;
|
13369
13459
|
}
|
13370
|
-
length = points.length;
|
13371
|
-
}
|
13372
13460
|
|
13373
|
-
|
13374
|
-
|
13375
|
-
|
13461
|
+
// The label goes to the nearest open slot, but not closer to the edge than
|
13462
|
+
// the label's index.
|
13463
|
+
for (j = 0; j < length; j++) {
|
13376
13464
|
|
13377
|
-
|
13378
|
-
|
13465
|
+
point = points[j];
|
13466
|
+
labelPos = point.labelPos;
|
13379
13467
|
|
13380
|
-
|
13381
|
-
|
13382
|
-
|
13468
|
+
var closest = 9999,
|
13469
|
+
distance,
|
13470
|
+
slotI;
|
13383
13471
|
|
13384
|
-
|
13385
|
-
|
13386
|
-
|
13387
|
-
|
13388
|
-
|
13389
|
-
|
13472
|
+
// find the closest slot index
|
13473
|
+
for (slotI = 0; slotI < slotsLength; slotI++) {
|
13474
|
+
distance = mathAbs(slots[slotI] - labelPos[1]);
|
13475
|
+
if (distance < closest) {
|
13476
|
+
closest = distance;
|
13477
|
+
slotIndex = slotI;
|
13478
|
+
}
|
13390
13479
|
}
|
13391
|
-
}
|
13392
13480
|
|
13393
|
-
|
13394
|
-
|
13395
|
-
|
13396
|
-
|
13397
|
-
|
13398
|
-
|
13399
|
-
|
13400
|
-
|
13401
|
-
|
13402
|
-
|
13403
|
-
|
13404
|
-
|
13405
|
-
|
13406
|
-
|
13481
|
+
// if that slot index is closer to the edges of the slots, move it
|
13482
|
+
// to the closest appropriate slot
|
13483
|
+
if (slotIndex < j && slots[j] !== null) { // cluster at the top
|
13484
|
+
slotIndex = j;
|
13485
|
+
} else if (slotsLength < length - j + slotIndex && slots[j] !== null) { // cluster at the bottom
|
13486
|
+
slotIndex = slotsLength - length + j;
|
13487
|
+
while (slots[slotIndex] === null) { // make sure it is not taken
|
13488
|
+
slotIndex++;
|
13489
|
+
}
|
13490
|
+
} else {
|
13491
|
+
// Slot is taken, find next free slot below. In the next run, the next slice will find the
|
13492
|
+
// slot above these, because it is the closest one
|
13493
|
+
while (slots[slotIndex] === null) { // make sure it is not taken
|
13494
|
+
slotIndex++;
|
13495
|
+
}
|
13407
13496
|
}
|
13408
|
-
}
|
13409
13497
|
|
13410
|
-
|
13411
|
-
|
13498
|
+
usedSlots.push({ i: slotIndex, y: slots[slotIndex] });
|
13499
|
+
slots[slotIndex] = null; // mark as taken
|
13500
|
+
}
|
13501
|
+
// sort them in order to fill in from the top
|
13502
|
+
usedSlots.sort(sort);
|
13412
13503
|
}
|
13413
|
-
// sort them in order to fill in from the top
|
13414
|
-
usedSlots.sort(sort);
|
13415
|
-
|
13416
13504
|
|
13417
13505
|
// now the used slots are sorted, fill them up sequentially
|
13418
13506
|
for (j = 0; j < length; j++) {
|
13419
13507
|
|
13508
|
+
var slot, naturalY;
|
13509
|
+
|
13420
13510
|
point = points[j];
|
13421
13511
|
labelPos = point.labelPos;
|
13422
13512
|
dataLabel = point.dataLabel;
|
13423
|
-
var slot = usedSlots.pop(),
|
13424
|
-
naturalY = labelPos[1];
|
13425
|
-
|
13426
13513
|
visibility = point.visible === false ? HIDDEN : VISIBLE;
|
13427
|
-
|
13514
|
+
naturalY = labelPos[1];
|
13515
|
+
|
13516
|
+
if (distanceOption > 0) {
|
13517
|
+
slot = usedSlots.pop();
|
13518
|
+
slotIndex = slot.i;
|
13519
|
+
|
13520
|
+
// if the slot next to currrent slot is free, the y value is allowed
|
13521
|
+
// to fall back to the natural position
|
13522
|
+
y = slot.y;
|
13523
|
+
if ((naturalY > y && slots[slotIndex + 1] !== null) ||
|
13524
|
+
(naturalY < y && slots[slotIndex - 1] !== null)) {
|
13525
|
+
y = naturalY;
|
13526
|
+
}
|
13428
13527
|
|
13429
|
-
|
13430
|
-
// to fall back to the natural position
|
13431
|
-
y = slot.y;
|
13432
|
-
if ((naturalY > y && slots[slotIndex + 1] !== null) ||
|
13433
|
-
(naturalY < y && slots[slotIndex - 1] !== null)) {
|
13528
|
+
} else {
|
13434
13529
|
y = naturalY;
|
13435
13530
|
}
|
13436
13531
|
|
13437
13532
|
// get the x - use the natural x position for first and last slot, to prevent the top
|
13438
13533
|
// and botton slice connectors from touching each other on either side
|
13439
|
-
x =
|
13534
|
+
x = options.justify ?
|
13535
|
+
seriesCenter[0] + (i ? -1 : 1) * (radius + distanceOption) :
|
13536
|
+
series.getX(slotIndex === 0 || slotIndex === slots.length - 1 ? naturalY : y, i);
|
13440
13537
|
|
13441
13538
|
// move or place the data label
|
13442
13539
|
dataLabel
|
@@ -13538,6 +13635,6 @@ extend(Highcharts, {
|
|
13538
13635
|
extendClass: extendClass,
|
13539
13636
|
placeBox: placeBox,
|
13540
13637
|
product: 'Highcharts',
|
13541
|
-
version: '2.2.
|
13638
|
+
version: '2.2.2'
|
13542
13639
|
});
|
13543
|
-
}());
|
13640
|
+
}());
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Highcharts JS v2.2.
|
2
|
+
* @license Highcharts JS v2.2.2 (2012-04-26)
|
3
3
|
* MooTools adapter
|
4
4
|
*
|
5
5
|
* (c) 2010-2011 Torstein Hønsi
|
@@ -285,6 +285,15 @@ win.HighchartsAdapter = {
|
|
285
285
|
}
|
286
286
|
},
|
287
287
|
|
288
|
+
/**
|
289
|
+
* Set back e.pageX and e.pageY that MooTools has abstracted away
|
290
|
+
*/
|
291
|
+
washMouseEvent: function (e) {
|
292
|
+
e.pageX = e.page.x;
|
293
|
+
e.pageY = e.page.y;
|
294
|
+
return e;
|
295
|
+
},
|
296
|
+
|
288
297
|
/**
|
289
298
|
* Stop running animations on the object
|
290
299
|
*/
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Highcharts JS v2.2.
|
2
|
+
* @license Highcharts JS v2.2.2 (2012-04-26)
|
3
3
|
* Prototype adapter
|
4
4
|
*
|
5
5
|
* @author Michael Nelson, Torstein Hønsi.
|
@@ -230,6 +230,10 @@ return {
|
|
230
230
|
}
|
231
231
|
},
|
232
232
|
|
233
|
+
washMouseEvent: function (e) {
|
234
|
+
return e;
|
235
|
+
},
|
236
|
+
|
233
237
|
// um, grep
|
234
238
|
grep: function (arr, fn) {
|
235
239
|
return arr.findAll(fn);
|
@@ -2908,7 +2908,7 @@ if (CanvasRenderingContext2D) {
|
|
2908
2908
|
});
|
2909
2909
|
}
|
2910
2910
|
}/**
|
2911
|
-
* @license Highcharts JS v2.2.
|
2911
|
+
* @license Highcharts JS v2.2.2 (2012-04-26)
|
2912
2912
|
* CanVGRenderer Extension module
|
2913
2913
|
*
|
2914
2914
|
* (c) 2011-2012 Torstein Hønsi, Erik Olsson
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Highcharts JS v2.2.
|
2
|
+
* @license Highcharts JS v2.2.2 (2012-04-26)
|
3
3
|
* Exporting module
|
4
4
|
*
|
5
5
|
* (c) 2010-2011 Torstein Hønsi
|
@@ -272,6 +272,8 @@ extend(Chart.prototype, {
|
|
272
272
|
.replace(/url\([^#]+#/g, 'url(#')
|
273
273
|
.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
|
274
274
|
.replace(/ href=/g, ' xlink:href=')
|
275
|
+
.replace(/\n/, ' ')
|
276
|
+
.replace(/<\/svg>.*?$/, '</svg>') // any HTML added to the container after the SVG (#894)
|
275
277
|
/* This fails in IE < 8
|
276
278
|
.replace(/([0-9]+)\.([0-9]+)/g, function(s1, s2, s3) { // round off to save weight
|
277
279
|
return s2 +'.'+ s3[0];
|
@@ -320,7 +322,8 @@ extend(Chart.prototype, {
|
|
320
322
|
// create the form
|
321
323
|
form = createElement('form', {
|
322
324
|
method: 'post',
|
323
|
-
action: options.url
|
325
|
+
action: options.url,
|
326
|
+
enctype: 'multipart/form-data'
|
324
327
|
}, {
|
325
328
|
display: NONE
|
326
329
|
}, doc.body);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: highcharts-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-26 00:00:00.000000000 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|
17
|
-
requirement: &
|
17
|
+
requirement: &70185090385860 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,21 +22,21 @@ dependencies:
|
|
22
22
|
version: '3.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70185090385860
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: bundler
|
28
|
-
requirement: &
|
28
|
+
requirement: &70185090385360 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0
|
33
|
+
version: '1.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70185090385360
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rails
|
39
|
-
requirement: &
|
39
|
+
requirement: &70185090384900 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: '3.1'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70185090384900
|
48
48
|
description: Gem that includes Highcharts (Interactive JavaScript charts for your
|
49
49
|
web projects), in the Rails Asset Pipeline introduced in Rails 3.1
|
50
50
|
email:
|
@@ -64,6 +64,8 @@ files:
|
|
64
64
|
- lib/highcharts/rails.rb
|
65
65
|
- lib/highcharts/version.rb
|
66
66
|
- vendor/assets/images/highcharts/skies.jpg
|
67
|
+
- vendor/assets/images/highcharts/snow.png
|
68
|
+
- vendor/assets/images/highcharts/sun.png
|
67
69
|
- vendor/assets/javascripts/highcharts.js
|
68
70
|
- vendor/assets/javascripts/highcharts/adapters/mootools.js
|
69
71
|
- vendor/assets/javascripts/highcharts/adapters/prototype.js
|