// THIS FILE HAS BEEN MINIFIED

if(typeof(RGraph) == 'undefined') RGraph = {};RGraph.Bipolar = function (id, left, right)
{
this.id = id;this.canvas = document.getElementById(id);this.context = this.canvas.getContext('2d');this.canvas.__object__ = this;this.type = 'bipolar';this.coords = [];this.max = 0;this.isRGraph = true;RGraph.OldBrowserCompat(this.context);this.left = left;this.right = right;this.data = [left, right];this.properties = {
'chart.margin':                 2,
'chart.xtickinterval':          null,
'chart.labels':                 [],
'chart.text.size':              10,
'chart.text.color':             'black',
'chart.text.font':              'Verdana',
'chart.title.left':             '',
'chart.title.right':            '',
'chart.gutter':                 25,
'chart.title':                  '',
'chart.title.vpos':             null,
'chart.colors':                 ['#fcf', '#00f', '#f00', '#0f0', '#ff0', '#0ff', '#f0f', '#ff6101', '#b401ff', '#e4ff01', '#fb8195', '#ccc'],
'chart.contextmenu':            null,
'chart.tooltips':               null,
'chart.tooltips.effect':         'fade',
'chart.tooltips.css.class':      'RGraph_tooltip',
'chart.units.pre':              '',
'chart.units.post':             '',
'chart.shadow':                 false,
'chart.shadow.color':           '#666',
'chart.shadow.offsetx':         3,
'chart.shadow.offsety':         3,
'chart.shadow.blur':            3,
'chart.annotatable':            false,
'chart.annotate.color':         'black',
'chart.xmax':                   null,
'chart.scale.decimals':         null,
'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.resizable':              false
}
while (this.left.length < this.right.length) this.left.push(0);while (this.left.length > this.right.length) this.right.push(0);if(typeof(RGraph) == 'undefined'){
alert('[BIPOLAR] Fatal error: The common library does not appear to have been included');}
}
RGraph.Bipolar.prototype.Set = function (name, value)
{
this.properties[name.toLowerCase()] = value;}
RGraph.Bipolar.prototype.Get = function (name)
{
return this.properties[name.toLowerCase()];}
RGraph.Bipolar.prototype.DrawAxes = function ()
{
this.context.beginPath();this.context.strokeStyle = this.Get('chart.axis.color');this.axisWidth = (this.canvas.width - 60 ) / 2;this.axisHeight = this.canvas.height - (2 * this.Get('chart.gutter'));this.context.moveTo(this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter'));this.context.lineTo(this.axisWidth, this.canvas.height - this.Get('chart.gutter'));this.context.lineTo(this.axisWidth, this.Get('chart.gutter'));this.context.stroke();this.context.beginPath();this.axisWidth = ((this.canvas.width - 60) / 2) + 60;this.context.moveTo(this.axisWidth, this.Get('chart.gutter'));this.context.lineTo(this.axisWidth, this.canvas.height - this.Get('chart.gutter'));this.context.lineTo(this.canvas.width - this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter'));this.context.stroke();}
RGraph.Bipolar.prototype.DrawTicks = function ()
{
var numDataPoints = this.left.length;var barHeight = ( (this.canvas.height - (2 * this.Get('chart.gutter')))- (this.left.length * (this.Get('chart.margin') * 2) )) / numDataPoints;for (var i = this.canvas.height - this.Get('chart.gutter'); i >= this.Get('chart.gutter'); i -= (barHeight + ( this.Get('chart.margin') * 2)) ){
if(i < (this.canvas.height - this.Get('chart.gutter')) ){
this.context.beginPath();this.context.moveTo(this.axisWidth - 60, i);this.context.lineTo(this.axisWidth - 60 + 3, i);this.context.stroke();}
}
for (var i = this.canvas.height - this.Get('chart.gutter'); i >= this.Get('chart.gutter'); i -= (barHeight + ( this.Get('chart.margin') * 2)) ){
if(i < (this.canvas.height - this.Get('chart.gutter')) ){
this.context.beginPath();this.context.moveTo(this.axisWidth, i);this.context.lineTo(this.axisWidth - 3, i);this.context.stroke();}
}
var xInterval = (this.canvas.width - (2 * this.Get('chart.gutter')) - 60) / 10;if(typeof(this.Get('chart.xtickinterval')) == 'number'){
xInterval = this.Get('chart.xtickinterval');}
for (i=this.Get('chart.gutter'); i<(this.canvas.width - 60 ) / 2; i += xInterval){
this.context.beginPath();this.context.moveTo(i, this.canvas.height - this.Get('chart.gutter'));this.context.lineTo(i, (this.canvas.height - this.Get('chart.gutter')) + 4);this.context.closePath();this.context.stroke();}
var stoppingPoint = (this.canvas.width - (2 * this.Get('chart.gutter')) - 60) / 2;var stoppingPoint = stoppingPoint + 60 + this.Get('chart.gutter')
for (i=this.canvas.width  - this.Get('chart.gutter'); i > stoppingPoint; i-=xInterval){
this.context.beginPath();this.context.moveTo(i, this.canvas.height - this.Get('chart.gutter'));this.context.lineTo(i, (this.canvas.height - this.Get('chart.gutter')) + 4);this.context.closePath();this.context.stroke();}
this.barHeight = barHeight;}
RGraph.Bipolar.prototype.GetMax = function()
{
var max = 0;var dec = this.Get('chart.scale.decimals');if(this.Get('chart.xmax')){
max = this.Get('chart.xmax');this.scale = [];this.scale[0] = Number((max / 5) * 1).toFixed(dec);this.scale[1] = Number((max / 5) * 2).toFixed(dec);this.scale[2] = Number((max / 5) * 3).toFixed(dec);this.scale[3] = Number((max / 5) * 4).toFixed(dec);this.scale[4] = Number(max).toFixed(dec);this.max = max;} else {
this.leftmax = RGraph.array_max(this.left);this.rightmax = RGraph.array_max(this.right);max = Math.max(this.leftmax, this.rightmax);this.scale = RGraph.getScale(max);this.scale[0] = Number(this.scale[0]).toFixed(dec);this.scale[1] = Number(this.scale[1]).toFixed(dec);this.scale[2] = Number(this.scale[2]).toFixed(dec);this.scale[3] = Number(this.scale[3]).toFixed(dec);this.scale[4] = Number(this.scale[4]).toFixed(dec);this.max = this.scale[4];}
}
RGraph.Bipolar.prototype.DrawLeftBars = function ()
{
this.context.strokeStyle = '#333';for (i=0; i<this.left.length; ++i){
if(this.Get('chart.shadow')){
this.context.shadowColor = this.Get('chart.shadow.color');this.context.shadowBlur = this.Get('chart.shadow.blur');this.context.shadowOffsetX = this.Get('chart.shadow.offsetx');this.context.shadowOffsetY = this.Get('chart.shadow.offsety');}
this.context.beginPath();if(this.Get('chart.colors')[i]){
this.context.fillStyle = this.Get('chart.colors')[i];}
var width = ( (this.left[i] / this.max) * ((this.canvas.width - 60 - (2 * this.Get('chart.gutter')) ) / 2) );var coords = [
this.axisWidth - 60 - width,
this.Get('chart.margin') + (i * ( (this.canvas.height - (2 * this.Get('chart.gutter')) ) / this.left.length)) + this.Get('chart.gutter'),
width,
this.barHeight
];if(document.all && this.Get('chart.shadow')){
this.DrawIEShadow(coords);}
this.context.strokeRect(coords[0], coords[1], coords[2], coords[3]);this.context.fillRect(coords[0], coords[1], coords[2], coords[3]);this.context.stroke();this.context.fill();this.coords.push([
coords[0],
coords[1],
coords[2],
coords[3]
]);}
RGraph.NoShadow(this);}
RGraph.Bipolar.prototype.DrawRightBars = function ()
{
this.context.strokeStyle = '#333';if(this.Get('chart.shadow')){
this.context.shadowColor = this.Get('chart.shadow.color');this.context.shadowBlur = this.Get('chart.shadow.blur');this.context.shadowOffsetX = this.Get('chart.shadow.offsetx');this.context.shadowOffsetY = this.Get('chart.shadow.offsety');}
for (i=0; i<this.right.length; ++i){
this.context.beginPath();if(this.Get('chart.colors')[i]){
this.context.fillStyle = this.Get('chart.colors')[i];}
var width = ( (this.right[i] / this.max) * ((this.canvas.width - 60 - (2 * this.Get('chart.gutter')) ) / 2) );var coords = [
this.axisWidth,
this.Get('chart.margin') + (i * ((this.canvas.height - (2 * this.Get('chart.gutter'))) / this.right.length)) + this.Get('chart.gutter'),
width,
this.barHeight
];if(document.all && this.Get('chart.shadow')){
this.DrawIEShadow(coords);}
this.context.strokeRect(coords[0], coords[1], coords[2], coords[3]);this.context.fillRect(coords[0], coords[1], coords[2], coords[3]);this.context.closePath();this.coords.push([
coords[0],
coords[1],
coords[2],
coords[3]
]);}
this.context.stroke();RGraph.NoShadow(this);}
RGraph.Bipolar.prototype.DrawLabels = function ()
{
this.context.fillStyle = this.Get('chart.text.color');var labelPoints = new Array();var font = this.Get('chart.text.font');var size = this.Get('chart.text.size');var max = Math.max(this.left.length, this.right.length);for (i=0; i<max; ++i){
var barAreaHeight = this.canvas.height - (2 * this.Get('chart.gutter'));var barHeight = barAreaHeight / this.left.length;var yPos = (i * barAreaHeight) + this.Get('chart.gutter');labelPoints.push(this.Get('chart.gutter') + (i * barHeight) + (barHeight / 2) + 5);}
for (i=0; i<labelPoints.length; ++i){
RGraph.Text(this.context, this.Get('chart.text.font'),
this.Get('chart.text.size'),
this.canvas.width / 2,
labelPoints[i],
String(this.Get('chart.labels')[i] ? this.Get('chart.labels')[i] : ''), null, 'center');}
RGraph.Text(this.context, font, size, this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this.scale[4], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');RGraph.Text(this.context, font, size, this.Get('chart.gutter') + ((this.canvas.width - 60 - (2 * this.Get('chart.gutter'))) / 2) * (1/5), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this.scale[3], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');RGraph.Text(this.context, font, size, this.Get('chart.gutter') + ((this.canvas.width - 60 - (2 * this.Get('chart.gutter'))) / 2) * (2/5), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this.scale[2], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');RGraph.Text(this.context, font, size, this.Get('chart.gutter') + ((this.canvas.width - 60 - (2 * this.Get('chart.gutter'))) / 2) * (3/5), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this.scale[1], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');RGraph.Text(this.context, font, size, this.Get('chart.gutter') + ((this.canvas.width - 60 - (2 * this.Get('chart.gutter'))) / 2) * (4/5), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this.scale[0], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');RGraph.Text(this.context, font, size, this.canvas.width - this.Get('chart.gutter'), this.canvas.height - this.Get('chart.gutter') + 14, RGraph.number_format(this.scale[4], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');RGraph.Text(this.context, font, size, this.canvas.width - (this.Get('chart.gutter') + ((this.canvas.width - 60 - (2 * this.Get('chart.gutter'))) / 2) * (1/5)), this.canvas.height - this.Get('chart.gutter') + 14,RGraph.number_format(this.scale[3], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');RGraph.Text(this.context, font, size, this.canvas.width - (this.Get('chart.gutter') + ((this.canvas.width - 60 - (2 * this.Get('chart.gutter'))) / 2) * (2/5)), this.canvas.height - this.Get('chart.gutter') + 14,RGraph.number_format(this.scale[2], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');RGraph.Text(this.context, font, size, this.canvas.width - (this.Get('chart.gutter') + ((this.canvas.width - 60 - (2 * this.Get('chart.gutter'))) / 2) * (3/5)), this.canvas.height - this.Get('chart.gutter') + 14,RGraph.number_format(this.scale[1], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');RGraph.Text(this.context, font, size, this.canvas.width - (this.Get('chart.gutter') + ((this.canvas.width - 60 - (2 * this.Get('chart.gutter'))) / 2) * (4/5)), this.canvas.height - this.Get('chart.gutter') + 14,RGraph.number_format(this.scale[0], this.Get('chart.units.pre'), this.Get('chart.units.post')), null, 'center');}
RGraph.Bipolar.prototype.DrawTitles = function ()
{
RGraph.Text(this.context, this.Get('chart.text.font'), this.Get('chart.text.size'), 30, (this.Get('chart.gutter') / 2) + 5, String(this.Get('chart.title.left')), 'center');RGraph.Text(this.context,this.Get('chart.text.font'), this.Get('chart.text.size'), this.canvas.width - 30, (this.Get('chart.gutter') / 2) + 5, String(this.Get('chart.title.right')), 'center', 'right');RGraph.DrawTitle(this.canvas, this.Get('chart.title'), this.Get('chart.gutter'));}
RGraph.Bipolar.prototype.Draw = function ()
{
RGraph.FireCustomEvent(this, 'onbeforedraw');RGraph.ClearEventListeners(this.id);this.left = this.data[0];this.right = this.data[1];this.coords = [];this.GetMax();this.DrawAxes();this.DrawTicks();this.DrawLeftBars();this.DrawRightBars();if(this.Get('chart.axis.color') != 'black'){
this.DrawAxes();}
this.DrawLabels();this.DrawTitles();if(this.Get('chart.contextmenu')){
RGraph.ShowContext(this);}
if(this.Get('chart.tooltips')){
RGraph.Register(this);var eventHandler_window_click = function ()
{
RGraph.Redraw();}
window.addEventListener('click', eventHandler_window_click, false);RGraph.AddEventListener('window_' + this.id, 'click', eventHandler_window_click);var eventHandler_canvas_mousemove = function (e)
{
e = RGraph.FixEventObject(e);var canvas = document.getElementById(this.id);var obj = canvas.__object__;var mouseCoords = RGraph.getMouseXY(e);for (var i=0; i<obj.coords.length; i++){
var mouseX = mouseCoords[0];var mouseY = mouseCoords[1];var left = obj.coords[i][0];var top = obj.coords[i][1];var width = obj.coords[i][2];var height = obj.coords[i][3];if(mouseX >= left && mouseX <= (left + width ) && mouseY >= top && mouseY <= (top + height) ){
canvas.style.cursor = document.all ? 'hand' : 'pointer';return;}
}
canvas.style.cursor = 'default';}
this.canvas.addEventListener('mousemove', eventHandler_canvas_mousemove, false);RGraph.AddEventListener(this.id, 'mouseover', eventHandler_canvas_mousemove);var eventHandler_canvas_click = function (e)
{
e = RGraph.FixEventObject(e);var canvas = document.getElementById(this.id)
var obj = canvas.__object__;RGraph.Clear(canvas);obj.Draw();var mouseCoords = RGraph.getMouseXY(e);for (var i=0; i<obj.coords.length; i++){
var mouseX = mouseCoords[0];var mouseY = mouseCoords[1];var left = obj.coords[i][0];var top = obj.coords[i][1];var width = obj.coords[i][2];var height = obj.coords[i][3];if(mouseX >= left && mouseX <= (left + width) && mouseY >= top && mouseY <= (top + height) ){
if(obj.Get('chart.tooltips')){
if(typeof(obj.Get('chart.tooltips')) == 'function'){
var text = obj.Get('chart.tooltips')(i);} else if(typeof(obj.Get('chart.tooltips')) == 'object' && typeof(obj.Get('chart.tooltips')[i]) == 'function'){
var text = obj.Get('chart.tooltips')[i](i);} else if(typeof(obj.Get('chart.tooltips')) == 'object'){
var text = obj.Get('chart.tooltips')[i];} else {
var text = '';}
obj.context.beginPath();obj.context.strokeStyle = 'black';obj.context.fillStyle = 'rgba(255,255,255,0.5)';obj.context.strokeRect(left, top, width, height);obj.context.fillRect(left, top, width, height);obj.context.stroke();obj.context.fill();RGraph.Tooltip(canvas, text, e.pageX, e.pageY, i);}
}
}
e.stopPropagation();e.cancelBubble = true;}
this.canvas.addEventListener('click', eventHandler_canvas_click, false);RGraph.AddEventListener(this.id, 'click', eventHandler_canvas_click);if(RGraph.Registry.Get('chart.tooltip')){
RGraph.Registry.Get('chart.tooltip').style.display = 'none';RGraph.Registry.Set('chart.tooltip', null)
}
}
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.Bipolar.prototype.DrawIEShadow = function (coords)
{
var prevFillStyle = this.context.fillStyle;var offsetx = this.Get('chart.shadow.offsetx');var offsety = this.Get('chart.shadow.offsety');this.context.lineWidth = this.Get('chart.linewidth');this.context.fillStyle = this.Get('chart.shadow.color');this.context.beginPath();this.context.fillRect(coords[0] + offsetx, coords[1] + offsety, coords[2],coords[3]);this.context.fill();this.context.fillStyle = prevFillStyle;}