Skip to content

Commit 1eb42be

Browse files
committed
Build files.
1 parent 5235ffd commit 1eb42be

4 files changed

+121
-119
lines changed

build/gallery-charts-stockindicators/gallery-charts-stockindicators-coverage.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/gallery-charts-stockindicators/gallery-charts-stockindicators-debug.js

+54-53
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ Y.extend(Y.IntradayAxisBase, Y.CategoryAxisBase, {
199199
last = allData[allData.length - 1].Timestamp;
200200
if(dataGranularity) {
201201
interval = parseFloat(dataGranularity) * 60000;
202-
max = new Date(max).valueOf();
203-
last = new Date(last).valueOf();
202+
max = +new Date(max);
203+
last = +new Date(last);
204204

205205
if(max > last) {
206206
while(max > last) {
@@ -318,10 +318,10 @@ Y.CanvasAxis = Y.Base.create("canvasAxis", Y.AxisBase, [Y.Renderer], Y.merge(Y.A
318318
explicitLabels = this._labelValuesExplicitlySet ? this.get("labelValues") : null,
319319
direction = (position === "left" || position === "right") ? "vertical" : "horizontal";
320320
if(margin) {
321-
marginLeft = Y.Lang.isNumber(margin.left) ? margin.left : 0;
322-
marginRight = Y.Lang.isNumber(margin.right) ? margin.right : 0;
323-
marginTop = Y.Lang.isNumber(margin.top) ? margin.top : 0;
324-
marginBottom = Y.Lang.isNumber(margin.bottom) ? margin.bottom : 0;
321+
marginLeft = typeof margin.left === "number" && isFinite(margin.left) ? margin.left : 0;
322+
marginRight = typeof margin.right === "number" && isFinite(margin.right) ? margin.right : 0;
323+
marginTop = typeof margin.top === "number" && isFinite(margin.top) ? margin.top : 0;
324+
marginBottom = typeof margin.bottom === "number" && isFinite(margin.bottom) ? margin.bottom : 0;
325325
}
326326
//need to defaultMargins method to the layout classes.
327327
for(i in defaultMargins)
@@ -2874,8 +2874,7 @@ Y.MultipleLineSeries = Y.Base.create("multipleLineSeries", Y.CartesianSeries, [Y
28742874
{
28752875
return;
28762876
}
2877-
var isNumber = Y.Lang.isNumber,
2878-
direction = this.get("direction"),
2877+
var direction = this.get("direction"),
28792878
len,
28802879
lastPointValid,
28812880
pointValid,
@@ -2917,7 +2916,7 @@ Y.MultipleLineSeries = Y.Base.create("multipleLineSeries", Y.CartesianSeries, [Y
29172916
{
29182917
nextX = Math.round(xcoords[i] * 1000)/1000;
29192918
nextY = Math.round(ycoords[i] * 1000)/1000;
2920-
pointValid = isNumber(nextX) && isNumber(nextY);
2919+
pointValid = typeof nextX === "number" && isFinite(nextX) && typeof nextY === "number" && isFinite(nextY);
29212920
if(pointValid) {
29222921
thresholdIndex = 0;
29232922
if(thresholds) {
@@ -2939,7 +2938,7 @@ Y.MultipleLineSeries = Y.Base.create("multipleLineSeries", Y.CartesianSeries, [Y
29392938
m = Math.round(((nextY - lastValidY) / (nextX - lastValidX)) * 1000)/1000;
29402939
intersectX = ((thresholdCoords[thresholdIndex] - nextY)/m) + nextX;
29412940
intersectY = thresholdCoords[thresholdIndex];
2942-
if(isNumber(lastPathIndex)) {
2941+
if(typeof lastPathIndex === "number" && isFinite(lastPathIndex)) {
29432942
this._lineTo(graphPaths[lastPathIndex], intersectX, intersectY);
29442943
}
29452944
this._moveTo(graphPaths[pathIndex], intersectX, intersectY);
@@ -3098,27 +3097,27 @@ Y.Crosshair.prototype = {
30983097
graph,
30993098
i,
31003099
index = Math.floor((x / this.width) * this._xcoords.length),
3101-
len = series.length;
3100+
len = series.length,
3101+
isNumber;
3102+
31023103
this._yline.set("transform", "translate(" + x + ")");
31033104
if(series) {
31043105
for(i = 0; i < len; i = i + 1) {
31053106
graph = series[i];
31063107
y = graph.coords[index];
3108+
isNumber = typeof y === "number" && isFinite(y);
3109+
31073110
if(graph.marker) {
3108-
if(Y.Lang.isNumber(y)) {
3109-
graph.marker.set("visible", true);
3111+
if(isNumber) {
31103112
graph.marker.set("transform", "translate(" + x + ", " + y + ")");
3111-
} else {
3112-
graph.marker.set("visible", false);
31133113
}
3114+
graph.marker.set("visible", isNumber);
31143115
}
31153116
if(graph.line) {
3116-
if(Y.Lang.isNumber(y)) {
3117-
graph.xLine.set("visible", true);
3117+
if(isNumber) {
31183118
graph.xLine.set("transform", "translateY(" + y + ")");
3119-
} else {
3120-
graph.xLine.set("visible", false);
31213119
}
3120+
graph.xLine.set("visible", isNumber);
31223121
}
31233122
}
31243123
}
@@ -3198,11 +3197,11 @@ Y.Gridlines = Y.Base.create("gridlines", Y.Base, [Y.Renderer], {
31983197
* would result in a solid fill across the area.
31993198
* @protected
32003199
*/
3201-
draw: function()
3200+
draw: function(w, h, startIndex, interval)
32023201
{
32033202
if(this.get("axis") && this.get("graphic"))
32043203
{
3205-
this._drawGridlines.apply(this, arguments);
3204+
this._drawGridlines(w, h, startIndex, interval);
32063205
}
32073206
},
32083207

@@ -3608,11 +3607,11 @@ Y.GridlinesCanvas = Y.Base.create("gridlinesCanvas", Y.Gridlines, [], {
36083607
* would result in a solid fill across the area.
36093608
* @protected
36103609
*/
3611-
draw: function()
3610+
draw: function(w, h, startIndex, interval)
36123611
{
36133612
if(this.get("axis"))
36143613
{
3615-
this._drawGridlines.apply(this, arguments);
3614+
this._drawGridlines(w, h, startIndex, interval);
36163615
}
36173616
},
36183617

@@ -3946,7 +3945,7 @@ StockIndicatorsLegend.prototype = {
39463945
this.dateLabelFunction = cfg.dateLabelFunction;
39473946
this.dateLabelFormat = cfg.dateLabelFormat;
39483947
this.dateLabelScope = cfg.dateLabelScope || this;
3949-
cfg.render.getDOMNode().appendChild(this.contentDiv);
3948+
cfg.render._node.appendChild(this.contentDiv);
39503949

39513950
len = seriesQueue.length;
39523951
myul = Y.DOM.create(
@@ -4085,7 +4084,7 @@ StockIndicatorsLegend.prototype = {
40854084
item.li.style.display = "inline-block";
40864085
val = dataItem[key];
40874086
item.value.innerHTML = Y.Number.format(parseFloat(val), this.valueLabelFormat);
4088-
Y.DOM.setStyle(item.value, "color", val > 0 ? this.priceUpColor : this.priceDownColor);
4087+
item.value.style.color = val > 0 ? this.priceUpColor : this.priceDownColor;
40894088
} else {
40904089
item.li.style.display = "none";
40914090
}
@@ -4279,8 +4278,8 @@ Y.StockIndicatorsAxisLegend.prototype = {
42794278
minLabel = DOCUMENT.createElement("span"),
42804279
height,
42814280
width,
4282-
minText = this._labelFunction.apply(this, [this._minimum, this._labelFormat]),
4283-
maxText = this._labelFunction.apply(this, [this._maximum, this._labelFormat]),
4281+
minText = this._labelFunction(this._minimum, this._labelFormat),
4282+
maxText = this._labelFunction(this._maximum, this._labelFormat),
42844283
container = DOCUMENT.createElement("div"),
42854284
arrow = DOCUMENT.createElement("span"),
42864285
key,
@@ -4380,7 +4379,7 @@ Y.StockIndicatorsAxisLegend.prototype = {
43804379
arrow = DOCUMENT.createElement("span"),
43814380
label = DOCUMENT.createElement("span"),
43824381
key,
4383-
text = this._labelFunction.apply(this, [value, this._labelFormat]),
4382+
text = this._labelFunction(value, this._labelFormat),
43844383
ycoord = previousClose.ycoord ||
43854384
axis._getCoordFromValue(this._minimum, this._maximum, this.height, value, this.height, true);
43864385
ycoord = ycoord + this._y;
@@ -4544,7 +4543,7 @@ Y.StockIndicatorsAxisLegend.prototype = {
45444543
label.style.background = background;
45454544
arrow.style.borderRightColor = background;
45464545
}
4547-
text = this._labelFunction.apply(this, [value, this._labelFormat]),
4546+
text = this._labelFunction(value, this._labelFormat),
45484547
ycoord = this._y + axis._getCoordFromValue(this._minimum, this._maximum, this.height, value, this.height, true);
45494548
label.appendChild(DOCUMENT.createTextNode(text));
45504549
container.style.position = "absolute";
@@ -5318,7 +5317,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
53185317
*/
53195318
initializer: function() {
53205319
var cb = this.get("contentBox");
5321-
cb.setStyle("position", "relative");
5320+
cb._node.style.position = "relative";
53225321
this._axes = [];
53235322
this._graphs = [];
53245323
this._graphics = [];
@@ -5569,7 +5568,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
55695568
startTimeline: function() {
55705569
if(!this._runTimeline) {
55715570
this._runTimeline = true;
5572-
this._timelineStart = (new Date()).valueOf() - 17;
5571+
this._timelineStart = +new Date() - 17;
55735572
this.redraw();
55745573
}
55755574
},
@@ -5602,7 +5601,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
56025601
chart,
56035602
i,
56045603
len = charts.length,
5605-
endTime = (new Date()).valueOf();
5604+
endTime = +new Date();
56065605
if(endTime >= this._timelineStart + 17) {
56075606
for(i = 0; i < len; i = i + 1) {
56085607
chart = charts[i];
@@ -5615,7 +5614,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
56155614
legend.redraw();
56165615
}
56175616
}
5618-
this._timelineStart = (new Date()).valueOf();
5617+
this._timelineStart = +new Date();
56195618
}
56205619
if(this._runTimeline && !this._autoDraw) {
56215620
this._timelineId = this._onEnterFrame.apply(WINDOW, [function() {
@@ -5678,13 +5677,19 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
56785677
valueLen,
56795678
valueKey,
56805679
groupMarkers,
5681-
nomarkers = ["candlestick", "line", "ohlc", "volumecolumn", "multipleline"];
5680+
nomarkers = {
5681+
"candlestick": true,
5682+
"line": true,
5683+
"ohlc": true,
5684+
"volumecolumn": true,
5685+
"multipleline": true
5686+
};
56825687
for(indIter = 0; indIter < indLen; indIter = indIter + 1) {
56835688
indicator = indicators[indIter];
56845689
valueKey = indicator.valueKey;
56855690
indicatorType = indicator.type;
56865691
if(indicatorType === "candlestick" || indicatorType === "ohlc" || typeof valueKey === "string") {
5687-
groupMarkers = Y.Array.indexOf(nomarkers, indicatorType) === -1 && indicator.groupMarkers;
5692+
groupMarkers = !nomarkers[indicatorType] && indicator.groupMarkers;
56885693
seriesConfig = {
56895694
groupMarkers: groupMarkers,
56905695
type: indicator.type,
@@ -5701,10 +5706,10 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
57015706
yKey: indicator.valueKey[valueIter]
57025707
};
57035708
if(typeof indicatorType === "string") {
5704-
seriesConfig.groupMarkers = Y.Array.indexOf(nomarkers, indicatorType) === -1 && indicator.groupMarkers;
5709+
seriesConfig.groupMarkers = !nomarkers[indicatorType] && indicator.groupMarkers;
57055710
seriesConfig.type = indicatorType;
57065711
} else {
5707-
seriesConfig.groupMarkers = Y.Array.indexOf(nomarkers, indicatorType[valueIter]) === -1 && indicator.groupMarkers;
5712+
seriesConfig.groupMarkers = !nomarkers[indicatorType] && indicator.groupMarkers;
57085713
seriesConfig.type = indicatorType[valueIter];
57095714
if(indicatorType[valueIter] === "multipleline" && config.threshold && config.range === "1d") {
57105715
seriesConfig.thresholds = [parseFloat(indicator.previousClose)];
@@ -5964,11 +5969,12 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
59645969
numericAxis = new NumericClass(numericConfig);
59655970
dateAxis = new DateClass(dateConfig);
59665971
bb = dateAxis.get("boundingBox");
5967-
bb.setStyle("left", 0 + "px");
5968-
bb.setStyle("top", dateConfig.y + "px");
5972+
bb._node.style.left = 0;
5973+
bb._node.style.top = dateConfig.y + "px";
5974+
59695975
bb = numericAxis.get("boundingBox");
5970-
bb.setStyle("left", numericConfig.x + "px");
5971-
bb.setStyle("top", numericConfig.y + "px");
5976+
bb._node.style.left = numericConfig.x + "px";
5977+
bb._node.style.top = numericConfig.y + "px";
59725978
axes = {
59735979
numeric: numericAxis,
59745980
date: dateAxis
@@ -6146,7 +6152,8 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
61466152
key,
61476153
color,
61486154
crosshairKey,
6149-
validKeys = config.keys;
6155+
validKeys = Y.Array.hash(config.keys);
6156+
61506157
for(key in graphs) {
61516158
if(graphs.hasOwnProperty(key)){
61526159
crosshairKey = key === "quote" ? "close" : key;
@@ -6155,7 +6162,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
61556162
if(color && typeof color === "object" && graph.get("type") === "combo") {
61566163
color = color.line;
61576164
}
6158-
if(Y.Array.indexOf(validKeys, crosshairKey) > -1) {
6165+
if(validKeys[crosshairKey]) {
61596166
series = {
61606167
marker: {
61616168
shape: "circle",
@@ -6360,7 +6367,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
63606367
config.legend.width = graphConfig.width;
63616368
}
63626369
legend = this._addLegend(config, cb);
6363-
if(thresholdStyles && typeof previousClose === "number") {
6370+
if(thresholdStyles && typeof previousClose === "number" && isFinite(previousClose)) {
63646371
thresholdConfig = {
63656372
type: "thresholdline",
63666373
thresholds: [previousClose],
@@ -6500,15 +6507,9 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
65006507
}
65016508
}
65026509
}
6503-
if(this._startHandle) {
6504-
this._startHandle.detach();
6505-
}
6506-
if(this._moveHandle) {
6507-
this._moveHandle.detach();
6508-
}
6509-
if(this._endHandle) {
6510-
this._endHandle.detach();
6511-
}
6510+
this._startHandle.detach();
6511+
this._moveHandle.detach();
6512+
this._endHandle.detach();
65126513
},
65136514

65146515
destructor: function() {

0 commit comments

Comments
 (0)