Plots.js revision a39336c1c8adf211920a5588b50c4ab6614b7c88
/**
* Utility class used for drawing markers.
*
* @class Plots
* @constructor
*/
{
var attrs = {
markers: {
getter: function()
{
return this._markers;
}
}
};
}
/**
* @private
*/
_plotDefaults: null,
/**
* Draws the markers
*
* @method drawPlots
* @protected
*/
drawPlots: function()
{
{
return;
}
i = 0,
left,
offsetWidth = w/2,
offsetHeight = h/2,
fillColors = null,
borderColors = null,
{
}
{
}
this._createMarkerCache();
if(isChrome)
{
this._createHotspotCache();
}
for(; i < len; ++i)
{
if(!top || !left || top === undefined || left === undefined || top == "undefined" || left == "undefined" || isNaN(top) || isNaN(left))
{
this._graphicNodes.push(null);
continue;
}
if(fillColors)
{
}
if(borderColors)
{
}
if(isChrome)
{
}
}
this._clearMarkerCache();
if(isChrome)
{
this._clearHotspotCache();
}
},
/**
* Gets the default values for series that use the utility. This method is used by
* the class' <code>styles</code> attribute's getter to get build default values.
*
* @method _getPlotDefaults
* @return Object
* @protected
*/
_getPlotDefaults: function()
{
var defs = {
fill:{
type: "solid",
alpha: 1,
colors:null,
alphas: null,
ratios: null
},
border:{
weight: 1,
alpha: 1
},
width: 10,
height: 10,
shape: "circle"
};
return defs;
},
/**
* Collection of markers to be used in the series.
*
* @private
*/
_markers: null,
/**
* Collection of markers to be re-used on a series redraw.
*
* @private
*/
_markerCache: null,
/**
* Gets and styles a marker. If there is a marker in cache, it will use it. Otherwise
* it will create one.
*
* @method getMarker
* @param {Object} styles Hash of style properties.
* @param {Number} order Order of the series.
* @param {Number} index Index within the series associated with the marker.
* @return Shape
* @protected
*/
{
var marker;
{
while(!marker)
{
{
break;
}
}
}
else
{
}
return marker;
},
/**
* Creates a shape to be used as a marker.
*
* @method _createMarker
* @param {Object} styles Hash of style properties.
* @param {Number} order Order of the series.
* @param {Number} index Index within the series associated with the marker.
* @return Shape
* @private
*/
{
return marker;
},
/**
* Creates a cache of markers for reuse.
*
* @method _createMarkerCache
* @private
*/
_createMarkerCache: function()
{
{
}
else
{
this._markerCache = [];
}
this._markers = [];
this._graphicNodes = [];
},
/**
* Removes unused markers from the marker cache
*
* @method _clearMarkerCache
* @private
*/
_clearMarkerCache: function()
{
i = 0,
for(; i < len; ++i)
{
marker = this._markerCache[i];
if(marker)
{
}
}
this._markerCache = [];
},
/**
* Resizes and positions markers based on a mouse interaction.
*
* @method updateMarkerState
* @param {String} type state of the marker
* @param {Number} i index of the marker
* @protected
*/
updateMarkerState: function(type, i)
{
if(this._markers[i])
{
var w,
h,
w = markerStyles.width;
h = markerStyles.height;
}
},
/**
* Parses a color from an array.
*
* @method _getItemColor
* @param {Array} val collection of colors
* @param {Number} i index of the item
* @return String
* @protected
*/
_getItemColor: function(val, i)
{
{
}
return val;
},
/**
* Method used by <code>styles</code> setter. Overrides base implementation.
*
* @method _setStyles
* @param {Object} newStyles Hash of properties to update.
* @return Object
* @protected
*/
_setStyles: function(val)
{
},
/**
* Combines new styles with existing styles.
*
* @method _parseMarkerStyles
* @private
*/
_parseMarkerStyles: function(val)
{
{
var defs = this._getPlotDefaults();
{
}
{
}
}
return val;
},
/**
* Returns marker state based on event type
*
* @method _getState
* @param {String} type event type
* @return String
* @protected
*/
{
var state;
switch(type)
{
case "mouseout" :
state = "off";
break;
case "mouseover" :
state = "over";
break;
case "mouseup" :
state = "over";
break;
case "mousedown" :
state = "down";
break;
}
return state;
},
/**
* @private
*/
_stateSyles: null,
/**
* Collection of hotspots to be used in the series.
*
* @private
*/
_hotspots: null,
/**
* Collection of hotspots to be re-used on a series redraw.
*
* @private
*/
_hotspotCache: null,
/**
* Gets and styles a hotspot. If there is a hotspot in cache, it will use it. Otherwise
* it will create one.
*
* @method getHotspot
* @param {Object} styles Hash of style properties.
* @param {Number} order Order of the series.
* @param {Number} index Index within the series associated with the hotspot.
* @return Shape
* @protected
*/
{
var hotspot,
type: "solid",
color: "#000",
alpha: 0
};
weight: 0
};
{
while(!hotspot)
{
{
break;
}
}
}
else
{
}
return hotspot;
},
/**
* Creates a shape to be used as a hotspot.
*
* @method _createHotspot
* @param {Object} styles Hash of style properties.
* @param {Number} order Order of the series.
* @param {Number} index Index within the series associated with the hotspot.
* @return Shape
* @private
*/
{
return hotspot;
},
/**
* Creates a cache of hotspots for reuse.
*
* @method _createHotspotCache
* @private
*/
_createHotspotCache: function()
{
{
}
else
{
this._hotspotCache = [];
}
this._hotspots = [];
},
/**
* Removes unused hotspots from the hotspot cache
*
* @method _clearHotspotCache
* @private
*/
_clearHotspotCache: function()
{
i = 0,
for(; i < len; ++i)
{
hotspot = this._hotspotCache[i];
if(hotspot)
{
}
}
this._hotspotCache = [];
}
};