first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,314 @@
YUI.add('series-candlestick', function (Y, NAME) {
/**
* Provides functionality for creating a candlestick series.
*
* @module charts
* @submodule series-candlestick
*/
/**
* The CandlestickSeries class renders columns (candles) and lines (wicks) representing the open, high, low and close
* values for a chart.
*
* @class CandlestickSeries
* @extends RangeSeries
* @constructor
* @param {Object} config (optional) Configuration parameters.
* @submodule series-candlestick
*/
function CandlestickSeries()
{
CandlestickSeries.superclass.constructor.apply(this, arguments);
}
CandlestickSeries.NAME = "candlestickSeries";
CandlestickSeries.ATTRS = {
/**
* Read-only attribute indicating the type of series.
*
* @attribute type
* @type String
* @readOnly
* @default candlestick
*/
type: {
value: "candlestick"
},
/**
* The graphic in which drawings will be rendered.
*
* @attribute graphic
* @type Graphic
*/
graphic: {
lazyAdd: false,
setter: function(val) {
//woraround for Attribute order of operations bug
if(!this.get("rendered")) {
this.set("rendered", true);
}
this.set("upcandle", val.addShape({
type: "path"
}));
this.set("downcandle", val.addShape({
type: "path"
}));
this.set("wick", val.addShape({
type: "path"
}));
return val;
}
},
/**
* Reference to the candlestick used when the close value is higher than the open value.
*
* @attribute upcandle
* @type Path
*/
upcandle: {},
/**
* Reference to the candlestick used when the open value is higher than the close value.
*
* @attribute downcandle
* @type Path
*/
downcandle: {},
/**
* Reference to the line drawn between the high and low values.
*
* @attribute wick
* @type Path
*/
wick: {}
/**
* Style properties used for drawing candles and wicks. This attribute is inherited from `RangeSeries`. Below are the default values:
* <dl>
* <dt>upcandle</dt><dd>Properties for a candle representing a period that closes higher than it opens.
* <dl>
* <dt>fill</dt><dd>A hash containing the following values:
* <dl>
* <dt>color</dt><dd>Color of the fill. The default value is "#00aa00".</dd>
* </dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker fill. The default value is 1.</dd>
* </dl>
* </dd>
* <dt>border</dt><dd>A hash containing the following values:
* <dl>
* <dt>color</dt><dd>Color of the border. The default value is "#000000".</dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
* <dt>weight</dt><dd>Number indicating the width of the border. The default value is 0.</dd>
* </dl>
* </dd>
* </dl>
* </dd>
* <dt>downcandle</dt><dd>Properties for a candle representing a period that opens higher than it closes.
* <dl>
* <dt>fill</dt><dd>A hash containing the following values:
* <dl>
* <dt>color</dt><dd>Color of the fill. The default value is "#aa0000".</dd>
* </dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker fill. The default value is 1.</dd>
* </dl>
* </dd>
* <dt>border</dt><dd>A hash containing the following values:
* <dl>
* <dt>color</dt><dd>Color of the border. The default value is "#000000".</dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
* <dt>weight</dt><dd>Number indicating the width of the border. The default value is 0.</dd>
* </dl>
* </dd>
* </dl>
* </dd>
* <dt>wick</dt><dd>Properties for the wick, which is a line drawn from the high point of the period to the low point of the period.
* <dl>
* <dt>color</dt><dd>The color of the wick. The default value is "#000000".</dd>
* <dt>weight</dt><dd>The weight of the wick. The default value is 1.</dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the wick. The default value is 1.</dd>
* </dl>
* </dd>
* </dl>
*
* @attribute styles
* @type Object
*/
};
Y.extend(CandlestickSeries, Y.RangeSeries, {
/**
* Draws markers for an Candlestick series.
*
* @method
* @param {Array} xcoords The xcoordinates to be plotted.
* @param {Array} opencoords The coordinates representing the open values.
* @param {Array} highcoords The coordinates representing the high values.
* @param {Array} lowcoords The coordinates representing the low values.
* @param {Array} closecoords The coordinates representing the close values.
* @param {Number} len The number of x coordinates to plot.
* @param {Number} width The width of each candlestick marker.
* @param {Number} halfwidth Half the width of each candlestick marker.
* @param {Object} styles The styles for the series.
* @private
*/
_drawMarkers: function(xcoords, opencoords, highcoords, lowcoords, closecoords, len, width, halfwidth, styles)
{
var upcandle = this.get("upcandle"),
downcandle = this.get("downcandle"),
candle,
wick = this.get("wick"),
wickStyles = styles.wick,
wickWidth = wickStyles.width,
cx,
opencoord,
highcoord,
lowcoord,
closecoord,
left,
right,
top,
bottom,
height,
leftPadding = styles.padding.left,
up,
i,
isNumber = Y.Lang.isNumber;
upcandle.set(styles.upcandle);
downcandle.set(styles.downcandle);
wick.set({
fill: wickStyles.fill,
stroke: wickStyles.stroke,
shapeRendering: wickStyles.shapeRendering
});
upcandle.clear();
downcandle.clear();
wick.clear();
for(i = 0; i < len; i = i + 1)
{
cx = Math.round(xcoords[i] + leftPadding);
left = cx - halfwidth;
right = cx + halfwidth;
opencoord = Math.round(opencoords[i]);
highcoord = Math.round(highcoords[i]);
lowcoord = Math.round(lowcoords[i]);
closecoord = Math.round(closecoords[i]);
up = opencoord > closecoord;
top = up ? closecoord : opencoord;
bottom = up ? opencoord : closecoord;
height = bottom - top;
candle = up ? upcandle : downcandle;
if(candle && isNumber(left) && isNumber(top) && isNumber(width) && isNumber(height))
{
candle.drawRect(left, top, width, height);
}
if(isNumber(cx) && isNumber(highcoord) && isNumber(lowcoord))
{
wick.drawRect(cx - wickWidth/2, highcoord, wickWidth, lowcoord - highcoord);
}
}
upcandle.end();
downcandle.end();
wick.end();
wick.toBack();
},
/**
* Toggles visibility
*
* @method _toggleVisible
* @param {Boolean} visible indicates visibilitye
* @private
*/
_toggleVisible: function(visible)
{
this.get("upcandle").set("visible", visible);
this.get("downcandle").set("visible", visible);
this.get("wick").set("visible", visible);
},
/**
* Destructor implementation for the CartesianSeries class. Calls destroy on all Graphic instances.
*
* @method destructor
* @protected
*/
destructor: function()
{
var upcandle = this.get("upcandle"),
downcandle = this.get("downcandle"),
wick = this.get("wick");
if(upcandle)
{
upcandle.destroy();
}
if(downcandle)
{
downcandle.destroy();
}
if(wick)
{
wick.destroy();
}
},
/**
* Gets the default value for the `styles` attribute. Overrides
* base implementation.
*
* @method _getDefaultStyles
* @return Object
* @private
*/
_getDefaultStyles: function()
{
var styles = {
upcandle: {
shapeRendering: "crispEdges",
fill: {
color: "#00aa00",
alpha: 1
},
stroke: {
color: "#000000",
alpha: 1,
weight: 0
}
},
downcandle: {
shapeRendering: "crispEdges",
fill: {
color: "#aa0000",
alpha: 1
},
stroke: {
color: "#000000",
alpha: 1,
weight: 0
}
},
wick: {
shapeRendering: "crispEdges",
width: 1,
fill: {
color: "#000000",
alpha: 1
},
stroke: {
color: "#000000",
alpha: 1,
weight: 0
}
}
};
return this._mergeStyles(styles, CandlestickSeries.superclass._getDefaultStyles());
}
});
Y.CandlestickSeries = CandlestickSeries;
}, '3.18.1', {"requires": ["series-range"]});
@@ -0,0 +1 @@
YUI.add("series-candlestick",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}n.NAME="candlestickSeries",n.ATTRS={type:{value:"candlestick"},graphic:{lazyAdd:!1,setter:function(e){return this.get("rendered")||this.set("rendered",!0),this.set("upcandle",e.addShape({type:"path"})),this.set("downcandle",e.addShape({type:"path"})),this.set("wick",e.addShape({type:"path"})),e}},upcandle:{},downcandle:{},wick:{}},e.extend(n,e.RangeSeries,{_drawMarkers:function(t,n,r,i,s,o,u,a,f){var l=this.get("upcandle"),c=this.get("downcandle"),h,p=this.get("wick"),d=f.wick,v=d.width,m,g,y,b,w,E,S,x,T,N,C=f.padding.left,k,L,A=e.Lang.isNumber;l.set(f.upcandle),c.set(f.downcandle),p.set({fill:d.fill,stroke:d.stroke,shapeRendering:d.shapeRendering}),l.clear(),c.clear(),p.clear();for(L=0;L<o;L+=1)m=Math.round(t[L]+C),E=m-a,S=m+a,g=Math.round(n[L]),y=Math.round(r[L]),b=Math.round(i[L]),w=Math.round(s[L]),k=g>w,x=k?w:g,T=k?g:w,N=T-x,h=k?l:c,h&&A(E)&&A(x)&&A(u)&&A(N)&&h.drawRect(E,x,u,N),A(m)&&A(y)&&A(b)&&p.drawRect(m-v/2,y,v,b-y);l.end(),c.end(),p.end(),p.toBack()},_toggleVisible:function(e){this.get("upcandle").set("visible",e),this.get("downcandle").set("visible",e),this.get("wick").set("visible",e)},destructor:function(){var e=this.get("upcandle"),t=this.get("downcandle"),n=this.get("wick");e&&e.destroy(),t&&t.destroy(),n&&n.destroy()},_getDefaultStyles:function(){var e={upcandle:{shapeRendering:"crispEdges",fill:{color:"#00aa00",alpha:1},stroke:{color:"#000000",alpha:1,weight:0}},downcandle:{shapeRendering:"crispEdges",fill:{color:"#aa0000",alpha:1},stroke:{color:"#000000",alpha:1,weight:0}},wick:{shapeRendering:"crispEdges",width:1,fill:{color:"#000000",alpha:1},stroke:{color:"#000000",alpha:1,weight:0}}};return this._mergeStyles(e,n.superclass._getDefaultStyles())}}),e.CandlestickSeries=n},"3.18.1",{requires:["series-range"]});
@@ -0,0 +1,314 @@
YUI.add('series-candlestick', function (Y, NAME) {
/**
* Provides functionality for creating a candlestick series.
*
* @module charts
* @submodule series-candlestick
*/
/**
* The CandlestickSeries class renders columns (candles) and lines (wicks) representing the open, high, low and close
* values for a chart.
*
* @class CandlestickSeries
* @extends RangeSeries
* @constructor
* @param {Object} config (optional) Configuration parameters.
* @submodule series-candlestick
*/
function CandlestickSeries()
{
CandlestickSeries.superclass.constructor.apply(this, arguments);
}
CandlestickSeries.NAME = "candlestickSeries";
CandlestickSeries.ATTRS = {
/**
* Read-only attribute indicating the type of series.
*
* @attribute type
* @type String
* @readOnly
* @default candlestick
*/
type: {
value: "candlestick"
},
/**
* The graphic in which drawings will be rendered.
*
* @attribute graphic
* @type Graphic
*/
graphic: {
lazyAdd: false,
setter: function(val) {
//woraround for Attribute order of operations bug
if(!this.get("rendered")) {
this.set("rendered", true);
}
this.set("upcandle", val.addShape({
type: "path"
}));
this.set("downcandle", val.addShape({
type: "path"
}));
this.set("wick", val.addShape({
type: "path"
}));
return val;
}
},
/**
* Reference to the candlestick used when the close value is higher than the open value.
*
* @attribute upcandle
* @type Path
*/
upcandle: {},
/**
* Reference to the candlestick used when the open value is higher than the close value.
*
* @attribute downcandle
* @type Path
*/
downcandle: {},
/**
* Reference to the line drawn between the high and low values.
*
* @attribute wick
* @type Path
*/
wick: {}
/**
* Style properties used for drawing candles and wicks. This attribute is inherited from `RangeSeries`. Below are the default values:
* <dl>
* <dt>upcandle</dt><dd>Properties for a candle representing a period that closes higher than it opens.
* <dl>
* <dt>fill</dt><dd>A hash containing the following values:
* <dl>
* <dt>color</dt><dd>Color of the fill. The default value is "#00aa00".</dd>
* </dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker fill. The default value is 1.</dd>
* </dl>
* </dd>
* <dt>border</dt><dd>A hash containing the following values:
* <dl>
* <dt>color</dt><dd>Color of the border. The default value is "#000000".</dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
* <dt>weight</dt><dd>Number indicating the width of the border. The default value is 0.</dd>
* </dl>
* </dd>
* </dl>
* </dd>
* <dt>downcandle</dt><dd>Properties for a candle representing a period that opens higher than it closes.
* <dl>
* <dt>fill</dt><dd>A hash containing the following values:
* <dl>
* <dt>color</dt><dd>Color of the fill. The default value is "#aa0000".</dd>
* </dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker fill. The default value is 1.</dd>
* </dl>
* </dd>
* <dt>border</dt><dd>A hash containing the following values:
* <dl>
* <dt>color</dt><dd>Color of the border. The default value is "#000000".</dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
* <dt>weight</dt><dd>Number indicating the width of the border. The default value is 0.</dd>
* </dl>
* </dd>
* </dl>
* </dd>
* <dt>wick</dt><dd>Properties for the wick, which is a line drawn from the high point of the period to the low point of the period.
* <dl>
* <dt>color</dt><dd>The color of the wick. The default value is "#000000".</dd>
* <dt>weight</dt><dd>The weight of the wick. The default value is 1.</dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the wick. The default value is 1.</dd>
* </dl>
* </dd>
* </dl>
*
* @attribute styles
* @type Object
*/
};
Y.extend(CandlestickSeries, Y.RangeSeries, {
/**
* Draws markers for an Candlestick series.
*
* @method
* @param {Array} xcoords The xcoordinates to be plotted.
* @param {Array} opencoords The coordinates representing the open values.
* @param {Array} highcoords The coordinates representing the high values.
* @param {Array} lowcoords The coordinates representing the low values.
* @param {Array} closecoords The coordinates representing the close values.
* @param {Number} len The number of x coordinates to plot.
* @param {Number} width The width of each candlestick marker.
* @param {Number} halfwidth Half the width of each candlestick marker.
* @param {Object} styles The styles for the series.
* @private
*/
_drawMarkers: function(xcoords, opencoords, highcoords, lowcoords, closecoords, len, width, halfwidth, styles)
{
var upcandle = this.get("upcandle"),
downcandle = this.get("downcandle"),
candle,
wick = this.get("wick"),
wickStyles = styles.wick,
wickWidth = wickStyles.width,
cx,
opencoord,
highcoord,
lowcoord,
closecoord,
left,
right,
top,
bottom,
height,
leftPadding = styles.padding.left,
up,
i,
isNumber = Y.Lang.isNumber;
upcandle.set(styles.upcandle);
downcandle.set(styles.downcandle);
wick.set({
fill: wickStyles.fill,
stroke: wickStyles.stroke,
shapeRendering: wickStyles.shapeRendering
});
upcandle.clear();
downcandle.clear();
wick.clear();
for(i = 0; i < len; i = i + 1)
{
cx = Math.round(xcoords[i] + leftPadding);
left = cx - halfwidth;
right = cx + halfwidth;
opencoord = Math.round(opencoords[i]);
highcoord = Math.round(highcoords[i]);
lowcoord = Math.round(lowcoords[i]);
closecoord = Math.round(closecoords[i]);
up = opencoord > closecoord;
top = up ? closecoord : opencoord;
bottom = up ? opencoord : closecoord;
height = bottom - top;
candle = up ? upcandle : downcandle;
if(candle && isNumber(left) && isNumber(top) && isNumber(width) && isNumber(height))
{
candle.drawRect(left, top, width, height);
}
if(isNumber(cx) && isNumber(highcoord) && isNumber(lowcoord))
{
wick.drawRect(cx - wickWidth/2, highcoord, wickWidth, lowcoord - highcoord);
}
}
upcandle.end();
downcandle.end();
wick.end();
wick.toBack();
},
/**
* Toggles visibility
*
* @method _toggleVisible
* @param {Boolean} visible indicates visibilitye
* @private
*/
_toggleVisible: function(visible)
{
this.get("upcandle").set("visible", visible);
this.get("downcandle").set("visible", visible);
this.get("wick").set("visible", visible);
},
/**
* Destructor implementation for the CartesianSeries class. Calls destroy on all Graphic instances.
*
* @method destructor
* @protected
*/
destructor: function()
{
var upcandle = this.get("upcandle"),
downcandle = this.get("downcandle"),
wick = this.get("wick");
if(upcandle)
{
upcandle.destroy();
}
if(downcandle)
{
downcandle.destroy();
}
if(wick)
{
wick.destroy();
}
},
/**
* Gets the default value for the `styles` attribute. Overrides
* base implementation.
*
* @method _getDefaultStyles
* @return Object
* @private
*/
_getDefaultStyles: function()
{
var styles = {
upcandle: {
shapeRendering: "crispEdges",
fill: {
color: "#00aa00",
alpha: 1
},
stroke: {
color: "#000000",
alpha: 1,
weight: 0
}
},
downcandle: {
shapeRendering: "crispEdges",
fill: {
color: "#aa0000",
alpha: 1
},
stroke: {
color: "#000000",
alpha: 1,
weight: 0
}
},
wick: {
shapeRendering: "crispEdges",
width: 1,
fill: {
color: "#000000",
alpha: 1
},
stroke: {
color: "#000000",
alpha: 1,
weight: 0
}
}
};
return this._mergeStyles(styles, CandlestickSeries.superclass._getDefaultStyles());
}
});
Y.CandlestickSeries = CandlestickSeries;
}, '3.18.1', {"requires": ["series-range"]});