// THIS FILE HAS BEEN MINIFIED

if(typeof(RGraph) == 'undefined') RGraph = {};RGraph.Scatter = function (id, data)
{
this.id = id;this.canvas = document.getElementById(id);this.canvas.__object__ = this;this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;this.max = 0;this.coords = [];this.data = [];this.type = 'scatter';this.isRGraph = true;RGraph.OldBrowserCompat(this.context);this.properties = {
'chart.background.barcolor1':   'white',
'chart.background.barcolor2':   'white',
'chart.background.grid':        true,
'chart.background.grid.width':  1,
'chart.background.grid.color':  '#ddd',
'chart.background.grid.hsize':  20,
'chart.background.grid.vsize':  20,
'chart.background.hbars':       null,
'chart.background.grid.vlines': true,
'chart.background.grid.hlines': true,
'chart.background.grid.border': true,
'chart.background.grid.autofit':false,
'chart.background.grid.autofit.numhlines': 7,
'chart.background.grid.autofit.numvlines': 20,
'chart.text.size':              10,
'chart.text.angle':             0,
'chart.text.color':             'black',
'chart.text.font':              'Verdana',
'chart.tooltips.effect':         'fade',
'chart.tooltips.hotspot':        3,
'chart.tooltips.css.class':      'RGraph_tooltip',
'chart.units.pre':              '',
'chart.units.post':             '',
'chart.tickmarks':              'cross',
'chart.ticksize':               2,
'chart.xticks':                 true,
'chart.gutter':                 25,
'chart.xmax':                   0,
'chart.ymax':                   null,
'chart.ymin':                   null,
'chart.scale.decimals':         0,
'chart.title':                  '',
'chart.title.vpos':             null,
'chart.title.xaxis':            '',
'chart.title.yaxis':            '',
'chart.title.xaxis.pos':        0.25,
'chart.title.yaxis.pos':        0.25,
'chart.labels':                 [],
'chart.ylabels':                true,
'chart.ylabels.count':          5,
'chart.contextmenu':            null,
'chart.defaultcolor':           'black',
'chart.xaxispos':               'bottom',
'chart.crosshairs':             false,
'chart.crosshairs.color':       '#333',
'chart.annotatable':            false,
'chart.annotate.color':         'black',
'chart.line':                   false,
'chart.line.linewidth':         1,
'chart.line.colors':            ['green', 'red'],
'chart.line.shadow.color':      'rgba(0,0,0,0)',
'chart.line.shadow.blur':       2,
'chart.line.shadow.offsetx':    3,
'chart.line.shadow.offsety':    3,
'chart.line.stepped':           false,
'chart.noaxes':                 false,
'chart.key':                    [],
'chart.key.background':         'white',
'chart.key.position':           'graph',
'chart.key.shadow':             false,
'chart.axis.color':             'black',
'chart.zoom.factor':            1.5,
'chart.zoom.fade.in':           true,
'chart.zoom.fade.out':          true,
'chart.zoom.hdir':              'right',
'chart.zoom.vdir':              'down',
'chart.zoom.frames':            10,
'chart.zoom.delay':             50,
'chart.zoom.shadow':            true,
'chart.zoom.mode':              'canvas',
'chart.zoom.thumbnail.width':   75,
'chart.zoom.thumbnail.height':  75,
'chart.zoom.background':        true,
'chart.zoom.action':            'zoom',
'chart.boxplot.width':          8,
'chart.resizable':              false
}
if(arguments[1][0] && arguments[1][0][0] && typeof(arguments[1][0][0][0]) == 'number'){
for (var i=0; i<arguments[1].length; ++i){
this.data[i] = arguments[1][i];}
} else {
for (var i=1; i<arguments.length; ++i){
this.data[i - 1] = arguments[i];}
}
if(!this.canvas){
alert('[SCATTER] No canvas support');return;}
if(typeof(RGraph) == 'undefined'){
alert('[SCATTER] Fatal error: The common library does not appear to have been included');}
}
RGraph.Scatter.prototype.Set = function (name, value)
{
if(name == 'chart.line.colors'){
this.properties['chart.colors'] = value;}
if(name == 'chart.tooltip.hotspot'){
name = 'chart.tooltips.hotspot';}
this.properties[name] = value;}
RGraph.Scatter.prototype.Get = function (name)
{
return this.properties[name];}
RGraph.Scatter.prototype.Draw = function ()
{
RGraph.FireCustomEvent(this, 'onbeforedraw');this.Set('chart.tooltips', false);this.hasTooltips = false;var overHotspot = false;this.coords = [];if(!document.all){
for (var i=0; i<this.data.length; ++i){
for (var j =0;j<this.data[i].length; ++j){
if(this.data[i][j] && this.data[i][j][3] && typeof(this.data[i][j][3]) == 'string' && this.data[i][j][3].length){
this.Set('chart.tooltips', [1]);this.hasTooltips = true;}
}
}
}
this.max = 0;if(this.Get('chart.ymax') && this.Get('chart.ymax') > 0){
this.max = this.Get('chart.ymax');this.min = this.Get('chart.ymin') ? this.Get('chart.ymin') : 0;this.scale = RGraph.getScale(this.max);if(this.min){
this.scale[0] = ((this.max - this.min) * (1/5)) + this.min;this.scale[1] = ((this.max - this.min) * (2/5)) + this.min;this.scale[2] = ((this.max - this.min) * (3/5)) + this.min;this.scale[3] = ((this.max - this.min) * (4/5)) + this.min;this.scale[4] = ((this.max - this.min) * (5/5)) + this.min;}
var decimals = this.Get('chart.scale.decimals');this.scale = [
this.scale[0].toFixed(decimals),
this.scale[1].toFixed(decimals),
this.scale[2].toFixed(decimals),
this.scale[3].toFixed(decimals),
this.scale[4].toFixed(decimals)
];} else {
var i = 0;var j = 0;for (i=0; i<this.data.length; ++i){
for (j=0; j<this.data[i].length; ++j){
this.max = Math.max(this.max, Math.abs(this.data[i][j][1]));}
}
this.scale = RGraph.getScale(this.max);this.max = this.scale[4];this.min = this.Get('chart.ymin') ? this.Get('chart.ymin') : 0;if(this.min){
this.scale[0] = ((this.max - this.min) * (1/5)) + this.min;this.scale[1] = ((this.max - this.min) * (2/5)) + this.min;this.scale[2] = ((this.max - this.min) * (3/5)) + this.min;this.scale[3] = ((this.max - this.min) * (4/5)) + this.min;this.scale[4] = ((this.max - this.min) * (5/5)) + this.min;}
var decimals = this.Get('chart.scale.decimals');this.scale = [
this.scale[0].toFixed(decimals),
this.scale[1].toFixed(decimals),
this.scale[2].toFixed(decimals),
this.scale[3].toFixed(decimals),
this.scale[4].toFixed(decimals)
];}
this.grapharea = this.canvas.height - (2 * this.Get('chart.gutter'));RGraph.background.Draw(this);if(this.Get('chart.background.hbars') && this.Get('chart.background.hbars').length){
RGraph.DrawBars(this);}
if(!this.Get('chart.noaxes')){
this.DrawAxes();}
this.DrawLabels();i = 0;for(i=0; i<this.data.length; ++i){
this.DrawMarks(i);this.context.shadowColor = this.Get('chart.line.shadow.color');this.context.shadowOffsetX = this.Get('chart.line.shadow.offsetx');this.context.shadowOffsetY = this.Get('chart.line.shadow.offsety');this.context.shadowBlur = this.Get('chart.line.shadow.blur');this.DrawLine(i);RGraph.NoShadow(this);}
if(this.Get('chart.line')){
for (var i=0;i<this.data.length; ++i){
this.DrawMarks(i);}
}
if(this.Get('chart.contextmenu')){
RGraph.ShowContext(this);}
if(this.hasTooltips){
RGraph.Register(this);var overHotspot = false;this.canvas.onmousemove = function (e)
{
e = RGraph.FixEventObject(e);var canvas = e.target;var obj = canvas.__object__;var context = canvas.getContext('2d');var mouseCoords = RGraph.getMouseXY(e);var overHotspot = false;var offset = obj.Get('chart.tooltips.hotspot');for (var set=0; set<obj.coords.length; ++set){
for (var i=0; i<obj.coords[set].length; ++i){
var xCoord = obj.coords[set][i][0];var yCoord = obj.coords[set][i][1];var tooltip = obj.coords[set][i][2];if(mouseCoords[0] <= (xCoord + offset) &&
mouseCoords[0] >= (xCoord - offset) &&
mouseCoords[1] <= (yCoord + offset) &&
mouseCoords[1] >= (yCoord - offset) &&
tooltip &&
tooltip.length > 0){
overHotspot = true;canvas.style.cursor = document.all ? 'hand' : 'pointer';if(!RGraph.Registry.Get('chart.tooltip') || RGraph.Registry.Get('chart.tooltip').__text__ != tooltip){
RGraph.Redraw();if(typeof(tooltip) == 'function'){
var text = String(tooltip(i));} else {
var text = String(tooltip);}
RGraph.Tooltip(canvas, text, e.pageX, e.pageY, i);context.beginPath();context.fillStyle = 'rgba(255,255,255,0.5)';context.arc(xCoord, yCoord, 3, 0, 6.28, 0);context.fill();}
}
}
}
if(!overHotspot){
canvas.style.cursor = 'default';}
}
} else {
this.canvas.onmousemove = null;}
if(this.Get('chart.key') && this.Get('chart.key').length){
RGraph.DrawKey(this, this.Get('chart.key'), this.Get('chart.line.colors'));}
RGraph.DrawCrosshairs(this);if(this.Get('chart.annotatable')){
RGraph.Annotate(this);}
if(this.Get('chart.zoom.mode') == 'thumbnail' || this.Get('chart.zoom.mode') == 'area'){
RGraph.ShowZoomWindow(this);}
if(this.Get('chart.resizable')){
RGraph.AllowResizing(this);}
RGraph.FireCustomEvent(this, 'ondraw');}
RGraph.Scatter.prototype.DrawAxes = function ()
{
var canvas = this.canvas;var context = this.context;var graphHeight = this.canvas.height - (this.Get('chart.gutter') * 2);var gutter = this.Get('chart.gutter');context.beginPath();context.strokeStyle = this.Get('chart.axis.color');context.lineWidth = 1;context.moveTo(gutter, gutter);context.lineTo(gutter, this.canvas.height - gutter);if(this.Get('chart.xaxispos') == 'center'){
this.context.moveTo(gutter, this.canvas.height / 2);this.context.lineTo(this.canvas.width - gutter, this.canvas.height / 2);} else {
this.context.moveTo(gutter, this.canvas.height - gutter);this.context.lineTo(this.canvas.width - gutter, this.canvas.height - gutter);}
for (y=gutter; y < this.canvas.height - gutter + (this.Get('chart.xaxispos') == 'center' ? 1 : 0) ; y+=(graphHeight / 5) / 2){
if(y == (this.canvas.height / 2) ) continue;this.context.moveTo(gutter, y);this.context.lineTo(gutter - 3, y);}
if(this.Get('chart.xticks')){
var x = 0;var y =  (this.Get('chart.xaxispos') == 'center') ? (this.canvas.height / 2) : (this.canvas.height - gutter);this.xTickGap = (this.canvas.width - (2 * gutter) ) / this.Get('chart.labels').length;for (x = (gutter + (this.xTickGap / 2) ); x<=(this.canvas.width - gutter); x += this.xTickGap / 2){
this.context.moveTo(x, y - (this.Get('chart.xaxispos') == 'center' ? 3 : 0));this.context.lineTo(x, y + 3);}
}
this.context.stroke();}
RGraph.Scatter.prototype.DrawLabels = function ()
{
this.context.fillStyle = this.Get('chart.text.color');var font = this.Get('chart.text.font');var xMax = this.Get('chart.xmax');var yMax = this.scale[4];var gutter = this.Get('chart.gutter');var text_size = this.Get('chart.text.size');var units_pre = this.Get('chart.units.pre');var units_post = this.Get('chart.units.post');var numYLabels = this.Get('chart.ylabels.count');var context = this.context;var canvas = this.canvas;this.halfGraphHeight = (this.canvas.height - (2 * this.Get('chart.gutter'))) / 2;if(this.Get('chart.ylabels')){
if(this.Get('chart.xaxispos') == 'center'){
RGraph.Text(context, font, text_size, gutter - 5, gutter, RGraph.number_format(this.scale[4], units_pre, units_post), 'center', 'right');if(numYLabels >= 5){
RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (1/10) ), RGraph.number_format(this.scale[3], units_pre, units_post), 'center', 'right');RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (3/10) ), RGraph.number_format(this.scale[1], units_pre, units_post), 'center', 'right');}
if(numYLabels >= 3){
RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (2/10) ), RGraph.number_format(this.scale[2], units_pre, units_post), 'center', 'right');RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (4/10) ), RGraph.number_format(this.scale[0], units_pre, units_post), 'center', 'right');}
if(numYLabels >= 3){
RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (1/10) ) + this.halfGraphHeight, '-' + RGraph.number_format(this.scale[0], units_pre, units_post), 'center', 'right');RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (3/10) ) + this.halfGraphHeight, '-' + RGraph.number_format(this.scale[2], units_pre, units_post), 'center', 'right');}
if(numYLabels >= 5){
RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (2/10) ) + this.halfGraphHeight, '-' + RGraph.number_format(this.scale[1], units_pre, units_post), 'center', 'right');RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (4/10) ) + this.halfGraphHeight, '-' + RGraph.number_format(this.scale[3], units_pre, units_post), 'center', 'right');}
RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (5/10) ) + this.halfGraphHeight, '-' + RGraph.number_format(this.scale[4], units_pre, units_post), 'center', 'right');} else {
RGraph.Text(context, font, text_size, gutter - 5, gutter, RGraph.number_format(this.scale[4], units_pre, units_post), 'center', 'right');if(numYLabels >= 5){
RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (1/5) ), RGraph.number_format(this.scale[3], units_pre, units_post), 'center', 'right');RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (3/5) ), RGraph.number_format(this.scale[1], units_pre, units_post), 'center', 'right');}
if(numYLabels >= 3){
RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (2/5) ), RGraph.number_format(this.scale[2], units_pre, units_post), 'center', 'right');RGraph.Text(context, font, text_size, gutter - 5, gutter + ((canvas.height - (2 * gutter)) * (4/5) ), RGraph.number_format(this.scale[0], units_pre, units_post), 'center', 'right');}
if(this.Get('chart.ymin')){
RGraph.Text(context, font, text_size, gutter - 5, canvas.height - gutter, RGraph.number_format(this.Get('chart.ymin'), units_pre, units_post), 'center', 'right');}
}
}
var graphArea = this.canvas.width - (2 * gutter);var xInterval = graphArea / this.Get('chart.labels').length;var xPos = gutter;var yPos = (this.canvas.height - gutter) + 15;var labels = this.Get('chart.labels');var angle = 0;var valign = null;var halign = 'center';if(this.Get('chart.text.angle') == 45 || this.Get('chart.text.angle') == 90){
angle = -1 * this.Get('chart.text.angle');valign = 'center';halign = 'right';yPos -= 10;}
for (i=0; i<labels.length; ++i){
if(typeof(labels[i]) == 'object'){
RGraph.Text(context, font, this.Get('chart.text.size'), gutter + (graphArea * (labels[i][1] / this.Get('chart.xmax'))) + 5, yPos, String(labels[i][0]), valign, 'left', null, angle);this.context.beginPath();this.context.strokeStyle = '#bbb';this.context.moveTo(gutter + (graphArea * (labels[i][1] / this.Get('chart.xmax'))), this.canvas.height - gutter);this.context.lineTo(gutter + (graphArea * (labels[i][1] / this.Get('chart.xmax'))), this.canvas.height - gutter + 20);this.context.stroke();} else {
RGraph.Text(context, font, this.Get('chart.text.size'), xPos + (this.xTickGap / 2), yPos, String(labels[i]), valign, halign, null, angle);}
xPos += xInterval;}
}
RGraph.Scatter.prototype.DrawMarks = function (i)
{
this.coords[i] = [];var xmax = this.Get('chart.xmax');var default_color = this.Get('chart.defaultcolor');for (var j=0; j<this.data[i].length; ++j){
var data_point = this.data[i];var xCoord = data_point[j][0];var yCoord = data_point[j][1];var color = data_point[j][2] ? data_point[j][2] : default_color;var tooltip = (data_point[j] && data_point[j][3]) ? data_point[j][3] : null;this.DrawMark(
xCoord,
yCoord,
xmax,
this.scale[4],
color,
tooltip,
this.coords[i]
);}
}
RGraph.Scatter.prototype.DrawMark = function (x, y, xMax, yMax, color, tooltip, coords)
{
var tickmarks = this.Get('chart.tickmarks');var gutter = this.Get('chart.gutter');var x = (x / xMax) * (this.canvas.width - (2 * gutter));var tickSize = this.Get('chart.ticksize');var halfTickSize = this.Get('chart.ticksize') / 2;var originalX = x;var originalY = y;if(   typeof(y) == 'object'
&& typeof(y[0]) == 'number'
&& typeof(y[1]) == 'number'
&& typeof(y[2]) == 'number'
&& typeof(y[3]) == 'number'
&& typeof(y[4]) == 'number'
){
var yMin = this.Get('chart.ymin') ? this.Get('chart.ymin') : 0;this.Set('chart.boxplot', true);var y0 = (this.canvas.height - (2 * gutter)) - ((y[4] - yMin) / (yMax - yMin)) * (this.canvas.height - (2 * gutter));var y1 = (this.canvas.height - (2 * gutter)) - ((y[3] - yMin) / (yMax - yMin)) * (this.canvas.height - (2 * gutter));var y2 = (this.canvas.height - (2 * gutter)) - ((y[2] - yMin) / (yMax - yMin)) * (this.canvas.height - (2 * gutter));var y3 = (this.canvas.height - (2 * gutter)) - ((y[1] - yMin) / (yMax - yMin)) * (this.canvas.height - (2 * gutter));var y4 = (this.canvas.height - (2 * gutter)) - ((y[0] - yMin) / (yMax - yMin)) * (this.canvas.height - (2 * gutter));var col1 = y[5];var col2 = y[6];if(typeof(y[7]) == 'number'){
var boxWidth = y[7];}
var y = y2;} else {
var yMin = this.Get('chart.ymin') ? this.Get('chart.ymin') : 0;var y = (( (y - yMin) / (yMax - yMin)) * (this.canvas.height - (2 * gutter)));}
if(this.Get('chart.xaxispos') == 'center'){
y /= 2;y += this.halfGraphHeight;}
x += gutter;y = this.canvas.height - gutter - y;this.context.beginPath();this.context.strokeStyle = color;if(   this.Get('chart.boxplot')
&& typeof(y0) == 'number'
&& typeof(y1) == 'number'
&& typeof(y2) == 'number'
&& typeof(y3) == 'number'
&& typeof(y4) == 'number'
){
var boxWidth = boxWidth ? boxWidth : this.Get('chart.boxplot.width');var halfBoxWidth = boxWidth / 2;this.context.beginPath();if(col1){
this.context.fillStyle = col1;this.context.fillRect(x - halfBoxWidth, y1 + gutter, boxWidth, y2 - y1);}
if(col2){
this.context.fillStyle = col2;this.context.fillRect(x - halfBoxWidth, y2 + gutter, boxWidth, y3 - y2);}
this.context.strokeRect(x - halfBoxWidth, y1 + gutter, boxWidth, y3 - y1);this.context.stroke();this.context.beginPath();this.context.moveTo(x - halfBoxWidth, y0 + gutter);this.context.lineTo(x + halfBoxWidth, y0 + gutter);this.context.moveTo(x, y0 + gutter);this.context.lineTo(x, y1 + gutter);this.context.moveTo(x - halfBoxWidth, y4 + gutter);this.context.lineTo(x + halfBoxWidth, y4 + gutter);this.context.moveTo(x, y4 + gutter);this.context.lineTo(x, y3 + gutter);this.context.stroke();}
if(tickmarks == 'circle'){
this.context.arc(x, y, halfTickSize, 0, 6.28, 0);this.context.fillStyle = color;this.context.fill();} else if(tickmarks == 'plus'){
this.context.moveTo(x, y - halfTickSize);this.context.lineTo(x, y + halfTickSize);this.context.moveTo(x - halfTickSize, y);this.context.lineTo(x + halfTickSize, y);this.context.stroke();} else if(tickmarks == 'square'){
this.context.strokeStyle = color;this.context.fillStyle = color;this.context.fillRect(
x - halfTickSize,
y - halfTickSize,
this.Get('chart.ticksize'),
this.Get('chart.ticksize')
);} else if(tickmarks == 'cross'){
var ticksize = this.Get('chart.ticksize');this.context.moveTo(x - ticksize, y - ticksize);this.context.lineTo(x + ticksize, y + ticksize);this.context.moveTo(x + ticksize, y - ticksize);this.context.lineTo(x - ticksize, y + ticksize);this.context.stroke();} else if(tickmarks == 'diamond'){
this.context.fillStyle = this.context.strokeStyle;var ticksize = this.Get('chart.ticksize');var halfTicksize = ticksize / 2;this.context.moveTo(x, y - halfTicksize);this.context.lineTo(x + halfTicksize, y);this.context.lineTo(x, y + halfTicksize);this.context.lineTo(x - halfTicksize, y);this.context.lineTo(x, y - halfTicksize);this.context.fill();this.context.stroke();} else if(tickmarks == null){
} else {
alert('[SCATTER] (' + this.id + ') Unknown tickmark style: ' + tickmarks );}
coords.push([x, y, tooltip]);}
RGraph.Scatter.prototype.DrawLine = function (i)
{
if(this.Get('chart.line') && this.coords[i].length >= 2){
this.context.lineCap = 'round';this.context.lineJoin = 'round';this.context.lineWidth = this.GetLineWidth(i);this.context.strokeStyle = this.Get('chart.line.colors')[i];this.context.beginPath();var len = this.coords[i].length;for (var j=0; j<this.coords[i].length; ++j){
var xPos = this.coords[i][j][0];var yPos = this.coords[i][j][1];if(j == 0){
this.context.moveTo(xPos, yPos);} else {
var stepped = this.Get('chart.line.stepped');if(   (typeof(stepped) == 'boolean' && stepped)
|| (typeof(stepped) == 'object' && stepped[i])
){
this.context.lineTo(this.coords[i][j][0], this.coords[i][j - 1][1]);}
this.context.lineTo(xPos, yPos);}
}
this.context.stroke();}
this.context.lineWidth = 1;}
RGraph.Scatter.prototype.GetLineWidth = function (i)
{
var linewidth = this.Get('chart.line.linewidth');if(typeof(linewidth) == 'number'){
return linewidth;} else if(typeof(linewidth) == 'object'){
if(linewidth[i]){
return linewidth[i];} else {
return linewidth[0];}
alert('[SCATTER] Error! chart.linewidth should be a single number or an array of one or more numbers');}
}