// o---------------------------------------------------------------------------o // | This file is part of the RGraph package - you can learn more at: | // | | // | https://www.rgraph.net | // | | // | RGraph is dual-licensed under the Open Source GPL license. This means | // | that it's free to use for any purpose. The GPL license does have | // | consequences on the license of the software that you include it in, | // | however. If this is not desirable, then there's an inexpensive commercial | // | license option available. See the RGraph website for more details. | // o---------------------------------------------------------------------------o RGraph = window.RGraph || {isrgraph:true,isRGraph: true,rgraph:true}; // // The bipolar/age frequency constructor. // RGraph.Bipolar = function (conf) { var id = conf.id, canvas = document.getElementById(id), left = conf.left, right = conf.right; // Get the canvas and context objects this.id = id; this.canvas = canvas; this.context = this.canvas.getContext('2d'); this.canvas.__object__ = this; this.type = 'bipolar'; this.coords = []; this.coords2 = []; this.coordsLeft = []; this.coordsRight = []; this.coords2Left = []; this.coords2Right = []; this.max = 0; this.isRGraph = true; this.isrgraph = true; this.rgraph = true; this.uid = RGraph.createUID(); this.canvas.uid = this.canvas.uid ? this.canvas.uid : RGraph.createUID(); this.coordsText = []; this.original_colors = []; this.colorsParsed = false; this.firstDraw = true; // After the first draw this will be false this.stopAnimationRequested_left = false;// Used to control the animations this.stopAnimationRequested_right = false;// Used to control the animations // The left and right data respectively. Ensure that the data is an array // of numbers var data = [left, right]; // Convert strings to arrays data[0] = RGraph.stringsToNumbers(data[0]); data[1] = RGraph.stringsToNumbers(data[1]); this.left = data[0]; this.right = data[1]; this.data = [data[0], data[1]]; this.data2 = []; // Add all of the data to the data2 variable for (var i=0;i this.right.length) this.right.push(null); // // Set the default for the number of Y tickmarks // this.properties.yaxisTickmarksCount = this.left.length; // // Create the dollar objects so that functions can be // added to them // var linear_data = RGraph.arrayLinearize(this.left, this.right); for (var i=0; i { // Note that we're in an arrow function so the // 'this' variable is OK to be used and refers // to the RGraph Line chart object. RGraph.scale(this); }); // // Fire the onbeforedraw event // RGraph.fireCustomEvent(this, 'onbeforedraw'); // // Add any CSS that has been specified to the document. // This is general CSS and does not necessarily have to // pertain to the canvas tag. It only gets added once // to the document no matter how many times this draw // function is called. // // Add the CSS to a