Skip to content

Commit

Permalink
Merged bugfix into master.
Browse files Browse the repository at this point in the history
  • Loading branch information
TorsteinHonsi committed Oct 13, 2017
1 parent f9ea190 commit b4b4221
Show file tree
Hide file tree
Showing 32 changed files with 523 additions and 377 deletions.
8 changes: 5 additions & 3 deletions js/indicators/accumulation-distribution.src.js
Expand Up @@ -28,7 +28,8 @@ seriesType('ad', 'sma',
*
* @extends {plotOptions.sma}
* @product highstock
* @sample {highstock} stock/indicators/accumulation-distribution Exponential moving average indicator
* @sample {highstock} stock/indicators/accumulation-distribution
* Accumulation/Distribution indicator
* @since 6.0.0
* @optionparent plotOptions.ad
*/
Expand All @@ -37,9 +38,10 @@ seriesType('ad', 'sma',
params: {
/**
* The id of volume series which is mandatory.
* For example using OHLC data, volumeSeriesID='volume' means the indicator will be calculated using OHLC and volume values.
* For example using OHLC data, volumeSeriesID='volume' means
* the indicator will be calculated using OHLC and volume values.
*
* @type {Number}
* @type {String}
* @since 6.0.0
* @product highstock
*/
Expand Down
2 changes: 1 addition & 1 deletion js/indicators/atr.src.js
Expand Up @@ -46,7 +46,7 @@ seriesType('atr', 'sma',
*
* @extends {plotOptions.sma}
* @product highstock
* @sample {highstock} stock/indicators/atr Exponential moving average indicator
* @sample {highstock} stock/indicators/atr ATR indicator
* @since 6.0.0
* @optionparent plotOptions.atr
*/
Expand Down
2 changes: 1 addition & 1 deletion js/indicators/cci.src.js
Expand Up @@ -36,7 +36,7 @@ seriesType('cci', 'sma',
*
* @extends {plotOptions.sma}
* @product highstock
* @sample {highstock} stock/indicators/cci Exponential moving average indicator
* @sample {highstock} stock/indicators/cci CCI indicator
* @since 6.0.0
* @optionparent plotOptions.cci
*/
Expand Down
3 changes: 2 additions & 1 deletion js/indicators/ema.src.js
Expand Up @@ -34,7 +34,8 @@ seriesType('ema', 'sma',
*
* @extends {plotOptions.sma}
* @product highstock
* @sample {highstock} stock/indicators/ema Exponential moving average indicator
* @sample {highstock} stock/indicators/ema
* Exponential moving average indicator
* @since 6.0.0
* @optionparent plotOptions.ema
*/
Expand Down
3 changes: 2 additions & 1 deletion js/indicators/ichimoku-kinko-hyo.src.js
Expand Up @@ -68,7 +68,8 @@ seriesType('ikh', 'sma',
*
* @extends {plotOptions.sma}
* @product highstock
* @sample {highstock} stock/indicators/ichimoku-kinko-hyo Simple moving average indicator
* @sample {highstock} stock/indicators/ichimoku-kinko-hyo
* Ichimoku Kinko Hyo indicator
* @since 6.0.0
* @excluding
* allAreas,colorAxis,compare,compareBase,joinBy,keys,stacking,
Expand Down
2 changes: 1 addition & 1 deletion js/indicators/indicators.src.js
Expand Up @@ -26,7 +26,7 @@ seriesType('sma', 'line',
* @excluding
* allAreas,colorAxis,compare,compareBase,joinBy,keys,stacking,
* showInNavigator,navigatorOptions,pointInterval,pointIntervalUnit,
* pointPlacement,pointRange,pointStart
* pointPlacement,pointRange,pointStart,joinBy
* @optionparent plotOptions.sma
*/
{
Expand Down
2 changes: 1 addition & 1 deletion js/indicators/macd.src.js
Expand Up @@ -23,7 +23,7 @@ seriesType('macd', 'sma',
*
* @extends {plotOptions.sma}
* @product highstock
* @sample {highstock} stock/indicators/macd Exponential moving average indicator
* @sample {highstock} stock/indicators/macd MACD indicator
* @since 6.0.0
* @optionparent plotOptions.macd
*/
Expand Down
2 changes: 1 addition & 1 deletion js/indicators/mfi.src.js
Expand Up @@ -67,7 +67,7 @@ H.seriesType('mfi', 'sma',
* For example using OHLC data, volumeSeriesID='volume' means
* the indicator will be calculated using OHLC and volume values.
*
* @type {Number}
* @type {String}
* @since 6.0.0
* @product highstock
*/
Expand Down
2 changes: 1 addition & 1 deletion js/indicators/momentum.src.js
Expand Up @@ -26,7 +26,7 @@ seriesType('momentum', 'sma',
*
* @extends {plotOptions.sma}
* @product highstock
* @sample {highstock} stock/indicators/momentum Exponential moving average indicator
* @sample {highstock} stock/indicators/momentum Momentum indicator
* @since 6.0.0
* @optionparent plotOptions.momentum
*/
Expand Down
2 changes: 1 addition & 1 deletion js/indicators/rsi.src.js
Expand Up @@ -18,7 +18,7 @@ H.seriesType('rsi', 'sma',
* @extends {plotOptions.sma}
* @product highstock
* @sample {highstock} stock/indicators/rsi
* RSI
* RSI indicator
* @since 6.0.0
* @optionparent plotOptions.rsi
*/
Expand Down
67 changes: 32 additions & 35 deletions js/modules/boost-canvas.src.js
@@ -1,10 +1,6 @@
/**
* License: www.highcharts.com/license
* Author: Torstein Honsi, Christer Vasseng
*
* This is a Highcharts module that draws long data series on a canvas
* in order to increase performance of the initial load time and tooltip
* responsiveness.
*
* This module serves as a fallback for the Boost module in IE9 and IE10. Newer
* browsers support WebGL which is faster.
Expand Down Expand Up @@ -56,7 +52,7 @@ H.initCanvasBoost = function () {
pointAttr = point.series.pointAttribs(point);
/*= } else { =*/
pointAttr = point.series.colorAttribs(point);
/*= } =*/
/*= } =*/

ctx.fillStyle = pointAttr.fill;
ctx.fillRect(shapeArgs.x, shapeArgs.y, shapeArgs.width, shapeArgs.height);
Expand All @@ -77,16 +73,16 @@ H.initCanvasBoost = function () {


H.extend(Series.prototype, {

/**
* Create a hidden canvas to draw the graph on. The contents is later copied over
* Create a hidden canvas to draw the graph on. The contents is later copied over
* to an SVG image element.
*/
getContext: function () {
var chart = this.chart,
width = chart.chartWidth,
height = chart.chartHeight,
targetGroup = this.group,
targetGroup = chart.seriesGroup || this.group,
target = this,
ctx,
swapXY = function (proceed, x, y, a, b, c, d) {
Expand All @@ -112,13 +108,23 @@ H.initCanvasBoost = function () {
).add(targetGroup);

target.ctx = ctx = target.canvas.getContext('2d');

if (chart.inverted) {
each(['moveTo', 'lineTo', 'rect', 'arc'], function (fn) {
wrap(ctx, fn, swapXY);
});
}

target.boostClear = function () {
ctx.clearRect(0, 0, target.canvas.width, target.canvas.height);

if (target.renderTarget) {
target.renderTarget.attr({
href: ''
});
}
};

target.boostClipRect = chart.renderer.clipRect(
chart.plotLeft,
chart.plotTop,
Expand All @@ -133,40 +139,32 @@ H.initCanvasBoost = function () {
}

if (target.canvas.width !== width) {
target.canvas.width = width;
target.canvas.width = width;
}

if (target.canvas.height !== height) {
target.canvas.height = height;
target.canvas.height = height;
}

target.renderTarget.attr({
x: 0,
y: 0,
width: width,
height: height,
style: 'pointer-events: none'
style: 'pointer-events: none',
href: ''
});

target.boostClipRect.attr({
x: 0,
y: 0,
x: chart.plotLeft,
y: chart.plotTop,
width: chart.plotWidth,
height: chart.chartHeight
});

return ctx;
},

/**
* Clear the target image
*/
boostClear: function () {
if (this.renderTarget) {
this.renderTarget.attr({ href: '' });
}
},

/**
* Draw the canvas image inside an SVG image
*/
Expand Down Expand Up @@ -240,7 +238,7 @@ H.initCanvasBoost = function () {
fillColor = series.fillOpacity ?
new Color(series.color).setOpacity(pick(options.fillOpacity, 0.75)).get() :
series.color,

stroke = function () {
if (doFill) {
ctx.fillStyle = fillColor;
Expand All @@ -264,7 +262,7 @@ H.initCanvasBoost = function () {
if (chart.scroller && series.options.className === 'highcharts-navigator-series') {
plotY += chart.scroller.top;
if (yBottom) {
yBottom += chart.scroller.top;
yBottom += chart.scroller.top;
}
} else {
plotY += chart.plotTop;
Expand Down Expand Up @@ -304,7 +302,7 @@ H.initCanvasBoost = function () {
// Avoid more string concatination than required
kdIndex = clientX + ',' + plotY;

// The k-d tree requires series points. Reduce the amount of points, since the time to build the
// The k-d tree requires series points. Reduce the amount of points, since the time to build the
// tree increases exponentially.
if (enableMouseTracking && !pointTaken[kdIndex]) {
pointTaken[kdIndex] = true;
Expand Down Expand Up @@ -344,7 +342,8 @@ H.initCanvasBoost = function () {

points = this.points = [];
ctx = this.getContext();
series.buildKDTree = noop; // Do not start building while drawing
series.buildKDTree = noop; // Do not start building while drawing
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);

if (!this.visible) {
return;
Expand Down Expand Up @@ -440,9 +439,9 @@ H.initCanvasBoost = function () {
isYInside = y >= yMin && y <= yMax;
}

if (!isNull &&
if (!isNull &&
(
(x >= xMin && x <= xMax && isYInside) ||
(x >= xMin && x <= xMax && isYInside) ||
(isNextInside || isPrevInside)
)) {

Expand Down Expand Up @@ -526,7 +525,6 @@ H.initCanvasBoost = function () {
}, 250);
}


delete series.buildKDTree; // Go back to prototype, ready to build
series.buildKDTree();

Expand All @@ -542,7 +540,6 @@ H.initCanvasBoost = function () {
}
});
*/

seriesTypes.scatter.prototype.cvsMarkerCircle = function (ctx, clientX, plotY, r) {
ctx.moveTo(clientX, plotY);
ctx.arc(clientX, plotY, r, 0, 2 * Math.PI, false);
Expand Down Expand Up @@ -589,7 +586,7 @@ H.initCanvasBoost = function () {
if (chart.renderTarget && chart.canvas) {
chart.renderTarget.attr({
href: chart.canvas.toDataURL('image/png')
});
});
}
}

Expand All @@ -600,15 +597,15 @@ H.initCanvasBoost = function () {

if (chart.canvas) {
chart.canvas.getContext('2d').clearRect(
0,
0,
0,
0,
chart.canvas.width,
chart.canvas.height
);
}
}

addEvent(chart, 'predraw', clear);
addEvent(chart, 'predraw', clear);
addEvent(chart, 'render', canvasToSVG);
});
};
1 change: 0 additions & 1 deletion js/modules/boost.src.js
Expand Up @@ -3120,7 +3120,6 @@ if (!hasWebGLSupport()) {
function (t) {
if (seriesTypes[t]) {
wrap(seriesTypes[t].prototype, 'drawPoints', pointDrawHandler);
// seriesTypes[t].prototype.directTouch = false; // Use k-d-tree
}
}
);
Expand Down
14 changes: 14 additions & 0 deletions js/modules/oldie.src.js
Expand Up @@ -140,6 +140,20 @@ if (!Array.prototype.filter) {
};
}

if (!Object.prototype.keys) {
H.keysPolyfill = function (obj) {
var result = [],
hasOwnProperty = Object.prototype.hasOwnProperty,
prop;
for (prop in obj) {
if (hasOwnProperty.call(obj, prop)) {
result.push(prop);
}
}
return result;
};
}


if (!Array.prototype.reduce) {
H.reducePolyfill = function (func, initialValue) {
Expand Down

0 comments on commit b4b4221

Please sign in to comment.