_binary From fcf4205088cd5d24b27a7837639f08dd7346d5c9 Mon Sep 17 00:00:00 2001
From: Pragya Rana <pragya.rana9@gmail.com>
Date: Sat, 15 Oct 2016 15:05:36 -0700
Subject: [PATCH] =?UTF-8?q?Initial=20commit=20for=20adding=20statistics=20?=
 =?UTF-8?q?page=20for=20each=20group=E2=80=99s=20items.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* Added a link to number of views in Manage Group>Statistics page that
 links to a new page for viewing statistics of each group item
* Added a javascript charting library to display the statistics: RGraph

Signed-off-by: Pragya Rana <pragya.rana9@gmail.com>
---
 src/controllers/components/SocialComponent.php |  96 +++++-
 src/locale/en_US/configure.ini                 |  12 +
 src/models/ImpressionModel.php                 |  76 ++++-
 src/scripts/rgraph.common.core.js              | 406 +++++++++++++++++++++++++
 src/scripts/rgraph.common.dynamic.js           |  87 ++++++
 src/scripts/rgraph.common.tooltips.js          |  33 ++
 src/scripts/rgraph.line.js                     | 245 +++++++++++++++
 src/views/elements/ManagegroupsElement.php     | 127 +++++++-
 8 files changed, 1054 insertions(+), 28 deletions(-)
 create mode 100644 src/scripts/rgraph.common.core.js
 create mode 100644 src/scripts/rgraph.common.dynamic.js
 create mode 100644 src/scripts/rgraph.common.tooltips.js
 create mode 100644 src/scripts/rgraph.line.js

diff --git a/src/controllers/components/SocialComponent.php b/src/controllers/components/SocialComponent.php
index f8b0ed0..fb10c68 100644
--- a/src/controllers/components/SocialComponent.php
+++ b/src/controllers/components/SocialComponent.php
@@ -82,9 +82,9 @@ class SocialComponent extends Component implements CrawlConstants
         $possible_arguments = ["activateuser",
             "addgroup", "banuser", "changeowner", "import",
             "creategroup", "deletegroup", "deleteuser", "editgroup",
-            "inviteusers", "joingroup", "memberaccess", "postlifetime",
-            "registertype", "reinstateuser", "search", "statistics",
-            "unsubscribe", "voteaccess"];
+            "inviteusers", "joingroup", "lastactivity", "memberaccess",
+            "postlifetime", "registertype", "reinstateuser", "search",
+            "statistics", "unsubscribe", "voteaccess"];
         $data["ELEMENT"] = "managegroups";
         $data['SCRIPT'] = "";
         $data['FORM_TYPE'] = "addgroup";
@@ -321,7 +321,7 @@ class SocialComponent extends Component implements CrawlConstants
                         $group_fields = [
                             "member_access" => ["ACCESS_CODES", C\GROUP_READ],
                             "register" => ["REGISTER_CODES", C\REQUEST_JOIN],
-                            "vote_access" => ["VOTING_CODES", 
+                            "vote_access" => ["VOTING_CODES",
                                 C\NON_VOTING_GROUP],
                             "post_lifetime" => ["VOTING_CODES", C\FOREVER]
                         ];
@@ -476,6 +476,76 @@ class SocialComponent extends Component implements CrawlConstants
                             'num_show']);
                     }
                     break;
+                case "lastactivity":
+                    if (!$group_id || (!$is_owner &&
+                        $_SESSION['USER_ID'] != C\ROOT_ID)) { break;}
+                    $data['FORM_TYPE'] = "lastactivity";
+                    $data['INCLUDE_SCRIPTS'][] = "rgraph.common.core";
+                    $data['INCLUDE_SCRIPTS'][] = "rgraph.common.dynamic";
+                    $data['INCLUDE_SCRIPTS'][] = "rgraph.common.tooltips";
+                    $data['INCLUDE_SCRIPTS'][] = "rgraph.line";
+                    $impression_model = $parent->model("impression");
+                    $period = $_REQUEST['time'];
+                    $data["STATISTICS"][$period] =
+                    $impression_model->getLastActivity($_REQUEST['impression'],
+                        $period, $_REQUEST['item']);
+                    $dt_format = "m-d-Y H:i";
+                    $chart_x = [];
+                    $chart_y = [];
+                    foreach ($data['STATISTICS'][$period] as
+                        $key => $statistics_value) {
+                            $timestamp = $statistics_value['UPDATE_TIMESTAMP'];
+                            $dt = date_create("@$timestamp");
+                            $dt = date_format($dt, $dt_format);
+                            $chart_x[] = "new Date(\"". $dt . "\")";
+                            $chart_y[] = $statistics_value['VIEWS'];
+                    }
+                    $chart_x_string = "[" . join(", ", $chart_x) . "]";
+                    $chart_y_string = "[" . join(", ", $chart_y) . "]";
+                    $data['SCRIPT'] .=
+                        'label    = '. $chart_x_string .';'.
+                        'data     = '. $chart_y_string .';'.
+                        'tooltips = [];'.
+                        'color    = \'#7ED9CA\';'.
+                        'data.forEach(function (v, k, arr)'.
+                        '{'.
+                            'tooltips[k] = \'{1}<b> Views:</b> {2}\'.format('.
+                            'label[k],'.
+                            'data[k]'.
+                            ');'.
+                        '});'.
+                        'new RGraph.Line({'.
+                            'id: \'cvs\','.
+                            'data: data,'.
+                            'options: {'.
+                                'textSize: 10,'.
+                                'colors: [color],'.
+                                'noaxes: true,'.
+                                'gutterLeft: 50,'.
+                                'backgroundGridVlines: false,'.
+                                'backgroundGridBorder: false,'.
+                                'tickmarks: null,'.
+                                'shadow: false,'.
+                                'tooltips: function (index)'.
+                                '{'.
+                                    'return tooltips[index];'.
+                                '},'.
+                                'highlightStyle: \'halo\''.
+                            '}'.
+                        '}).draw().on(\'tooltip\', function (obj)'.
+                        '{'.
+                            'var tooltip = RGraph.Registry.get('.
+                                '\'chart.tooltip\');'.
+                            'tooltip.style.borderColor = obj.get('.
+                            '\'colors\')[0];'.
+                        '});'.
+                        'RGraph.tooltips.style.padding         = \'10px\';'.
+                        'RGraph.tooltips.style.paddingBottom   = \'5px\';'.
+                        'RGraph.tooltips.style.backgroundColor = \'white\';'.
+                        'RGraph.tooltips.style.textAlign       = \'left\';'.
+                        'RGraph.tooltips.style.border          = \'solid\';';
+                    $this->getGroupUsersData($data, $group_id);
+                    break;
                 case "memberaccess":
                     $update_fields = [
                         ['memberaccess', 'MEMBER_ACCESS', 'ACCESS_CODES']];
@@ -1045,7 +1115,7 @@ class SocialComponent extends Component implements CrawlConstants
             in_array($_REQUEST['arg'], $possible_arguments)) {
             switch ($_REQUEST['arg']) {
                 case "addcomment":
-                    if (!isset($_REQUEST['parent_id']) 
+                    if (!isset($_REQUEST['parent_id'])
                         || !$_REQUEST['parent_id']
                         || !isset($_REQUEST['group_id'])
                         || !$_REQUEST['group_id']) {
@@ -1127,7 +1197,7 @@ class SocialComponent extends Component implements CrawlConstants
                 case "addgroup":
                     $register =
                         $group_model->getRegisterType($just_group_id);
-                    if ($just_group_id > 0 && $register 
+                    if ($just_group_id > 0 && $register
                         && $register != C\NO_JOIN) {
                         $this->addGroup($data, $just_group_id, $register);
                         unset($data['SUBSCRIBE_LINK']);
@@ -1566,7 +1636,7 @@ class SocialComponent extends Component implements CrawlConstants
             true, $controller_name));
         $data['OTHER_PAGING_QUERY'] = htmlentities(B\feedsUrl($type, $type_id,
             true, $other_controller_name));
-        if(isset($data["WIKI_QUERY"])) {
+        if (isset($data["WIKI_QUERY"])) {
             $data["WIKI_QUERY"];
         }
         $this->initializeWikiEditor($data, -1);
@@ -2196,12 +2266,12 @@ class SocialComponent extends Component implements CrawlConstants
                 $data["INCLUDE_SCRIPTS"][] = "math";
             }
             //handles template page types for read case
-            if($data['MODE'] == "read" && isset($data["HEAD"]['page_type']) &&
+            if ($data['MODE'] == "read" && isset($data["HEAD"]['page_type']) &&
                 $data["HEAD"]['page_type'][0] == 't' &&
                 is_numeric(substr($data["HEAD"]['page_type'], 1))) {
                 $templates = $group_model->getTemplateMap($group_id,
                     $data['CURRENT_LOCALE_TAG']);
-                if(empty($_REQUEST['n']) &&
+                if (empty($_REQUEST['n']) &&
                     !empty($templates[$data["HEAD"]['page_type']])) {
                     $template_name = $templates[$data["HEAD"]['page_type']];
                     $template_info = $group_model->
@@ -2271,7 +2341,7 @@ class SocialComponent extends Component implements CrawlConstants
                 if (empty($templates["t".$data["PAGE_ID"]])) {
                     $data['page_types'] = array_merge($data['page_types'],
                         $templates);
-                    if(empty($_REQUEST['n']) &&
+                    if (empty($_REQUEST['n']) &&
                         !empty($templates[$data['current_page_type']])) {
                         $template_name = $templates[$data['current_page_type']];
                         $template_info = $group_model->
@@ -3130,7 +3200,7 @@ EOD;
 <input type='text'  name='q'  value="" placeholder='$3'
     title='$3' class='search-input' />
 <button type="submit" class='search-button'><img
-    src='{$base_url}resources/search-button.png' 
+    src='{$base_url}resources/search-button.png'
     alt='$search_translation'/></button>
 </form>
 EOD;
@@ -3700,7 +3770,7 @@ EOD;
                 $data['MIX'] = $mix;
                 $crawl_model->setCrawlMix($mix);
                 $preserve = [];
-                if (!empty($_REQUEST['context']) && 
+                if (!empty($_REQUEST['context']) &&
                     $_REQUEST['context'] == 'search') {
                     $_REQUEST['arg'] = 'search';
                     $preserve = ['arg'];
@@ -3738,4 +3808,4 @@ EOD;
         }
         $data['SCRIPT'] .= ']; drawFragments();';
     }
-}
+}
\ No newline at end of file
diff --git a/src/locale/en_US/configure.ini b/src/locale/en_US/configure.ini
index 6e49d3d..ee0103e 100644
--- a/src/locale/en_US/configure.ini
+++ b/src/locale/en_US/configure.ini
@@ -3004,6 +3004,18 @@ managegroup_element_no_activity = "No Activity"
 ; ManagegroupsElement.php line: 771
 managegroup_element_no_activity = "No Activity"
 ;
+; ManagegroupsElement.php line: 882
+managegroup_element_hour = "Hours"
+;
+; ManagegroupsElement.php line: 887
+managegroup_element_day = "Day"
+;
+; ManagegroupsElement.php line: 892
+managegroup_element_month = "Month"
+;
+; ManagegroupsElement.php line: 924
+managegroup_element_num_visits = "Num of visits"
+;
 ; ManagegroupsElement.php line: 790
 managegroups_element_discover_groups = "Discover Groups"
 ;
diff --git a/src/models/ImpressionModel.php b/src/models/ImpressionModel.php
index 1632e7f..c6e24b2 100644
--- a/src/models/ImpressionModel.php
+++ b/src/models/ImpressionModel.php
@@ -213,8 +213,8 @@ class ImpressionModel extends Model
         $select = "";
         $from = "";
         $where = "";
-        $timestamp = floor(time()/$period) * $period;
-        $parameters = [$type, $period, $group_id, $user_id];
+        list ($timestamp, $actual_period) = $this->getLastTimestamp($period);
+        $parameters = [$type, $actual_period, $group_id, $user_id];
         $filter_where = "";
         switch ($type)
         {
@@ -255,17 +255,18 @@ class ImpressionModel extends Model
         }
         $timestamp_where = "";
         if ($period != C\FOREVER) {
-            $timestamp_where = " AND IIS.UPDATE_TIMESTAMP = ? ";
+            $timestamp_where = " AND IIS.UPDATE_TIMESTAMP >= ? ";
             $parameters[] = $timestamp;
         }
-        $sql = "SELECT G.GROUP_NAME AS GROUP_NAME,
+        $sql = "SELECT G.GROUP_NAME AS GROUP_NAME, IIS.ITEM_ID AS ID,
             IIS.UPDATE_PERIOD AS PERIOD, IIS.UPDATE_TIMESTAMP AS TIMESTAMP,
-            IIS.NUM_VIEWS AS NUM_VIEWS $select
+            SUM(IIS.NUM_VIEWS) AS NUM_VIEWS $select
             FROM ITEM_IMPRESSION_SUMMARY IIS, GROUPS G $from
             WHERE  IIS.ITEM_TYPE = ? AND IIS.UPDATE_PERIOD = ?
             AND G.GROUP_ID = ? AND IIS.USER_ID = ? $where $filter_where
-            $timestamp_where ORDER BY PERIOD ASC, TIMESTAMP DESC, ".
-            "NUM_VIEWS DESC " . $db->limitOffset($limit, $num);
+            $timestamp_where GROUP BY IIS.ITEM_ID ORDER BY PERIOD ASC,
+            TIMESTAMP DESC, "."NUM_VIEWS DESC " .
+            $db->limitOffset($limit, $num);
         $result = $db->execute($sql, $parameters);
         $statistics = [];
         while ($row = $db->fetchArray($result)) {
@@ -280,6 +281,67 @@ class ImpressionModel extends Model
         return $statistics;
     }
     /**
+     * Calculates total number of views of given item id for
+     * given time period
+     *
+     * @param int $type
+     * @param int $period time period for which to show stats
+     * @param int $item_id item identifier of item for which to show stats
+     * @return array
+     */
+    public function getLastActivity($type, $period, $item_id)
+    {
+        $db = $this->db;
+        list ($timestamp, $actual_period) = $this->getLastTimestamp($period);
+        $parameters = [$type, $actual_period, $item_id, $timestamp];
+        $sql = "SELECT IIS.ITEM_ID AS ID, IIS.NUM_VIEWS AS VIEWS,
+            IIS.ITEM_TYPE AS TYPE, IIS.UPDATE_TIMESTAMP,
+            IIS.UPDATE_PERIOD AS PERIOD
+            FROM ITEM_IMPRESSION_SUMMARY IIS
+            WHERE IIS.ITEM_TYPE = ? AND IIS.UPDATE_PERIOD = ?
+            AND IIS.ITEM_ID = ? AND IIS.USER_ID = 2
+            AND IIS.UPDATE_TIMESTAMP >= ? ORDER BY UPDATE_TIMESTAMP ASC";
+        $result = $db->execute($sql, $parameters);
+        $statistics = [];
+        while ($row = $db->fetchArray($result)) {
+            $statistics[] = $row;
+        }
+        return $statistics;
+    }
+    /**
+     * Subtracts the timestamp to get actual time period window.
+     * To get statistics for one time period, lower time period's data needs
+     * to be extracted. For example, to get last day's stat, result in every
+     * one hour needs to be extracted in the last 24 hours
+     *
+     * @param int $period time period
+     * @return array
+     */
+    public function getLastTimestamp($period)
+    {
+        $time_periods = [C\ONE_HOUR, C\ONE_DAY, C\ONE_MONTH,
+            C\ONE_YEAR, C\FOREVER];
+        if ($period == $time_periods[0]) {
+            $interval = 1;
+        } else if ($period == $time_periods[1]) {
+            $period = $time_periods[0];
+            $interval = 24;
+        } else if ($period == $time_periods[2]) {
+            $period = $time_periods[1];
+            $interval = 30;
+        } else if ($period == $time_periods[3]) {
+            $period = $time_periods[2];
+            $interval = 12;
+        } else {
+            $period = $period;
+            $interval = 0; // All time
+        }
+        $current_timestamp = floor(time()/$period) * $period;
+        $last_timestamp =($period==-2)?0:
+            ($current_timestamp - ($period * ($interval - 1)));
+        return [$last_timestamp, $period];
+    }
+    /**
      * Used to create a new counter related to a particular user for a
      * particular activity in the impression analytics. This entails adding both
      * a log-like record of when the activity happened and creating  a
diff --git a/src/scripts/rgraph.common.core.js b/src/scripts/rgraph.common.core.js
new file mode 100644
index 0000000..f39acc2
--- /dev/null
+++ b/src/scripts/rgraph.common.core.js
@@ -0,0 +1,406 @@
+
+RGraph=window.RGraph||{isRGraph:true};(function(win,doc,undefined)
+{var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.Highlight={};RG.Registry={};RG.Registry.store=[];RG.Registry.store['chart.event.handlers']=[];RG.Registry.store['__rgraph_event_listeners__']=[];RG.Background={};RG.background={};RG.objects=[];RG.Resizing={};RG.events=[];RG.cursor=[];RG.Effects=RG.Effects||{};RG.cache=[];RG.ObjectRegistry={};RG.ObjectRegistry.objects={};RG.ObjectRegistry.objects.byUID=[];RG.ObjectRegistry.objects.byCanvasID=[];RG.OR=RG.ObjectRegistry;RG.PI=ma.PI;RG.HALFPI=RG.PI/2;RG.TWOPI=RG.PI*2;RG.ISFF=ua.indexOf('Firefox')!=-1;RG.ISOPERA=ua.indexOf('Opera')!=-1;RG.ISCHROME=ua.indexOf('Chrome')!=-1;RG.ISSAFARI=ua.indexOf('Safari')!=-1&&!RG.ISCHROME;RG.ISWEBKIT=ua.indexOf('WebKit')!=-1;RG.ISIE=ua.indexOf('Trident')>0||navigator.userAgent.indexOf('MSIE')>0;RG.ISIE6=ua.indexOf('MSIE 6')>0;RG.ISIE7=ua.indexOf('MSIE 7')>0;RG.ISIE8=ua.indexOf('MSIE 8')>0;RG.ISIE9=ua.indexOf('MSIE 9')>0;RG.ISIE10=ua.indexOf('MSIE 10')>0;RG.ISOLD=RGraph.ISIE6||RGraph.ISIE7||RGraph.ISIE8;RG.ISIE11UP=ua.indexOf('MSIE')==-1&&ua.indexOf('Trident')>0;RG.ISIE10UP=RG.ISIE10||RG.ISIE11UP;RG.ISIE9UP=RG.ISIE9||RG.ISIE10UP;RG.getScale=function(max,obj)
+{if(max==0){return['0.2','0.4','0.6','0.8','1.0'];}
+var original_max=max;if(max<=1){if(max>0.5){return[0.2,0.4,0.6,0.8,Number(1).toFixed(1)];}else if(max>=0.1){return obj.Get('chart.scale.round')?[0.2,0.4,0.6,0.8,1]:[0.1,0.2,0.3,0.4,0.5];}else{var tmp=max;var exp=0;while(tmp<1.01){exp+=1;tmp*=10;}
+var ret=['2e-'+exp,'4e-'+exp,'6e-'+exp,'8e-'+exp,'10e-'+exp];if(max<=('5e-'+exp)){ret=['1e-'+exp,'2e-'+exp,'3e-'+exp,'4e-'+exp,'5e-'+exp];}
+return ret;}}
+if(String(max).indexOf('.')>0){max=String(max).replace(/\.\d+$/,'');}
+var interval=ma.pow(10,Number(String(Number(max)).length-1));var topValue=interval;while(topValue<max){topValue+=(interval/2);}
+if(Number(original_max)>Number(topValue)){topValue+=(interval/2);}
+if(max<10){topValue=(Number(original_max)<=5?5:10);}
+if(obj&&typeof(obj.Get('chart.scale.round'))=='boolean'&&obj.Get('chart.scale.round')){topValue=10*interval;}
+return[topValue*0.2,topValue*0.4,topValue*0.6,topValue*0.8,topValue];};RG.getScale2=function(obj,opt)
+{var ca=obj.canvas,co=obj.context,prop=obj.properties,numlabels=typeof opt['ylabels.count']=='number'?opt['ylabels.count']:5,units_pre=typeof opt['units.pre']=='string'?opt['units.pre']:'',units_post=typeof opt['units.post']=='string'?opt['units.post']:'',max=Number(opt['max']),min=typeof opt['min']=='number'?opt['min']:0,strict=opt['strict'],decimals=Number(opt['scale.decimals']),point=opt['scale.point'],thousand=opt['scale.thousand'],original_max=max,round=opt['scale.round'],scale={max:1,labels:[],values:[]}
+if(!max){var max=1;for(var i=0;i<numlabels;++i){var label=((((max-min)/numlabels)+min)*(i+1)).toFixed(decimals);scale.labels.push(units_pre+label+units_post);scale.values.push(parseFloat(label))}}else if(max<=1&&!strict){var arr=[1,0.5,0.10,0.05,0.010,0.005,0.0010,0.0005,0.00010,0.00005,0.000010,0.000005,0.0000010,0.0000005,0.00000010,0.00000005,0.000000010,0.000000005,0.0000000010,0.0000000005,0.00000000010,0.00000000005,0.000000000010,0.000000000005,0.0000000000010,0.0000000000005],vals=[];for(var i=0;i<arr.length;++i){if(max>arr[i]){i--;break;}}
+scale.max=arr[i]
+scale.labels=[];scale.values=[];for(var j=0;j<numlabels;++j){var value=((((arr[i]-min)/numlabels)*(j+1))+min).toFixed(decimals);scale.values.push(value);scale.labels.push(RG.numberFormat(obj,value,units_pre,units_post));}}else if(!strict){max=ma.ceil(max);var interval=ma.pow(10,ma.max(1,Number(String(Number(max)-Number(min)).length-1)));var topValue=interval;while(topValue<max){topValue+=(interval/2);}
+if(Number(original_max)>Number(topValue)){topValue+=(interval/2);}
+if(max<=10){topValue=(Number(original_max)<=5?5:10);}
+if(obj&&typeof(round)=='boolean'&&round){topValue=10*interval;}
+scale.max=topValue;var tmp_point=prop['chart.scale.point'];var tmp_thousand=prop['chart.scale.thousand'];obj.Set('chart.scale.thousand',thousand);obj.Set('chart.scale.point',point);for(var i=0;i<numlabels;++i){scale.labels.push(RG.number_format(obj,((((i+1)/numlabels)*(topValue-min))+min).toFixed(decimals),units_pre,units_post));scale.values.push(((((i+1)/numlabels)*(topValue-min))+min).toFixed(decimals));}
+obj.Set('chart.scale.thousand',tmp_thousand);obj.Set('chart.scale.point',tmp_point);}else if(typeof(max)=='number'&&strict){for(var i=0;i<numlabels;++i){scale.labels.push(RG.numberFormat(obj,((((i+1)/numlabels)*(max-min))+min).toFixed(decimals),units_pre,units_post));scale.values.push(((((i+1)/numlabels)*(max-min))+min).toFixed(decimals));}
+scale.max=max;}
+scale.units_pre=units_pre;scale.units_post=units_post;scale.point=point;scale.decimals=decimals;scale.thousand=thousand;scale.numlabels=numlabels;scale.round=Boolean(round);scale.min=min;for(var i=0;i<scale.values.length;++i){scale.values[i]=parseFloat(scale.values[i]);}
+return scale;};RG.arrayInvert=function(arr)
+{for(var i=0,len=arr.length;i<len;++i){arr[i]=!arr[i];}
+return arr;};RG.arrayTrim=function(arr)
+{var out=[],content=false;for(var i=0;i<arr.length;i++){if(arr[i]){content=true;}
+if(content){out.push(arr[i]);}}
+out=RG.arrayReverse(out);var out2=[],content=false;for(var i=0;i<out.length;i++){if(out[i]){content=true;}
+if(content){out2.push(out[i]);}}
+out2=RG.arrayReverse(out2);return out2;};RG.arrayClone=RG.array_clone=function(obj)
+{if(obj===null||typeof obj!=='object'){return obj;}
+var temp=[];for(var i=0,len=obj.length;i<len;++i){if(typeof obj[i]==='number'){temp[i]=(function(arg){return Number(arg);})(obj[i]);}else if(typeof obj[i]==='string'){temp[i]=(function(arg){return String(arg);})(obj[i]);}else if(typeof obj[i]==='function'){temp[i]=obj[i];}else{temp[i]=RG.arrayClone(obj[i]);}}
+return temp;};RG.arrayMax=RG.array_max=function(arr)
+{var max=null,ma=Math
+if(typeof arr==='number'){return arr;}
+if(RG.isNull(arr)){return 0;}
+for(var i=0,len=arr.length;i<len;++i){if(typeof arr[i]==='number'){var val=arguments[1]?ma.abs(arr[i]):arr[i];if(typeof max==='number'){max=ma.max(max,val);}else{max=val;}}}
+return max;};RG.arrayMin=function(arr)
+{var max=null,min=null,ma=Math;if(typeof arr==='number'){return arr;}
+if(RG.isNull(arr)){return 0;}
+for(var i=0,len=arr.length;i<len;++i){if(typeof arr[i]==='number'){var val=arguments[1]?ma.abs(arr[i]):arr[i];if(typeof min==='number'){min=ma.min(min,val);}else{min=val;}}}
+return min;};RG.arrayPad=RG.array_pad=function(arr,len)
+{if(arr.length<len){var val=arguments[2]?arguments[2]:null;for(var i=arr.length;i<len;i+=1){arr[i]=val;}}
+return arr;};RG.arraySum=RG.array_sum=function(arr)
+{if(typeof arr==='number'){return arr;}
+if(RG.is_null(arr)){return 0;}
+var i,sum,len=arr.length;for(i=0,sum=0;i<len;sum+=arr[i++]);return sum;};RG.arrayLinearize=RG.array_linearize=function()
+{var arr=[],args=arguments
+for(var i=0,len=args.length;i<len;++i){if(typeof args[i]==='object'&&args[i]){for(var j=0,len2=args[i].length;j<len2;++j){var sub=RG.array_linearize(args[i][j]);for(var k=0,len3=sub.length;k<len3;++k){arr.push(sub[k]);}}}else{arr.push(args[i]);}}
+return arr;};RG.arrayShift=RG.array_shift=function(arr)
+{var ret=[];for(var i=1,len=arr.length;i<len;++i){ret.push(arr[i]);}
+return ret;};RG.arrayReverse=RG.array_reverse=function(arr)
+{if(!arr){return;}
+var newarr=[];for(var i=arr.length-1;i>=0;i-=1){newarr.push(arr[i]);}
+return newarr;};RG.abs=function(value)
+{if(typeof value==='string'){value=parseFloat(value)||0;}
+if(typeof value==='number'){return ma.abs(value);}
+if(typeof value==='object'){for(i in value){if(typeof i==='string'||typeof i==='number'||typeof i==='object'){value[i]=RG.abs(value[i]);}}
+return value;}
+return 0;};RG.clear=RG.Clear=function(ca)
+{var obj=ca.__object__,co=ca.getContext('2d'),color=arguments[1]||(obj&&obj.get('clearto'))
+if(!ca){return;}
+RG.fireCustomEvent(obj,'onbeforeclear');if(RG.text2.domNodeCache&&RG.text2.domNodeCache[ca.id]){for(var i in RG.text2.domNodeCache[ca.id]){var el=RG.text2.domNodeCache[ca.id][i];if(el&&el.style){el.style.display='none';}}}
+if(!color||(color&&color==='rgba(0,0,0,0)'||color==='transparent')){co.clearRect(-100,-100,ca.width+200,ca.height+200);co.globalCompositeOperation='source-over';}else if(color){RG.path2(co,'fs % fr -100 -100 % %',color,ca.width+200,ca.height+200);}else{RG.path2(co,'fs % fr -100 -100 % %',obj.get('clearto'),ca.width+200,ca.height+200);}
+if(RG.Registry.Get('chart.background.image.'+ca.id)){var img=RG.Registry.Get('chart.background.image.'+ca.id);img.style.position='absolute';img.style.left='-10000px';img.style.top='-10000px';}
+if(RG.Registry.Get('chart.tooltip')&&obj&&!obj.get('chart.tooltips.nohideonclear')){RG.HideTooltip(ca);}
+ca.style.cursor='default';RG.FireCustomEvent(obj,'onclear');};RG.drawTitle=RG.DrawTitle=function(obj,text,gutterTop)
+{var ca=canvas=obj.canvas,co=context=obj.context,prop=obj.properties
+gutterLeft=prop['chart.gutter.left'],gutterRight=prop['chart.gutter.right'],gutterTop=gutterTop,gutterBottom=prop['chart.gutter.bottom'],size=arguments[4]?arguments[4]:12,bold=prop['chart.title.bold'],italic=prop['chart.title.italic'],centerx=(arguments[3]?arguments[3]:((ca.width-gutterLeft-gutterRight)/2)+gutterLeft),keypos=prop['chart.key.position'],vpos=prop['chart.title.vpos'],hpos=prop['chart.title.hpos'],bgcolor=prop['chart.title.background'],x=prop['chart.title.x'],y=prop['chart.title.y'],halign='center',valign='center'
+if(obj.type=='bar'&&prop['chart.variant']=='3d'){keypos='gutter';}
+co.beginPath();co.fillStyle=prop['chart.text.color']?prop['chart.text.color']:'black';if(keypos&&keypos!='gutter'){var valign='center';}else if(!keypos){var valign='center';}else{var valign='bottom';}
+if(typeof prop['chart.title.vpos']==='number'){vpos=prop['chart.title.vpos']*gutterTop;if(prop['chart.xaxispos']==='top'){vpos=prop['chart.title.vpos']*gutterBottom+gutterTop+(ca.height-gutterTop-gutterBottom);}}else{vpos=gutterTop-size-5;if(prop['chart.xaxispos']==='top'){vpos=ca.height-gutterBottom+size+5;}}
+if(typeof hpos==='number'){centerx=hpos*ca.width;}
+if(typeof x==='number')centerx=x;if(typeof y==='number')vpos=y;if(typeof prop['chart.title.halign']==='string'){halign=prop['chart.title.halign'];}
+if(typeof prop['chart.title.valign']==='string'){valign=prop['chart.title.valign'];}
+if(typeof prop['chart.title.color']!==null){var oldColor=co.fillStyle
+var newColor=prop['chart.title.color'];co.fillStyle=newColor?newColor:'black';}
+var font=prop['chart.text.font'];if(typeof prop['chart.title.font']==='string'){font=prop['chart.title.font'];}
+var ret=RG.text2(obj,{font:font,size:size,x:centerx,y:vpos,text:text,valign:valign,halign:halign,bounding:bgcolor!=null,'bounding.fill':bgcolor,'bold':bold,italic:italic,tag:'title',marker:false});co.fillStyle=oldColor;};RG.getMouseXY=function(e)
+{if(!e.target){return;}
+var el=e.target;var ca=el;var caStyle=ca.style;var offsetX=0;var offsetY=0;var x;var y;var borderLeft=parseInt(caStyle.borderLeftWidth)||0;var borderTop=parseInt(caStyle.borderTopWidth)||0;var paddingLeft=parseInt(caStyle.paddingLeft)||0
+var paddingTop=parseInt(caStyle.paddingTop)||0
+var additionalX=borderLeft+paddingLeft;var additionalY=borderTop+paddingTop;if(typeof e.offsetX==='number'&&typeof e.offsetY==='number'){if(!RG.ISIE&&!RG.ISOPERA){x=e.offsetX-borderLeft-paddingLeft;y=e.offsetY-borderTop-paddingTop;}else if(RG.ISIE){x=e.offsetX-paddingLeft;y=e.offsetY-paddingTop;}else{x=e.offsetX;y=e.offsetY;}}else{if(typeof el.offsetParent!=='undefined'){do{offsetX+=el.offsetLeft;offsetY+=el.offsetTop;}while((el=el.offsetParent));}
+x=e.pageX-offsetX-additionalX;y=e.pageY-offsetY-additionalY;x-=(2*(parseInt(document.body.style.borderLeftWidth)||0));y-=(2*(parseInt(document.body.style.borderTopWidth)||0));}
+return[x,y];};RG.getCanvasXY=function(canvas)
+{var x=0;var y=0;var el=canvas;do{x+=el.offsetLeft;y+=el.offsetTop;if(el.tagName.toLowerCase()=='table'&&(RG.ISCHROME||RG.ISSAFARI)){x+=parseInt(el.border)||0;y+=parseInt(el.border)||0;}
+el=el.offsetParent;}while(el&&el.tagName.toLowerCase()!='body');var paddingLeft=canvas.style.paddingLeft?parseInt(canvas.style.paddingLeft):0;var paddingTop=canvas.style.paddingTop?parseInt(canvas.style.paddingTop):0;var borderLeft=canvas.style.borderLeftWidth?parseInt(canvas.style.borderLeftWidth):0;var borderTop=canvas.style.borderTopWidth?parseInt(canvas.style.borderTopWidth):0;if(navigator.userAgent.indexOf('Firefox')>0){x+=parseInt(document.body.style.borderLeftWidth)||0;y+=parseInt(document.body.style.borderTopWidth)||0;}
+return[x+paddingLeft+borderLeft,y+paddingTop+borderTop];};RG.isFixed=function(canvas)
+{var obj=canvas;var i=0;while(obj&&obj.tagName.toLowerCase()!='body'&&i<99){if(obj.style.position=='fixed'){return obj;}
+obj=obj.offsetParent;}
+return false;};RG.register=RG.Register=function(obj)
+{if(!obj.Get('chart.noregister')){RGraph.ObjectRegistry.Add(obj);obj.Set('chart.noregister',true);}};RG.redraw=RG.Redraw=function()
+{var objectRegistry=RGraph.ObjectRegistry.objects.byCanvasID;var tags=document.getElementsByTagName('canvas');for(var i=0,len=tags.length;i<len;++i){if(tags[i].__object__&&tags[i].__object__.isRGraph){if(!tags[i].noclear){RGraph.clear(tags[i],arguments[0]?arguments[0]:null);}}}
+for(var i=0,len=objectRegistry.length;i<len;++i){if(objectRegistry[i]){var id=objectRegistry[i][0];objectRegistry[i][1].Draw();}}};RG.redrawCanvas=RG.RedrawCanvas=function(ca)
+{var objects=RG.ObjectRegistry.getObjectsByCanvasID(ca.id);if(!arguments[1]||(typeof arguments[1]==='boolean'&&!arguments[1]==false)){var color=arguments[2]||ca.__object__.get('clearto')||'transparent';RG.clear(ca,color);}
+for(var i=0,len=objects.length;i<len;++i){if(objects[i]){if(objects[i]&&objects[i].isRGraph){objects[i].Draw();}}}};RG.Background.draw=RG.background.draw=RG.background.Draw=function(obj)
+{var ca=obj.canvas,co=obj.context,prop=obj.properties,height=0,gutterLeft=obj.gutterLeft,gutterRight=obj.gutterRight,gutterTop=obj.gutterTop,gutterBottom=obj.gutterBottom,variant=prop['chart.variant']
+co.fillStyle=prop['chart.text.color'];if(variant=='3d'){co.save();co.translate(prop['chart.variant.threed.offsetx'],-1*prop['chart.variant.threed.offsety']);}
+if(typeof prop['chart.title.xaxis']==='string'&&prop['chart.title.xaxis'].length){var size=prop['chart.text.size']+2;var font=prop['chart.text.font'];var bold=prop['chart.title.xaxis.bold'];if(typeof(prop['chart.title.xaxis.size'])=='number'){size=prop['chart.title.xaxis.size'];}
+if(typeof(prop['chart.title.xaxis.font'])=='string'){font=prop['chart.title.xaxis.font'];}
+var hpos=((ca.width-gutterLeft-gutterRight)/2)+gutterLeft;var vpos=ca.height-gutterBottom+25;if(typeof prop['chart.title.xaxis.pos']==='number'){vpos=ca.height-(gutterBottom*prop['chart.title.xaxis.pos']);}
+if(typeof prop['chart.title.xaxis.x']==='number'){hpos=prop['chart.title.xaxis.x'];}
+if(typeof prop['chart.title.xaxis.y']==='number'){vpos=prop['chart.title.xaxis.y'];}
+RG.text2(prop['chart.text.accessible']?obj.context:co,{font:font,size:size,x:hpos,y:vpos,text:prop['chart.title.xaxis'],halign:'center',valign:'center',bold:bold,color:prop['chart.title.xaxis.color']||'black',tag:'title xaxis'});}
+if(typeof(prop['chart.title.yaxis'])=='string'&&prop['chart.title.yaxis'].length){var size=prop['chart.text.size']+2;var font=prop['chart.text.font'];var angle=270;var bold=prop['chart.title.yaxis.bold'];var color=prop['chart.title.yaxis.color'];if(typeof(prop['chart.title.yaxis.pos'])=='number'){var yaxis_title_pos=prop['chart.title.yaxis.pos']*gutterLeft;}else{var yaxis_title_pos=((gutterLeft-25)/gutterLeft)*gutterLeft;}
+if(typeof prop['chart.title.yaxis.size']==='number'){size=prop['chart.title.yaxis.size'];}
+if(typeof prop['chart.title.yaxis.font']==='string'){font=prop['chart.title.yaxis.font'];}
+if(prop['chart.title.yaxis.align']=='right'||prop['chart.title.yaxis.position']=='right'||(obj.type==='hbar'&&prop['chart.yaxispos']==='right'&&typeof prop['chart.title.yaxis.align']==='undefined'&&typeof prop['chart.title.yaxis.position']==='undefined')){angle=90;yaxis_title_pos=prop['chart.title.yaxis.pos']?(ca.width-gutterRight)+(prop['chart.title.yaxis.pos']*gutterRight):ca.width-gutterRight+prop['chart.text.size']+5;}else{yaxis_title_pos=yaxis_title_pos;}
+var y=((ca.height-gutterTop-gutterBottom)/2)+gutterTop;if(typeof prop['chart.title.yaxis.x']==='number'){yaxis_title_pos=prop['chart.title.yaxis.x'];}
+if(typeof prop['chart.title.yaxis.y']==='number'){y=prop['chart.title.yaxis.y'];}
+co.fillStyle=color;RG.text2(prop['chart.text.accessible']?obj.context:co,{'font':font,'size':size,'x':yaxis_title_pos,'y':y,'valign':'center','halign':'center','angle':angle,'bold':bold,'text':prop['chart.title.yaxis'],'tag':'title yaxis',accessible:false});}
+var bgcolor=prop['chart.background.color'];if(bgcolor){co.fillStyle=bgcolor;co.fillRect(gutterLeft+0.5,gutterTop+0.5,ca.width-gutterLeft-gutterRight,ca.height-gutterTop-gutterBottom);}
+var numbars=(prop['chart.ylabels.count']||5);var barHeight=(ca.height-gutterBottom-gutterTop)/numbars;co.beginPath();co.fillStyle=prop['chart.background.barcolor1'];co.strokeStyle=co.fillStyle;height=(ca.height-gutterBottom);for(var i=0;i<numbars;i+=2){co.rect(gutterLeft,(i*barHeight)+gutterTop,ca.width-gutterLeft-gutterRight,barHeight);}
+co.fill();co.beginPath();co.fillStyle=prop['chart.background.barcolor2'];co.strokeStyle=co.fillStyle;for(var i=1;i<numbars;i+=2){co.rect(gutterLeft,(i*barHeight)+gutterTop,ca.width-gutterLeft-gutterRight,barHeight);}
+co.fill();co.beginPath();var func=function(obj,cacheCanvas,cacheContext)
+{if(prop['chart.background.grid']){prop['chart.background.grid.autofit.numhlines']+=0.0001;if(prop['chart.background.grid.autofit']){if(prop['chart.background.grid.autofit.align']){if(obj.type==='hbar'){obj.set('chart.background.grid.autofit.numhlines',obj.data.length);}
+if(obj.type==='line'){if(typeof prop['chart.background.grid.autofit.numvlines']==='number'){}else if(prop['chart.labels']&&prop['chart.labels'].length){obj.Set('chart.background.grid.autofit.numvlines',prop['chart.labels'].length-1);}else{obj.Set('chart.background.grid.autofit.numvlines',obj.data[0].length-1);}}else if(obj.type==='waterfall'){obj.set('backgroundGridAutofitNumvlines',obj.data.length+(prop['chart.total']?1:0));}else if((obj.type==='bar'||obj.type==='scatter')&&((prop['chart.labels']&&prop['chart.labels'].length)||obj.type==='bar')){var len=(prop['chart.labels']&&prop['chart.labels'].length)||obj.data.length;obj.set({backgroundGridAutofitNumvlines:len});}else if(obj.type==='gantt'){if(typeof obj.get('chart.background.grid.autofit.numvlines')==='number'){}else{obj.set('chart.background.grid.autofit.numvlines',prop['chart.xmax']);}
+obj.set('chart.background.grid.autofit.numhlines',obj.data.length);}else if(obj.type==='hbar'&&RG.isNull(prop['chart.background.grid.autofit.numhlines'])){obj.set('chart.background.grid.autofit.numhlines',obj.data.length);}}
+var vsize=((cacheCanvas.width-gutterLeft-gutterRight))/prop['chart.background.grid.autofit.numvlines'];var hsize=(cacheCanvas.height-gutterTop-gutterBottom)/prop['chart.background.grid.autofit.numhlines'];obj.Set('chart.background.grid.vsize',vsize);obj.Set('chart.background.grid.hsize',hsize);}
+co.beginPath();cacheContext.lineWidth=prop['chart.background.grid.width']?prop['chart.background.grid.width']:1;cacheContext.strokeStyle=prop['chart.background.grid.color'];if(prop['chart.background.grid.dashed']&&typeof cacheContext.setLineDash=='function'){cacheContext.setLineDash([3,5]);}
+if(prop['chart.background.grid.dotted']&&typeof cacheContext.setLineDash=='function'){cacheContext.setLineDash([1,3]);}
+co.beginPath();if(prop['chart.background.grid.hlines']){height=(cacheCanvas.height-gutterBottom)
+var hsize=prop['chart.background.grid.hsize'];for(y=gutterTop;y<=height;y+=hsize){cacheContext.moveTo(gutterLeft,ma.round(y));cacheContext.lineTo(ca.width-gutterRight,ma.round(y));}}
+if(prop['chart.background.grid.vlines']){var width=(cacheCanvas.width-gutterRight);var vsize=prop['chart.background.grid.vsize'];for(x=gutterLeft;ma.round(x)<=width;x+=vsize){cacheContext.moveTo(ma.round(x),gutterTop);cacheContext.lineTo(ma.round(x),ca.height-gutterBottom);}}
+if(prop['chart.background.grid.border']){cacheContext.strokeStyle=prop['chart.background.grid.color'];cacheContext.strokeRect(ma.round(gutterLeft),ma.round(gutterTop),ca.width-gutterLeft-gutterRight,ca.height-gutterTop-gutterBottom);}}
+cacheContext.stroke();cacheContext.beginPath();cacheContext.closePath();}
+RG.cachedDraw(obj,obj.uid+'_background',func);if(variant=='3d'){co.restore();}
+if(typeof co.setLineDash=='function'){co.setLineDash([1,0]);}
+co.stroke();if(typeof(obj.properties['chart.title'])=='string'){var prop=obj.properties;RG.drawTitle(obj,prop['chart.title'],obj.gutterTop,null,prop['chart.title.size']?prop['chart.title.size']:prop['chart.text.size']+2,obj);}};RG.numberFormat=RG.number_format=function(obj,num)
+{var ca=obj.canvas;var co=obj.context;var prop=obj.properties;var i;var prepend=arguments[2]?String(arguments[2]):'';var append=arguments[3]?String(arguments[3]):'';var output='';var decimal='';var decimal_seperator=typeof prop['chart.scale.point']=='string'?prop['chart.scale.point']:'.';var thousand_seperator=typeof prop['chart.scale.thousand']=='string'?prop['chart.scale.thousand']:',';RegExp.$1='';var i,j;if(typeof prop['chart.scale.formatter']==='function'){return prop['chart.scale.formatter'](obj,num);}
+if(String(num).indexOf('e')>0){return String(prepend+String(num)+append);}
+num=String(num);if(num.indexOf('.')>0){var tmp=num;num=num.replace(/\.(.*)/,'');decimal=tmp.replace(/(.*)\.(.*)/,'$2');}
+var seperator=thousand_seperator;var foundPoint;for(i=(num.length-1),j=0;i>=0;j++,i--){var character=num.charAt(i);if(j%3==0&&j!=0){output+=seperator;}
+output+=character;}
+var rev=output;output='';for(i=(rev.length-1);i>=0;i--){output+=rev.charAt(i);}
+if(output.indexOf('-'+prop['chart.scale.thousand'])==0){output='-'+output.substr(('-'+prop['chart.scale.thousand']).length);}
+if(decimal.length){output=output+decimal_seperator+decimal;decimal='';RegExp.$1='';}
+if(output.charAt(0)=='-'){output=output.replace(/-/,'');prepend='-'+prepend;}
+return prepend+output+append;};RG.drawBars=RG.DrawBars=function(obj)
+{var prop=obj.properties;var co=obj.context;var ca=obj.canvas;var hbars=prop['chart.background.hbars'];if(hbars===null){return;}
+co.beginPath();for(i=0,len=hbars.length;i<len;++i){var start=hbars[i][0];var length=hbars[i][1];var color=hbars[i][2];if(RG.is_null(start))start=obj.scale2.max
+if(start>obj.scale2.max)start=obj.scale2.max;if(RG.is_null(length))length=obj.scale2.max-start;if(start+length>obj.scale2.max)length=obj.scale2.max-start;if(start+length<(-1*obj.scale2.max))length=(-1*obj.scale2.max)-start;if(prop['chart.xaxispos']=='center'&&start==obj.scale2.max&&length<(obj.scale2.max* -2)){length=obj.scale2.max* -2;}
+var x=prop['chart.gutter.left'];var y=obj.getYCoord(start);var w=ca.width-prop['chart.gutter.left']-prop['chart.gutter.right'];var h=obj.getYCoord(start+length)-y;if(RG.ISOPERA!=-1&&prop['chart.xaxispos']=='center'&&h<0){h*=-1;y=y-h;}
+if(prop['chart.xaxispos']=='top'){y=ca.height-y;h*=-1;}
+co.fillStyle=color;co.fillRect(x,y,w,h);}};RG.drawInGraphLabels=RG.DrawInGraphLabels=function(obj)
+{var ca=obj.canvas;var co=obj.context;var prop=obj.properties;var labels=prop['chart.labels.ingraph'];var labels_processed=[];var fgcolor='black';var bgcolor='white';var direction=1;if(!labels){return;}
+for(var i=0,len=labels.length;i<len;i+=1){if(typeof labels[i]==='number'){for(var j=0;j<labels[i];++j){labels_processed.push(null);}}else if(typeof labels[i]==='string'||typeof labels[i]==='object'){labels_processed.push(labels[i]);}else{labels_processed.push('');}}
+RG.noShadow(obj);if(labels_processed&&labels_processed.length>0){for(var i=0,len=labels_processed.length;i<len;i+=1){if(labels_processed[i]){var coords=obj.coords[i];if(coords&&coords.length>0){var x=(obj.type=='bar'?coords[0]+(coords[2]/2):coords[0]);var y=(obj.type=='bar'?coords[1]+(coords[3]/2):coords[1]);var length=typeof labels_processed[i][4]==='number'?labels_processed[i][4]:25;co.beginPath();co.fillStyle='black';co.strokeStyle='black';if(obj.type==='bar'){if(obj.Get('chart.xaxispos')=='top'){length*=-1;}
+if(prop['chart.variant']=='dot'){co.moveTo(ma.round(x),obj.coords[i][1]-5);co.lineTo(ma.round(x),obj.coords[i][1]-5-length);var text_x=ma.round(x);var text_y=obj.coords[i][1]-5-length;}else if(prop['chart.variant']=='arrow'){co.moveTo(ma.round(x),obj.coords[i][1]-5);co.lineTo(ma.round(x),obj.coords[i][1]-5-length);var text_x=ma.round(x);var text_y=obj.coords[i][1]-5-length;}else{co.arc(ma.round(x),y,2.5,0,6.28,0);co.moveTo(ma.round(x),y);co.lineTo(ma.round(x),y-length);var text_x=ma.round(x);var text_y=y-length;}
+co.stroke();co.fill();}else{if(typeof labels_processed[i]=='object'&&typeof labels_processed[i][3]=='number'&&labels_processed[i][3]==-1){co.moveTo(ma.round(x),y+5);co.lineTo(ma.round(x),y+5+length);co.stroke();co.beginPath();co.moveTo(ma.round(x),y+5);co.lineTo(ma.round(x)-3,y+10);co.lineTo(ma.round(x)+3,y+10);co.closePath();var text_x=x;var text_y=y+5+length;}else{var text_x=x;var text_y=y-5-length;co.moveTo(ma.round(x),y-5);co.lineTo(ma.round(x),y-5-length);co.stroke();co.beginPath();co.moveTo(ma.round(x),y-5);co.lineTo(ma.round(x)-3,y-10);co.lineTo(ma.round(x)+3,y-10);co.closePath();}
+co.fill();}
+co.beginPath();co.fillStyle=(typeof labels_processed[i]==='object'&&typeof labels_processed[i][1]==='string')?labels_processed[i][1]:'black';RG.text2(obj,{'font':prop['chart.text.font'],'size':prop['chart.text.size'],'x':text_x,'y':text_y+(obj.properties['chart.text.accessible']?2:0),'text':(typeof labels_processed[i]==='object'&&typeof labels_processed[i][0]==='string')?labels_processed[i][0]:labels_processed[i],'valign':'bottom','halign':'center','bounding':true,'bounding.fill':(typeof labels_processed[i]==='object'&&typeof labels_processed[i][2]==='string')?labels_processed[i][2]:'white','tag':'labels ingraph'});co.fill();}}}}};RG.fixEventObject=RG.FixEventObject=function(e)
+{if(RG.ISOLD){var e=event;e.pageX=(event.clientX+doc.body.scrollLeft);e.pageY=(event.clientY+doc.body.scrollTop);e.target=event.srcElement;if(!doc.body.scrollTop&&doc.documentElement.scrollTop){e.pageX+=parseInt(doc.documentElement.scrollLeft);e.pageY+=parseInt(doc.documentElement.scrollTop);}}
+if(!e.stopPropagation){e.stopPropagation=function(){window.event.cancelBubble=true;}}
+return e;};RG.hideCrosshairCoords=RG.HideCrosshairCoords=function()
+{var div=RG.Registry.Get('chart.coordinates.coords.div');if(div&&div.style.opacity==1&&div.__object__.Get('chart.crosshairs.coords.fadeout')){var style=RG.Registry.Get('chart.coordinates.coords.div').style;setTimeout(function(){style.opacity=0.9;},25);setTimeout(function(){style.opacity=0.8;},50);setTimeout(function(){style.opacity=0.7;},75);setTimeout(function(){style.opacity=0.6;},100);setTimeout(function(){style.opacity=0.5;},125);setTimeout(function(){style.opacity=0.4;},150);setTimeout(function(){style.opacity=0.3;},175);setTimeout(function(){style.opacity=0.2;},200);setTimeout(function(){style.opacity=0.1;},225);setTimeout(function(){style.opacity=0;},250);setTimeout(function(){style.display='none';},275);}};RG.draw3DAxes=RG.Draw3DAxes=function(obj)
+{var prop=obj.properties,co=obj.context,ca=obj.canvas;var gutterLeft=obj.gutterLeft,gutterRight=obj.gutterRight,gutterTop=obj.gutterTop,gutterBottom=obj.gutterBottom,xaxispos=prop['chart.xaxispos'],graphArea=ca.height-gutterTop-gutterBottom,halfGraphArea=graphArea/2,offsetx=prop['chart.variant.threed.offsetx'],offsety=prop['chart.variant.threed.offsety'],xaxis=prop['chart.variant.threed.xaxis'],yaxis=prop['chart.variant.threed.yaxis']
+if(yaxis){RG.draw3DYAxis(obj);}
+if(xaxis){if(xaxispos==='center'){RG.path2(co,'b m % % l % % l % % l % % c s #aaa f #ddd',gutterLeft,gutterTop+halfGraphArea,gutterLeft+offsetx,gutterTop+halfGraphArea-offsety,ca.width-gutterRight+offsetx,gutterTop+halfGraphArea-offsety,ca.width-gutterRight,gutterTop+halfGraphArea);}else{if(obj.type==='hbar'){var xaxisYCoord=obj.canvas.height-obj.properties['chart.gutter.bottom'];}else{var xaxisYCoord=obj.getYCoord(0);}
+RG.path2(co,'m % % l % % l % % l % % c s #aaa f #ddd',gutterLeft,xaxisYCoord,gutterLeft+offsetx,xaxisYCoord-offsety,ca.width-gutterRight+offsetx,xaxisYCoord-offsety,ca.width-gutterRight,xaxisYCoord);}}};RG.draw3DYAxis=function(obj)
+{var prop=obj.properties,co=obj.context,ca=obj.canvas;var gutterLeft=obj.gutterLeft,gutterRight=obj.gutterRight,gutterTop=obj.gutterTop,gutterBottom=obj.gutterBottom,xaxispos=prop['chart.xaxispos'],graphArea=ca.height-gutterTop-gutterBottom,halfGraphArea=graphArea/2,offsetx=prop['chart.variant.threed.offsetx'],offsety=prop['chart.variant.threed.offsety']
+if((obj.type==='hbar'||obj.type==='bar')&&prop['chart.yaxispos']==='center'){var x=((ca.width-gutterLeft-gutterRight)/2)+gutterLeft;}else if((obj.type==='hbar'||obj.type==='bar')&&prop['chart.yaxispos']==='right'){var x=ca.width-gutterRight;}else{var x=gutterLeft;}
+RG.path2(co,'b m % % l % % l % % l % % s #aaa f #ddd',x,gutterTop,x+offsetx,gutterTop-offsety,x+offsetx,ca.height-gutterBottom-offsety,x,ca.height-gutterBottom);};RG.strokedCurvyRect=function(co,x,y,w,h)
+{var r=arguments[5]?arguments[5]:3;var corner_tl=(arguments[6]||arguments[6]==null)?true:false;var corner_tr=(arguments[7]||arguments[7]==null)?true:false;var corner_br=(arguments[8]||arguments[8]==null)?true:false;var corner_bl=(arguments[9]||arguments[9]==null)?true:false;co.beginPath();co.moveTo(x+(corner_tl?r:0),y);co.lineTo(x+w-(corner_tr?r:0),y);if(corner_tr){co.arc(x+w-r,y+r,r,RG.PI+RG.HALFPI,RG.TWOPI,false);}
+co.lineTo(x+w,y+h-(corner_br?r:0));if(corner_br){co.arc(x+w-r,y-r+h,r,RG.TWOPI,RG.HALFPI,false);}
+co.lineTo(x+(corner_bl?r:0),y+h);if(corner_bl){co.arc(x+r,y-r+h,r,RG.HALFPI,RG.PI,false);}
+co.lineTo(x,y+(corner_tl?r:0));if(corner_tl){co.arc(x+r,y+r,r,RG.PI,RG.PI+RG.HALFPI,false);}
+co.stroke();};RG.filledCurvyRect=function(co,x,y,w,h)
+{var r=arguments[5]?arguments[5]:3;var corner_tl=(arguments[6]||arguments[6]==null)?true:false;var corner_tr=(arguments[7]||arguments[7]==null)?true:false;var corner_br=(arguments[8]||arguments[8]==null)?true:false;var corner_bl=(arguments[9]||arguments[9]==null)?true:false;co.beginPath();if(corner_tl){co.moveTo(x+r,y+r);co.arc(x+r,y+r,r,RG.PI,RG.PI+RG.HALFPI,false);}else{co.fillRect(x,y,r,r);}
+if(corner_tr){co.moveTo(x+w-r,y+r);co.arc(x+w-r,y+r,r,RG.PI+RG.HALFPI,0,false);}else{co.moveTo(x+w-r,y);co.fillRect(x+w-r,y,r,r);}
+if(corner_br){co.moveTo(x+w-r,y+h-r);co.arc(x+w-r,y-r+h,r,0,RG.HALFPI,false);}else{co.moveTo(x+w-r,y+h-r);co.fillRect(x+w-r,y+h-r,r,r);}
+if(corner_bl){co.moveTo(x+r,y+h-r);co.arc(x+r,y-r+h,r,RG.HALFPI,RG.PI,false);}else{co.moveTo(x,y+h-r);co.fillRect(x,y+h-r,r,r);}
+co.fillRect(x+r,y,w-r-r,h);co.fillRect(x,y+r,r+1,h-r-r);co.fillRect(x+w-r-1,y+r,r+1,h-r-r);co.fill();};RG.hideZoomedCanvas=RG.HideZoomedCanvas=function()
+{var interval=10;var frames=15;if(typeof RG.zoom_image==='object'){var obj=RG.zoom_image.obj;var prop=obj.properties;}else{return;}
+if(prop['chart.zoom.fade.out']){for(var i=frames,j=1;i>=0;--i,++j){if(typeof RG.zoom_image==='object'){setTimeout("RGraph.zoom_image.style.opacity = "+String(i/10),j*interval);}}
+if(typeof RG.zoom_background==='object'){setTimeout("RGraph.zoom_background.style.opacity = "+String(i/frames),j*interval);}}
+if(typeof RG.zoom_image==='object'){setTimeout("RGraph.zoom_image.style.display = 'none'",prop['chart.zoom.fade.out']?(frames*interval)+10:0);}
+if(typeof RG.zoom_background==='object'){setTimeout("RGraph.zoom_background.style.display = 'none'",prop['chart.zoom.fade.out']?(frames*interval)+10:0);}};RG.addCustomEventListener=RG.AddCustomEventListener=function(obj,name,func)
+{if(typeof RG.events[obj.uid]==='undefined'){RG.events[obj.uid]=[];}
+if(name.substr(0,2)!=='on'){name='on'+name;}
+RG.events[obj.uid].push([obj,name,func]);return RG.events[obj.uid].length-1;};RG.fireCustomEvent=RG.FireCustomEvent=function(obj,name)
+{if(obj&&obj.isRGraph){if(name.match(/(on)?mouseout/)&&typeof obj.properties['chart.events.mouseout']==='function'){(obj.properties['chart.events.mouseout'])(obj);}
+if(obj[name]){(obj[name])(obj);}
+var uid=obj.uid;if(typeof uid==='string'&&typeof RG.events==='object'&&typeof RG.events[uid]==='object'&&RG.events[uid].length>0){for(var j=0;j<RG.events[uid].length;++j){if(RG.events[uid][j]&&RG.events[uid][j][1]===name){RG.events[uid][j][2](obj);}}}}};RGraph.removeAllCustomEventListeners=RGraph.RemoveAllCustomEventListeners=function()
+{var id=arguments[0];if(id&&RG.events[id]){RG.events[id]=[];}else{RG.events=[];}};RG.removeCustomEventListener=RG.RemoveCustomEventListener=function(obj,i)
+{if(typeof RG.events==='object'&&typeof RG.events[obj.id]==='object'&&typeof RG.events[obj.id][i]==='object'){RG.events[obj.id][i]=null;}};RG.drawBackgroundImage=RG.DrawBackgroundImage=function(obj)
+{var prop=obj.properties;var ca=obj.canvas;var co=obj.context;if(typeof prop['chart.background.image']==='string'){if(typeof ca.__rgraph_background_image__==='undefined'){var img=new Image();img.__object__=obj;img.__canvas__=ca;img.__context__=co;img.src=obj.Get('chart.background.image');ca.__rgraph_background_image__=img;}else{img=ca.__rgraph_background_image__;}
+img.onload=function()
+{obj.__rgraph_background_image_loaded__=true;RG.clear(ca);RG.redrawCanvas(ca);}
+var gutterLeft=obj.gutterLeft;var gutterRight=obj.gutterRight;var gutterTop=obj.gutterTop;var gutterBottom=obj.gutterBottom;var stretch=prop['chart.background.image.stretch'];var align=prop['chart.background.image.align'];if(typeof align==='string'){if(align.indexOf('right')!=-1){var x=ca.width-(prop['chart.background.image.w']||img.width)-gutterRight;}else{var x=gutterLeft;}
+if(align.indexOf('bottom')!=-1){var y=ca.height-(prop['chart.background.image.h']||img.height)-gutterBottom;}else{var y=gutterTop;}}else{var x=gutterLeft||25;var y=gutterTop||25;}
+var x=typeof prop['chart.background.image.x']==='number'?prop['chart.background.image.x']:x;var y=typeof prop['chart.background.image.y']==='number'?prop['chart.background.image.y']:y;var w=stretch?ca.width-gutterLeft-gutterRight:img.width;var h=stretch?ca.height-gutterTop-gutterBottom:img.height;if(typeof prop['chart.background.image.w']==='number')w=prop['chart.background.image.w'];if(typeof prop['chart.background.image.h']==='number')h=prop['chart.background.image.h'];var oldAlpha=co.globalAlpha;co.globalAlpha=prop['chart.background.image.alpha'];co.drawImage(img,x,y,w,h);co.globalAlpha=oldAlpha;}};RG.hasTooltips=function(obj)
+{var prop=obj.properties;if(typeof prop['chart.tooltips']=='object'&&prop['chart.tooltips']){for(var i=0,len=prop['chart.tooltips'].length;i<len;++i){if(!RG.is_null(obj.Get('chart.tooltips')[i])){return true;}}}else if(typeof prop['chart.tooltips']==='function'){return true;}
+return false;};RG.createUID=RG.CreateUID=function()
+{return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c)
+{var r=ma.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});};RG.OR.add=RG.OR.Add=function(obj)
+{var uid=obj.uid;var id=obj.canvas.id;RG.ObjectRegistry.objects.byUID.push([uid,obj]);RG.ObjectRegistry.objects.byCanvasID.push([id,obj]);};RG.OR.remove=RG.OR.Remove=function(obj)
+{var id=obj.id;var uid=obj.uid;for(var i=0;i<RG.ObjectRegistry.objects.byUID.length;++i){if(RG.ObjectRegistry.objects.byUID[i]&&RG.ObjectRegistry.objects.byUID[i][1].uid==uid){RG.ObjectRegistry.objects.byUID[i]=null;}}
+for(var i=0;i<RG.ObjectRegistry.objects.byCanvasID.length;++i){if(RG.ObjectRegistry.objects.byCanvasID[i]&&RG.ObjectRegistry.objects.byCanvasID[i][1]&&RG.ObjectRegistry.objects.byCanvasID[i][1].uid==uid){RG.ObjectRegistry.objects.byCanvasID[i]=null;}}};RG.OR.clear=RG.OR.Clear=function()
+{if(arguments[0]){var id=(typeof arguments[0]==='object'?arguments[0].id:arguments[0]);var objects=RG.ObjectRegistry.getObjectsByCanvasID(id);for(var i=0,len=objects.length;i<len;++i){RG.ObjectRegistry.remove(objects[i]);}}else{RG.ObjectRegistry.objects={};RG.ObjectRegistry.objects.byUID=[];RG.ObjectRegistry.objects.byCanvasID=[];}};RG.OR.list=RG.OR.List=function()
+{var list=[];for(var i=0,len=RG.ObjectRegistry.objects.byUID.length;i<len;++i){if(RG.ObjectRegistry.objects.byUID[i]){list.push(RG.ObjectRegistry.objects.byUID[i][1].type);}}
+if(arguments[0]){return list;}else{$p(list);}};RG.OR.clearByType=RG.OR.ClearByType=function(type)
+{var objects=RG.ObjectRegistry.objects.byUID;for(var i=0,len=objects.length;i<len;++i){if(objects[i]){var uid=objects[i][0];var obj=objects[i][1];if(obj&&obj.type==type){RG.ObjectRegistry.remove(obj);}}}};RG.OR.iterate=RG.OR.Iterate=function(func)
+{var objects=RGraph.ObjectRegistry.objects.byUID;for(var i=0,len=objects.length;i<len;++i){if(typeof arguments[1]==='string'){var types=arguments[1].split(/,/);for(var j=0,len2=types.length;j<len2;++j){if(types[j]==objects[i][1].type){func(objects[i][1]);}}}else{func(objects[i][1]);}}};RG.OR.getObjectsByCanvasID=function(id)
+{var store=RG.ObjectRegistry.objects.byCanvasID;var ret=[];for(var i=0,len=store.length;i<len;++i){if(store[i]&&store[i][0]==id){ret.push(store[i][1]);}}
+return ret;};RG.OR.firstbyxy=RG.OR.getFirstObjectByXY=RG.OR.getObjectByXY=function(e)
+{var canvas=e.target;var ret=null;var objects=RG.ObjectRegistry.getObjectsByCanvasID(canvas.id);for(var i=(objects.length-1);i>=0;--i){var obj=objects[i].getObjectByXY(e);if(obj){return obj;}}};RG.OR.getObjectsByXY=function(e)
+{var canvas=e.target;var ret=[];var objects=RG.ObjectRegistry.getObjectsByCanvasID(canvas.id);for(var i=(objects.length-1);i>=0;--i){var obj=objects[i].getObjectByXY(e);if(obj){ret.push(obj);}}
+return ret;};RG.OR.get=RG.OR.getObjectByUID=function(uid)
+{var objects=RG.ObjectRegistry.objects.byUID;for(var i=0,len=objects.length;i<len;++i){if(objects[i]&&objects[i][1].uid==uid){return objects[i][1];}}};RG.OR.bringToFront=function(obj)
+{var redraw=typeof arguments[1]==='undefined'?true:arguments[1];RG.ObjectRegistry.remove(obj);RG.ObjectRegistry.add(obj);if(redraw){RG.redrawCanvas(obj.canvas);}};RG.OR.type=RG.OR.getObjectsByType=function(type)
+{var objects=RG.ObjectRegistry.objects.byUID;var ret=[];for(var i=0,len=objects.length;i<len;++i){if(objects[i]&&objects[i][1]&&objects[i][1].type&&objects[i][1].type&&objects[i][1].type==type){ret.push(objects[i][1]);}}
+return ret;};RG.OR.first=RG.OR.getFirstObjectByType=function(type)
+{var objects=RG.ObjectRegistry.objects.byUID;for(var i=0,len=objects.length;i<len;++i){if(objects[i]&&objects[i][1]&&objects[i][1].type==type){return objects[i][1];}}
+return null;};RG.getAngleByXY=function(cx,cy,x,y)
+{var angle=ma.atan((y-cy)/(x-cx));angle=ma.abs(angle)
+if(x>=cx&&y>=cy){angle+=RG.TWOPI;}else if(x>=cx&&y<cy){angle=(RG.HALFPI-angle)+(RG.PI+RG.HALFPI);}else if(x<cx&&y<cy){angle+=RG.PI;}else{angle=RG.PI-angle;}
+if(angle>RG.TWOPI){angle-=RG.TWOPI;}
+return angle;};RG.getHypLength=function(x1,y1,x2,y2)
+{var ret=ma.sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));return ret;};RG.getRadiusEndPoint=function(cx,cy,angle,radius)
+{var x=cx+(ma.cos(angle)*radius);var y=cy+(ma.sin(angle)*radius);return[x,y];};RG.installEventListeners=RG.InstallEventListeners=function(obj)
+{var prop=obj.properties;if(RG.ISOLD){return;}
+if(RG.installCanvasClickListener){RG.installWindowMousedownListener(obj);RG.installWindowMouseupListener(obj);RG.installCanvasMousemoveListener(obj);RG.installCanvasMouseupListener(obj);RG.installCanvasMousedownListener(obj);RG.installCanvasClickListener(obj);}else if(RG.hasTooltips(obj)||prop['chart.adjustable']||prop['chart.annotatable']||prop['chart.contextmenu']||prop['chart.resizable']||prop['chart.key.interactive']||prop['chart.events.click']||prop['chart.events.mousemove']||typeof obj.onclick==='function'||typeof obj.onmousemove==='function'){alert('[RGRAPH] You appear to have used dynamic features but not included the file: RGraph.common.dynamic.js');}};RG.pr=function(obj)
+{var indent=(arguments[2]?arguments[2]:'    ');var str='';var counter=typeof arguments[3]=='number'?arguments[3]:0;if(counter>=5){return'';}
+switch(typeof obj){case'string':str+=obj+' ('+(typeof obj)+', '+obj.length+')';break;case'number':str+=obj+' ('+(typeof obj)+')';break;case'boolean':str+=obj+' ('+(typeof obj)+')';break;case'function':str+='function () {}';break;case'undefined':str+='undefined';break;case'null':str+='null';break;case'object':if(RGraph.is_null(obj)){str+=indent+'null\n';}else{str+=indent+'Object {'+'\n'
+for(j in obj){str+=indent+'    '+j+' => '+RGraph.pr(obj[j],true,indent+'    ',counter+1)+'\n';}
+str+=indent+'}';}
+break;default:str+='Unknown type: '+typeof obj+'';break;}
+if(!arguments[1]){alert(str);}
+return str;};RG.dashedLine=RG.DashedLine=function(co,x1,y1,x2,y2)
+{var size=5;if(typeof arguments[5]==='number'){size=arguments[5];}
+var dx=x2-x1;var dy=y2-y1;var num=ma.floor(ma.sqrt((dx*dx)+(dy*dy))/size);var xLen=dx/num;var yLen=dy/num;var count=0;do{(count%2==0&&count>0)?co.lineTo(x1,y1):co.moveTo(x1,y1);x1+=xLen;y1+=yLen;}while(count++<=num);};RG.AJAX=function(url,callback)
+{if(window.XMLHttpRequest){var httpRequest=new XMLHttpRequest();}else if(window.ActiveXObject){var httpRequest=new ActiveXObject("Microsoft.XMLHTTP");}
+httpRequest.onreadystatechange=function()
+{if(this.readyState==4&&this.status==200){this.__user_callback__=callback;this.__user_callback__(this.responseText);}}
+httpRequest.open('GET',url,true);httpRequest.send();};RG.AJAX.POST=function(url,data,callback)
+{var crumbs=[];if(window.XMLHttpRequest){var httpRequest=new XMLHttpRequest();}else if(window.ActiveXObject){var httpRequest=new ActiveXObject("Microsoft.XMLHTTP");}
+httpRequest.onreadystatechange=function()
+{if(this.readyState==4&&this.status==200){this.__user_callback__=callback;this.__user_callback__(this.responseText);}}
+httpRequest.open('POST',url,true);httpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");for(i in data){if(typeof i=='string'){crumbs.push(i+'='+encodeURIComponent(data[i]));}}
+httpRequest.send(crumbs.join('&'));};RG.AJAX.getNumber=function(url,callback)
+{RG.AJAX(url,function()
+{var num=parseFloat(this.responseText);callback(num);});};RG.AJAX.getString=function(url,callback)
+{RG.AJAX(url,function()
+{var str=String(this.responseText);callback(str);});};RG.AJAX.getJSON=function(url,callback)
+{RG.AJAX(url,function()
+{var json=eval('('+this.responseText+')');callback(json);});};RG.AJAX.getCSV=function(url,callback)
+{var seperator=arguments[2]?arguments[2]:',';RG.AJAX(url,function()
+{var regexp=new RegExp(seperator);var arr=this.responseText.split(regexp);for(var i=0,len=arr.length;i<len;++i){arr[i]=parseFloat(arr[i]);}
+callback(arr);});};RG.rotateCanvas=RG.RotateCanvas=function(ca,x,y,angle)
+{var co=ca.getContext('2d');co.translate(x,y);co.rotate(angle);co.translate(0-x,0-y);};RG.measureText=RG.MeasureText=function(text,bold,font,size)
+{if(typeof RGraph.measuretext_cache==='undefined'){RGraph.measuretext_cache=[];}
+var str=text+':'+bold+':'+font+':'+size;if(typeof RGraph.measuretext_cache=='object'&&RGraph.measuretext_cache[str]){return RGraph.measuretext_cache[str];}
+if(!RGraph.measuretext_cache['text-div']){var div=document.createElement('DIV');div.style.position='absolute';div.style.top='-100px';div.style.left='-100px';document.body.appendChild(div);RGraph.measuretext_cache['text-div']=div;}else if(RGraph.measuretext_cache['text-div']){var div=RGraph.measuretext_cache['text-div'];}
+div.innerHTML=text.replace(/\r\n/g,'<br />');div.style.fontFamily=font;div.style.fontWeight=bold?'bold':'normal';div.style.fontSize=(size||12)+'pt';var size=[div.offsetWidth,div.offsetHeight];RGraph.measuretext_cache[str]=size;return size;};RG.text2=RG.Text2=function(obj,opt)
+{function domtext()
+{if(String(opt.size).toLowerCase().indexOf('italic')!==-1){opt.size=opt.size.replace(/ *italic +/,'');opt.italic=true;}
+var cacheKey=ma.abs(parseInt(opt.x))+'_'+ma.abs(parseInt(opt.y))+'_'+String(opt.text).replace(/[^a-zA-Z0-9]+/g,'_')+'_'+obj.canvas.id;if(!ca.rgraph_domtext_wrapper){var wrapper=document.createElement('div');wrapper.id=ca.id+'_rgraph_domtext_wrapper';wrapper.className='rgraph_domtext_wrapper';wrapper.style.overflow=obj.properties['chart.text.accessible.overflow']!=false&&obj.properties['chart.text.accessible.overflow']!='hidden'?'visible':'hidden';wrapper.style.width=ca.offsetWidth+'px';wrapper.style.height=ca.offsetHeight+'px';wrapper.style.cssFloat=ca.style.cssFloat;wrapper.style.display=ca.style.display||'inline-block';wrapper.style.position=ca.style.position||'relative';wrapper.style.left=ca.style.left;wrapper.style.top=ca.style.top;wrapper.style.width=ca.width+'px';wrapper.style.height=ca.height+'px';ca.style.position='absolute';ca.style.left=0;ca.style.top=0;ca.style.display='inline';ca.style.cssFloat='none';if((obj.type==='bar'||obj.type==='bipolar'||obj.type==='hbar')&&obj.properties['chart.variant']==='3d'){wrapper.style.transform='skewY(5.7deg)';}
+ca.parentNode.insertBefore(wrapper,ca);ca.parentNode.removeChild(ca);wrapper.appendChild(ca);ca.rgraph_domtext_wrapper=wrapper;}else{wrapper=ca.rgraph_domtext_wrapper;}
+var defaults={size:12,font:'Arial',italic:'normal',bold:'normal',valign:'bottom',halign:'left',marker:true,color:co.fillStyle,bounding:{enabled:false,fill:'rgba(255,255,255,0.7)',stroke:'#666'}}
+opt.text=String(opt.text).replace(/\r?\n/g,'[[RETURN]]');if(typeof RG.text2.domNodeCache==='undefined'){RG.text2.domNodeCache=new Array();}
+if(typeof RG.text2.domNodeCache[obj.id]==='undefined'){RG.text2.domNodeCache[obj.id]=new Array();}
+if(typeof RG.text2.domNodeDimensionCache==='undefined'){RG.text2.domNodeDimensionCache=new Array();}
+if(typeof RG.text2.domNodeDimensionCache[obj.id]==='undefined'){RG.text2.domNodeDimensionCache[obj.id]=new Array();}
+if(!RG.text2.domNodeCache[obj.id]||!RG.text2.domNodeCache[obj.id][cacheKey]){var span=document.createElement('span');span.style.position='absolute';span.style.display='inline';span.style.left=(opt.x*(parseInt(ca.offsetWidth)/parseInt(ca.width)))+'px';span.style.top=(opt.y*(parseInt(ca.offsetHeight)/parseInt(ca.height)))+'px';span.style.color=opt.color||defaults.color;span.style.fontFamily=opt.font||defaults.font;span.style.fontWeight=opt.bold?'bold':defaults.bold;span.style.fontStyle=opt.italic?'italic':defaults.italic;span.style.fontSize=(opt.size||defaults.size)+'pt';span.style.whiteSpace='nowrap';span.tag=opt.tag;span.style.textShadow='{1}px {2}px {3}px {4}'.format(co.shadowOffsetX,co.shadowOffsetY,co.shadowBlur,co.shadowColor);if(opt.bounding){span.style.border='1px solid '+(opt['bounding.stroke']||defaults.bounding.stroke);span.style.backgroundColor=opt['bounding.fill']||defaults.bounding.fill;}
+if((typeof obj.properties['chart.text.accessible.pointerevents']==='undefined'||obj.properties['chart.text.accessible.pointerevents'])&&obj.properties['chart.text.accessible.pointerevents']!=='none'){span.style.pointerEvents='auto';}else{span.style.pointerEvents='none';}
+span.style.padding=opt.bounding?'2px':null;span.__text__=opt.text
+span.innerHTML=opt.text.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;');span.innerHTML=span.innerHTML.replace(/\[\[RETURN\]\]/g,'<br />');wrapper.appendChild(span);opt.halign=opt.halign||'left';opt.valign=opt.valign||'bottom';if(opt.halign==='right'){span.style.left=parseFloat(span.style.left)-span.offsetWidth+'px';span.style.textAlign='right';}else if(opt.halign==='center'){span.style.left=parseFloat(span.style.left)-(span.offsetWidth/2)+'px';span.style.textAlign='center';}
+if(opt.valign==='top'){}else if(opt.valign==='center'){span.style.top=parseFloat(span.style.top)-(span.offsetHeight/2)+'px';}else{span.style.top=parseFloat(span.style.top)-span.offsetHeight+'px';}
+var offsetWidth=parseFloat(span.offsetWidth),offsetHeight=parseFloat(span.offsetHeight),top=parseFloat(span.style.top),left=parseFloat(span.style.left);RG.text2.domNodeCache[obj.id][cacheKey]=span;RG.text2.domNodeDimensionCache[obj.id][cacheKey]={left:left,top:top,width:offsetWidth,height:offsetHeight};span.id=cacheKey;}else{span=RG.text2.domNodeCache[obj.id][cacheKey];span.style.display='inline';var offsetWidth=RG.text2.domNodeDimensionCache[obj.id][cacheKey].width,offsetHeight=RG.text2.domNodeDimensionCache[obj.id][cacheKey].height,top=RG.text2.domNodeDimensionCache[obj.id][cacheKey].top,left=RG.text2.domNodeDimensionCache[obj.id][cacheKey].left;}
+if(opt.marker){RG.path2(context,'b m % % l % % m % % l % % s',opt.x-5,opt.y,opt.x+5,opt.y,opt.x,opt.y-5,opt.x,opt.y+5);}
+if(obj.type==='drawing.text'){if(obj.properties['chart.events.mousemove']){span.addEventListener('mousemove',function(e){(obj.properties['chart.events.mousemove'])(e,obj);},false);}
+if(obj.properties['chart.events.click']){span.addEventListener('click',function(e){(obj.properties['chart.events.click'])(e,obj);},false);}
+if(obj.properties['chart.tooltips']){span.addEventListener(obj.properties['chart.tooltips.event'].indexOf('mousemove')!==-1?'mousemove':'click',function(e)
+{if(!RG.Registry.get('chart.tooltip')||RG.Registry.get('chart.tooltip').__index__!==0||RG.Registry.get('chart.tooltip').__object__.uid!=obj.uid){RG.hideTooltip();RG.redraw();RG.tooltip(obj,obj.properties['chart.tooltips'][0],opt.x,opt.y,0,e);}},false);}}
+var ret={};ret.x=left;ret.y=top;ret.width=offsetWidth;ret.height=offsetHeight;ret.object=obj;ret.text=opt.text;ret.tag=opt.tag;RG.text2.domNodeCache.reset=function()
+{if(arguments[0]){var nodes=RG.text2.domNodeCache[arguments[0].id];for(j in nodes){var node=RG.text2.domNodeCache[arguments[0].id][j];if(node&&node.parentNode){node.parentNode.removeChild(node);}}}else{for(i in RG.text2.domNodeCache){for(j in RG.text2.domNodeCache[i]){if(RG.text2.domNodeCache[i][j]&&RG.text2.domNodeCache[i][j].parentNode){RG.text2.domNodeCache[i][j].parentNode.removeChild(RG.text2.domNodeCache[i][j]);}}}}};RG.text2.find=function(opt)
+{var span,nodes=[];var id=typeof opt.id==='string'?opt.id:opt.object.id;for(i in RG.text2.domNodeCache[id]){span=RG.text2.domNodeCache[id][i];if(typeof opt.tag==='string'&&opt.tag===span.tag){nodes.push(span);continue;}
+if(typeof opt.tag==='object'&&opt.tag.constructor.toString().indexOf('RegExp')){var regexp=new RegExp(opt.tag);if(regexp.test(span.tag)){nodes.push(span);continue;}}
+if(typeof opt.text==='string'&&opt.text===span.__text__){nodes.push(span);continue;}
+if(typeof opt.text==='object'&&opt.text.constructor.toString().indexOf('RegExp')){var regexp=new RegExp(opt.text);if(regexp.test(span.__text__)){nodes.push(span);continue;}}}
+return nodes;};ret.node=span;if(obj&&obj.isRGraph&&obj.coordsText){obj.coordsText.push(ret);}
+return ret;}
+if(obj&&obj.isRGraph){var obj=obj;var co=obj.context;var ca=obj.canvas;}else if(typeof obj=='string'){var ca=document.getElementById(obj);var co=ca.getContext('2d');var obj=ca.__object__;}else if(typeof obj.getContext==='function'){var ca=obj;var co=ca.getContext('2d');var obj=ca.__object__;}else if(obj.toString().indexOf('CanvasRenderingContext2D')!=-1||RGraph.ISIE8&&obj.moveTo){var co=obj;var ca=obj.canvas;var obj=ca.__object__;}else if(RG.ISOLD&&obj.fillText){var co=obj;var ca=obj.canvas;var obj=ca.__object__;}
+if(typeof opt.boundingFill==='string')opt['bounding.fill']=opt.boundingFill;if(typeof opt.boundingStroke==='string')opt['bounding.stroke']=opt.boundingStroke;if(obj&&obj.properties['chart.text.accessible']&&opt.accessible!==false){return domtext();}
+var x=opt.x,y=opt.y,originalX=x,originalY=y,text=opt.text,text_multiline=typeof text==='string'?text.split(/\r?\n/g):'',numlines=text_multiline.length,font=opt.font?opt.font:'Arial',size=opt.size?opt.size:10,size_pixels=size*1.5,bold=opt.bold,italic=opt.italic,halign=opt.halign?opt.halign:'left',valign=opt.valign?opt.valign:'bottom',tag=typeof opt.tag=='string'&&opt.tag.length>0?opt.tag:'',marker=opt.marker,angle=opt.angle||0
+var bounding=opt.bounding,bounding_stroke=opt['bounding.stroke']?opt['bounding.stroke']:'black',bounding_fill=opt['bounding.fill']?opt['bounding.fill']:'rgba(255,255,255,0.7)',bounding_shadow=opt['bounding.shadow'],bounding_shadow_color=opt['bounding.shadow.color']||'#ccc',bounding_shadow_blur=opt['bounding.shadow.blur']||3,bounding_shadow_offsetx=opt['bounding.shadow.offsetx']||3,bounding_shadow_offsety=opt['bounding.shadow.offsety']||3,bounding_linewidth=opt['bounding.linewidth']||1;var ret={};if(typeof opt.color==='string'){var orig_fillstyle=co.fillStyle;co.fillStyle=opt.color;}
+if(typeof text=='number'){text=String(text);}
+if(typeof text!=='string'){return;}
+if(angle!=0){co.save();co.translate(x,y);co.rotate((ma.PI/180)*angle)
+x=0;y=0;}
+co.font=(opt.italic?'italic ':'')+(opt.bold?'bold ':'')+size+'pt '+font;var width=0;for(var i=0;i<numlines;++i){width=ma.max(width,co.measureText(text_multiline[i]).width);}
+var height=size_pixels*numlines;if(opt.marker){var marker_size=10;var strokestyle=co.strokeStyle;co.beginPath();co.strokeStyle='red';co.moveTo(x,y-marker_size);co.lineTo(x,y+marker_size);co.moveTo(x-marker_size,y);co.lineTo(x+marker_size,y);co.stroke();co.strokeStyle=strokestyle;}
+if(halign=='center'){co.textAlign='center';var boundingX=x-2-(width/2);}else if(halign=='right'){co.textAlign='right';var boundingX=x-2-width;}else{co.textAlign='left';var boundingX=x-2;}
+if(valign=='center'){co.textBaseline='middle';y-=1;y-=((numlines-1)/2)*size_pixels;var boundingY=y-(size_pixels/2)-2;}else if(valign=='top'){co.textBaseline='top';var boundingY=y-2;}else{co.textBaseline='bottom';if(numlines>1){y-=((numlines-1)*size_pixels);}
+var boundingY=y-size_pixels-2;}
+var boundingW=width+4;var boundingH=height+4;if(bounding){var pre_bounding_linewidth=co.lineWidth;var pre_bounding_strokestyle=co.strokeStyle;var pre_bounding_fillstyle=co.fillStyle;var pre_bounding_shadowcolor=co.shadowColor;var pre_bounding_shadowblur=co.shadowBlur;var pre_bounding_shadowoffsetx=co.shadowOffsetX;var pre_bounding_shadowoffsety=co.shadowOffsetY;co.lineWidth=bounding_linewidth;co.strokeStyle=bounding_stroke;co.fillStyle=bounding_fill;if(bounding_shadow){co.shadowColor=bounding_shadow_color;co.shadowBlur=bounding_shadow_blur;co.shadowOffsetX=bounding_shadow_offsetx;co.shadowOffsetY=bounding_shadow_offsety;}
+co.strokeRect(boundingX,boundingY,boundingW,boundingH);co.fillRect(boundingX,boundingY,boundingW,boundingH);co.lineWidth=pre_bounding_linewidth;co.strokeStyle=pre_bounding_strokestyle;co.fillStyle=pre_bounding_fillstyle;co.shadowColor=pre_bounding_shadowcolor
+co.shadowBlur=pre_bounding_shadowblur
+co.shadowOffsetX=pre_bounding_shadowoffsetx
+co.shadowOffsetY=pre_bounding_shadowoffsety}
+if(numlines>1){for(var i=0;i<numlines;++i){co.fillText(text_multiline[i],x,y+(size_pixels*i));}}else{co.fillText(text,x+0.5,y+0.5);}
+if(angle!=0){if(angle==90){if(halign=='left'){if(valign=='bottom'){boundingX=originalX-2;boundingY=originalY-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='center'){boundingX=originalX-(height/2)-2;boundingY=originalY-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='top'){boundingX=originalX-height-2;boundingY=originalY-2;boundingW=height+4;boundingH=width+4;}}else if(halign=='center'){if(valign=='bottom'){boundingX=originalX-2;boundingY=originalY-(width/2)-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='center'){boundingX=originalX-(height/2)-2;boundingY=originalY-(width/2)-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='top'){boundingX=originalX-height-2;boundingY=originalY-(width/2)-2;boundingW=height+4;boundingH=width+4;}}else if(halign=='right'){if(valign=='bottom'){boundingX=originalX-2;boundingY=originalY-width-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='center'){boundingX=originalX-(height/2)-2;boundingY=originalY-width-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='top'){boundingX=originalX-height-2;boundingY=originalY-width-2;boundingW=height+4;boundingH=width+4;}}}else if(angle==180){if(halign=='left'){if(valign=='bottom'){boundingX=originalX-width-2;boundingY=originalY-2;boundingW=width+4;boundingH=height+4;}
+if(valign=='center'){boundingX=originalX-width-2;boundingY=originalY-(height/2)-2;boundingW=width+4;boundingH=height+4;}
+if(valign=='top'){boundingX=originalX-width-2;boundingY=originalY-height-2;boundingW=width+4;boundingH=height+4;}}else if(halign=='center'){if(valign=='bottom'){boundingX=originalX-(width/2)-2;boundingY=originalY-2;boundingW=width+4;boundingH=height+4;}
+if(valign=='center'){boundingX=originalX-(width/2)-2;boundingY=originalY-(height/2)-2;boundingW=width+4;boundingH=height+4;}
+if(valign=='top'){boundingX=originalX-(width/2)-2;boundingY=originalY-height-2;boundingW=width+4;boundingH=height+4;}}else if(halign=='right'){if(valign=='bottom'){boundingX=originalX-2;boundingY=originalY-2;boundingW=width+4;boundingH=height+4;}
+if(valign=='center'){boundingX=originalX-2;boundingY=originalY-(height/2)-2;boundingW=width+4;boundingH=height+4;}
+if(valign=='top'){boundingX=originalX-2;boundingY=originalY-height-2;boundingW=width+4;boundingH=height+4;}}}else if(angle==270){if(halign=='left'){if(valign=='bottom'){boundingX=originalX-height-2;boundingY=originalY-width-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='center'){boundingX=originalX-(height/2)-4;boundingY=originalY-width-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='top'){boundingX=originalX-2;boundingY=originalY-width-2;boundingW=height+4;boundingH=width+4;}}else if(halign=='center'){if(valign=='bottom'){boundingX=originalX-height-2;boundingY=originalY-(width/2)-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='center'){boundingX=originalX-(height/2)-4;boundingY=originalY-(width/2)-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='top'){boundingX=originalX-2;boundingY=originalY-(width/2)-2;boundingW=height+4;boundingH=width+4;}}else if(halign=='right'){if(valign=='bottom'){boundingX=originalX-height-2;boundingY=originalY-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='center'){boundingX=originalX-(height/2)-2;boundingY=originalY-2;boundingW=height+4;boundingH=width+4;}
+if(valign=='top'){boundingX=originalX-2;boundingY=originalY-2;boundingW=height+4;boundingH=width+4;}}}
+co.restore();}
+co.textBaseline='alphabetic';co.textAlign='left';ret.x=boundingX;ret.y=boundingY;ret.width=boundingW;ret.height=boundingH
+ret.object=obj;ret.text=text;ret.tag=tag;if(obj&&obj.isRGraph&&obj.coordsText){obj.coordsText.push(ret);}
+if(typeof orig_fillstyle==='string'){co.fillStyle=orig_fillstyle;}
+return ret;};RG.sequentialIndexToGrouped=function(index,data)
+{var group=0;var grouped_index=0;while(--index>=0){if(RG.is_null(data[group])){group++;grouped_index=0;continue;}
+if(typeof data[group]=='number'){group++
+grouped_index=0;continue;}
+grouped_index++;if(grouped_index>=data[group].length){group++;grouped_index=0;}}
+return[group,grouped_index];};RG.Highlight.rect=RG.Highlight.Rect=function(obj,shape)
+{var ca=obj.canvas;var co=obj.context;var prop=obj.properties;if(prop['chart.tooltips.highlight']){co.lineWidth=1;co.beginPath();co.strokeStyle=prop['chart.highlight.stroke'];co.fillStyle=prop['chart.highlight.fill'];co.rect(shape['x'],shape['y'],shape['width'],shape['height']);co.stroke();co.fill();}};RG.Highlight.point=RG.Highlight.Point=function(obj,shape)
+{var prop=obj.properties;var ca=obj.canvas;var co=obj.context;if(prop['chart.tooltips.highlight']){co.beginPath();co.strokeStyle=prop['chart.highlight.stroke'];co.fillStyle=prop['chart.highlight.fill'];var radius=prop['chart.highlight.point.radius']||2;co.arc(shape['x'],shape['y'],radius,0,RG.TWOPI,0);co.stroke();co.fill();}};RG.parseDate=function(str)
+{str=RG.trim(str);if(str==='now'){str=(new Date()).toString();}
+if(str.match(/^(\d\d)(?:-|\/)(\d\d)(?:-|\/)(\d\d\d\d)(.*)$/)){str='{1}/{2}/{3}{4}'.format(RegExp.$3,RegExp.$2,RegExp.$1,RegExp.$4);}
+if(str.match(/^(\d\d\d\d)(-|\/)(\d\d)(-|\/)(\d\d)( |T)(\d\d):(\d\d):(\d\d)$/)){str=RegExp.$1+'-'+RegExp.$3+'-'+RegExp.$5+'T'+RegExp.$7+':'+RegExp.$8+':'+RegExp.$9;}
+if(str.match(/^\d\d\d\d-\d\d-\d\d$/)){str=str.replace(/-/g,'/');}
+if(str.match(/^\d\d:\d\d:\d\d$/)){var dateObj=new Date();var date=dateObj.getDate();var month=dateObj.getMonth()+1;var year=dateObj.getFullYear();if(String(month).length===1)month='0'+month;if(String(date).length===1)date='0'+date;str=(year+'/'+month+'/'+date)+' '+str;}
+return Date.parse(str);};RG.resetColorsToOriginalValues=function(obj)
+{if(obj.original_colors){for(var j in obj.original_colors){if(typeof j==='string'&&j.substr(0,6)==='chart.'){obj.properties[j]=RG.arrayClone(obj.original_colors[j]);}}}
+if(typeof obj.resetColorsToOriginalValues==='function'){obj.resetColorsToOriginalValues();}
+obj.colorsParsed=false;};RG.linearGradient=RG.LinearGradient=function(obj,x1,y1,x2,y2,color1,color2)
+{var gradient=obj.context.createLinearGradient(x1,y1,x2,y2);var numColors=arguments.length-5;for(var i=5;i<arguments.length;++i){var color=arguments[i];var stop=(i-5)/(numColors-1);gradient.addColorStop(stop,color);}
+return gradient;};RG.radialGradient=RG.RadialGradient=function(obj,x1,y1,r1,x2,y2,r2,color1,color2)
+{var gradient=obj.context.createRadialGradient(x1,y1,r1,x2,y2,r2);var numColors=arguments.length-7;for(var i=7;i<arguments.length;++i){var color=arguments[i];var stop=(i-7)/(numColors-1);gradient.addColorStop(stop,color);}
+return gradient;};RG.addEventListener=RG.AddEventListener=function(id,e,func)
+{var type=arguments[3]?arguments[3]:'unknown';RG.Registry.get('chart.event.handlers').push([id,e,func,type]);};RG.clearEventListeners=RG.ClearEventListeners=function(id)
+{if(id&&id=='window'){window.removeEventListener('mousedown',window.__rgraph_mousedown_event_listener_installed__,false);window.removeEventListener('mouseup',window.__rgraph_mouseup_event_listener_installed__,false);}else{var canvas=document.getElementById(id);canvas.removeEventListener('mouseup',canvas.__rgraph_mouseup_event_listener_installed__,false);canvas.removeEventListener('mousemove',canvas.__rgraph_mousemove_event_listener_installed__,false);canvas.removeEventListener('mousedown',canvas.__rgraph_mousedown_event_listener_installed__,false);canvas.removeEventListener('click',canvas.__rgraph_click_event_listener_installed__,false);}};RG.hidePalette=RG.HidePalette=function()
+{var div=RG.Registry.get('palette');if(typeof div=='object'&&div){div.style.visibility='hidden';div.style.display='none';RG.Registry.set('palette',null);}};RG.random=function(min,max)
+{var dp=arguments[2]?arguments[2]:0;var r=ma.random();return Number((((max-min)*r)+min).toFixed(dp));};RG.arrayRand=RG.arrayRandom=RG.random.array=function(num,min,max)
+{for(var i=0,arr=[];i<num;i+=1){arr.push(RG.random(min,max,arguments[3]));}
+return arr;};RG.noShadow=RG.NoShadow=function(obj)
+{var co=obj.context;co.shadowColor='rgba(0,0,0,0)';co.shadowBlur=0;co.shadowOffsetX=0;co.shadowOffsetY=0;};RG.setShadow=RG.SetShadow=function(obj,color,offsetx,offsety,blur)
+{var co=obj.context;co.shadowColor=color;co.shadowOffsetX=offsetx;co.shadowOffsetY=offsety;co.shadowBlur=blur;};RG.Registry.set=RG.Registry.Set=function(name,value)
+{name=name.replace(/([A-Z])/g,function(str)
+{return'.'+String(RegExp.$1).toLowerCase();});if(name.substr(0,6)!=='chart.'){name='chart.'+name;}
+RG.Registry.store[name]=value;return value;};RG.Registry.get=RG.Registry.Get=function(name)
+{name=name.replace(/([A-Z])/g,function(str)
+{return'.'+String(RegExp.$1).toLowerCase();});if(name.substr(0,6)!=='chart.'){name='chart.'+name;}
+return RG.Registry.store[name];};RG.degrees2Radians=function(deg)
+{return deg*(RG.PI/180);};RG.log=function(n,base)
+{return ma.log(n)/(base?ma.log(base):1);};RG.isArray=RG.is_array=function(obj)
+{if(obj&&obj.constructor){var pos=obj.constructor.toString().indexOf('Array');}else{return false;}
+return obj!=null&&typeof pos==='number'&&pos>0&&pos<20;};RG.trim=function(str)
+{return RG.ltrim(RG.rtrim(str));};RG.ltrim=function(str)
+{return str.replace(/^(\s|\0)+/,'');};RG.rtrim=function(str)
+{return str.replace(/(\s|\0)+$/,'');};RG.isNull=RG.is_null=function(arg)
+{if(arg==null||typeof arg==='object'&&!arg){return true;}
+return false;};RG.async=RG.Async=function(func)
+{return setTimeout(func,arguments[1]?arguments[1]:1);};RG.reset=RG.Reset=function(ca)
+{ca.width=ca.width;RG.ObjectRegistry.clear(ca);ca.__rgraph_aa_translated__=false;if(RG.text2.domNodeCache&&RG.text2.domNodeCache.reset){RG.text2.domNodeCache.reset(ca);}
+if(!RG.text2.domNodeCache){RG.text2.domNodeCache=[];}
+if(!RG.text2.domNodeDimensionCache){RG.text2.domNodeDimensionCache=[];}
+RG.text2.domNodeCache[ca.id]=[];RG.text2.domNodeDimensionCache[ca.id]=[];};RG.att=function(ca){}
+RG.getCanvasTag=function(id)
+{id=typeof id==='object'?id.id:id;var canvas=doc.getElementById(id);return[id,canvas];};RG.Effects.updateCanvas=RG.Effects.UpdateCanvas=function(func)
+{win.requestAnimationFrame=win.requestAnimationFrame||win.webkitRequestAnimationFrame||win.msRequestAnimationFrame||win.mozRequestAnimationFrame||(function(func){setTimeout(func,16.666);});win.requestAnimationFrame(func);};RG.Effects.getEasingMultiplier=function(frames,frame)
+{return ma.pow(ma.sin((frame/frames)*RG.HALFPI),3);};RG.stringsToNumbers=function(str)
+{var sep=arguments[1]||',';if(typeof str==='number'){return str;}
+if(typeof str==='string'){if(str.indexOf(sep)!=-1){str=str.split(sep);}else{str=parseFloat(str);}}
+if(typeof str==='object'){for(var i=0,len=str.length;i<len;i+=1){str[i]=parseFloat(str[i]);}}
+return str;};RG.cachedDraw=function(obj,id,func)
+{if(!RG.cache[id]){RG.cache[id]={};RG.cache[id].object=obj;RG.cache[id].canvas=document.createElement('canvas');RG.cache[id].canvas.setAttribute('width',obj.canvas.width);RG.cache[id].canvas.setAttribute('height',obj.canvas.height);RG.cache[id].canvas.setAttribute('id','background_cached_canvas'+obj.canvas.id);RG.cache[id].canvas.__object__=obj;RG.cache[id].context=RG.cache[id].canvas.getContext('2d');RG.cache[id].context.translate(0.5,0.5);func(obj,RG.cache[id].canvas,RG.cache[id].context);}
+obj.context.drawImage(RG.cache[id].canvas,-0.5,-0.5);};RG.parseObjectStyleConfig=function(obj,config)
+{var recurse=function(obj,config,name,settings)
+{var i;for(key in config){if(key.match(/^exec[0-9]*$/)){(config[key])(obj,settings);continue;}
+var isObject=false;var isArray=false;var value=config[key];while(key.match(/([A-Z])/)){key=key.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
+if(!RG.isNull(value)&&value.constructor){isObject=value.constructor.toString().indexOf('Object')>0;isArray=value.constructor.toString().indexOf('Array')>0;}
+if(isObject&&!isArray){recurse(obj,config[key],name+'.'+key,settings);}else if(key==='self'){settings[name]=value;}else{settings[name+'.'+key]=value;}}
+return settings;};var settings=recurse(obj,config,'chart',{});for(key in settings){if(typeof key==='string'){obj.set(key,settings[key]);}}};RG.path2=function(co,p)
+{var args=arguments;if(typeof p==='string'){p=splitstring(p);}
+RG.path2.last=RG.arrayClone(p);for(var i=0,len=p.length;i<len;i+=1){switch(p[i]){case'b':co.beginPath();break;case'c':co.closePath();break;case'm':co.moveTo(parseFloat(p[i+1]),parseFloat(p[i+2]));i+=2;break;case'l':co.lineTo(parseFloat(p[i+1]),parseFloat(p[i+2]));i+=2;break;case's':if(p[i+1])co.strokeStyle=p[i+1];co.stroke();i++;break;case'f':if(p[i+1]){co.fillStyle=p[i+1];}co.fill();i++;break;case'qc':co.quadraticCurveTo(parseFloat(p[i+1]),parseFloat(p[i+2]),parseFloat(p[i+3]),parseFloat(p[i+4]));i+=4;break;case'bc':co.bezierCurveTo(parseFloat(p[i+1]),parseFloat(p[i+2]),parseFloat(p[i+3]),parseFloat(p[i+4]),parseFloat(p[i+5]),parseFloat(p[i+6]));i+=6;break;case'r':co.rect(parseFloat(p[i+1]),parseFloat(p[i+2]),parseFloat(p[i+3]),parseFloat(p[i+4]));i+=4;break;case'a':co.arc(parseFloat(p[i+1]),parseFloat(p[i+2]),parseFloat(p[i+3]),parseFloat(p[i+4]),parseFloat(p[i+5]),p[i+6]==='true'||p[i+6]===true||p[i+6]===1||p[i+6]==='1'?true:false);i+=6;break;case'at':co.arcTo(parseFloat(p[i+1]),parseFloat(p[i+2]),parseFloat(p[i+3]),parseFloat(p[i+4]),parseFloat(p[i+5]));i+=5;break;case'lw':co.lineWidth=parseFloat(p[i+1]);i++;break;case'e':co.ellipse(parseFloat(p[i+1]),parseFloat(p[i+2]),parseFloat(p[i+3]),parseFloat(p[i+4]),parseFloat(p[i+5]),parseFloat(p[i+6]),parseFloat(p[i+7]),p[i+8]==='true'?true:false);i+=8;break;case'lj':co.lineJoin=p[i+1];i++;break;case'lc':co.lineCap=p[i+1];i++;break;case'sc':co.shadowColor=p[i+1];i++;break;case'sb':co.shadowBlur=parseFloat(p[i+1]);i++;break;case'sx':co.shadowOffsetX=parseFloat(p[i+1]);i++;break;case'sy':co.shadowOffsetY=parseFloat(p[i+1]);i++;break;case'fs':co.fillStyle=p[i+1];i++;break;case'ss':co.strokeStyle=p[i+1];i++;break;case'fr':co.fillRect(parseFloat(p[i+1]),parseFloat(p[i+2]),parseFloat(p[i+3]),parseFloat(p[i+4]));i+=4;break;case'sr':co.strokeRect(parseFloat(p[i+1]),parseFloat(p[i+2]),parseFloat(p[i+3]),parseFloat(p[i+4]));i+=4;break;case'cl':co.clip();break;case'sa':co.save();break;case'rs':co.restore();break;case'tr':co.translate(parseFloat(p[i+1]),parseFloat(p[i+2]));i+=2;break;case'sl':co.scale(parseFloat(p[i+1]),parseFloat(p[i+2]));i+=2;break;case'ro':co.rotate(parseFloat(p[i+1]));i++;break;case'tf':co.transform(parseFloat(p[i+1]),parseFloat(p[i+2]),parseFloat(p[i+3]),parseFloat(p[i+4]),parseFloat(p[i+5]),parseFloat(p[i+6]));i+=6;break;case'stf':co.setTransform(parseFloat(p[i+1]),parseFloat(p[i+2]),parseFloat(p[i+3]),parseFloat(p[i+4]),parseFloat(p[i+5]),parseFloat(p[i+6]));i+=6;break;case'cr':co.clearRect(parseFloat(p[i+1]),parseFloat(p[i+2]),parseFloat(p[i+3]),parseFloat(p[i+4]));i+=4;break;case'ld':var parts=p[i+1];co.setLineDash(parts);i+=1;break;case'ldo':co.lineDashOffset=p[i+1];i++;break;case'fo':co.font=p[i+1];i++;break;case'ft':co.fillText(p[i+1],parseFloat(p[i+2]),parseFloat(p[i+3]));i+=3;break;case'st':co.strokeText(p[i+1],parseFloat(p[i+2]),parseFloat(p[i+3]));i+=3;break;case'ta':co.textAlign=p[i+1];i++;break;case'tbl':co.textBaseline=p[i+1];i++;break;case'ga':co.globalAlpha=parseFloat(p[i+1]);i++;break;case'gco':co.globalCompositeOperation=p[i+1];i++;break;case'fu':(p[i+1])(co.canvas.__object__);i++;break;case'':break;default:alert('[ERROR] Unknown option: '+p[i]);}}
+function splitstring(p)
+{var ret=[],buffer='',inquote=false,quote='',substitutionIndex=2;for(var i=0;i<p.length;i+=1){var chr=p[i],isWS=chr.match(/ /);if(isWS){if(!inquote){if(buffer[0]==='"'||buffer[0]==="'"){buffer=buffer.substr(1,buffer.length-2);}
+if(buffer.trim()==='%'&&typeof args[substitutionIndex]!=='undefined'){buffer=args[substitutionIndex++];}
+ret.push(buffer);buffer='';}else{buffer+=chr;}}else{if(chr==="'"||chr==='"'){inquote=!inquote;}
+buffer+=chr;}}
+if(buffer.trim()==='%'&&args[substitutionIndex]){buffer=args[substitutionIndex++];}
+ret.push(buffer);return ret;}};RG.wrap=function(){};})(window,document);window.$p=function(v)
+{RGraph.pr(arguments[0],arguments[1],arguments[3]);};window.$a=function(v)
+{alert(v);};window.$cl=function(v)
+{return console.log(v);};if(!String.prototype.format){String.prototype.format=function()
+{var args=arguments;return this.replace(/{(\d+)}/g,function(str,idx)
+{return typeof args[idx-1]!=='undefined'?args[idx-1]:str;});};}
\ No newline at end of file
diff --git a/src/scripts/rgraph.common.dynamic.js b/src/scripts/rgraph.common.dynamic.js
new file mode 100644
index 0000000..fbdc151
--- /dev/null
+++ b/src/scripts/rgraph.common.dynamic.js
@@ -0,0 +1,87 @@
+
+RGraph=window.RGraph||{isRGraph:true};(function(win,doc,undefined)
+{var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.installWindowMousedownListener=RG.InstallWindowMousedownListener=function(obj)
+{if(!RG.window_mousedown_event_listener){RG.window_mousedown_event_listener=function(e)
+{if(navigator.userAgent.indexOf('Firefox')>=0)win.event=e;e=RG.fixEventObject(e);if(RG.HideTooltip&&RG.Registry.Get('chart.tooltip')){RG.clear(RG.Registry.Get('chart.tooltip').__canvas__);RG.redraw();RG.hideTooltip();}};win.addEventListener('mousedown',RG.window_mousedown_event_listener,false);}};RG.installWindowMouseupListener=RG.InstallWindowMouseupListener=function(obj)
+{if(!RG.window_mouseup_event_listener){RG.window_mouseup_event_listener=function(e)
+{if(navigator.userAgent.indexOf('Firefox')>=0)win.event=e;e=RG.fixEventObject(e);if(RG.annotating_window_onmouseup){RG.annotating_window_onmouseup(e);return;}
+if(RG.Registry.Get('chart.adjusting')||RG.Registry.Get('chart.adjusting.gantt')){var obj=RG.Registry.Get('chart.adjusting');if(obj&&obj.type==='line'){obj.data_arr=RG.arrayLinearize(obj.data);}
+RG.fireCustomEvent(RG.Registry.Get('chart.adjusting'),'onadjustend');}
+RG.Registry.set('chart.adjusting',null);RG.Registry.set('chart.adjusting.shape',null);RG.Registry.set('chart.adjusting.gantt',null);var tags=document.getElementsByTagName('canvas');for(var i=0;i<tags.length;++i){if(tags[i].__object__&&tags[i].__object__.isRGraph){if(!tags[i].__object__.get('chart.annotatable')){if(!tags[i].__rgraph_trace_cover__&&!noredraw){RG.clear(tags[i]);}else{var noredraw=true;}}}}
+if(!noredraw){RG.redraw();}};win.addEventListener('mouseup',RG.window_mouseup_event_listener,false);}};RG.installCanvasMouseupListener=RG.InstallCanvasMouseupListener=function(obj)
+{if(!obj.canvas.rgraph_mouseup_event_listener){obj.canvas.rgraph_mouseup_event_listener=function(e)
+{if(navigator.userAgent.indexOf('Firefox')>=0)window.event=e;e=RG.fixEventObject(e);var objects=RG.ObjectRegistry.getObjectsByXY(e);if(objects){for(var i=0,len=objects.length;i<len;i+=1){var obj=objects[i],id=objects[i].id;var link=obj.Get('link');if(obj.type=='drawing.text'&&typeof link==='string'){var link_target=obj.get('link.target');var link_options=obj.get('link.options');window.open(link,link_target?link_target:null,link_options);}
+if(!RG.isNull(obj)&&RG.tooltip){var shape=obj.getShape(e);if(shape&&shape['tooltip']){var text=shape['tooltip'];if(text){var type=shape['object'].type;RG.clear(obj.canvas);RG.redraw();RG.Registry.set('chart.tooltip.shape',shape);RG.tooltip(obj,text,0,0,shape['index'],e);obj.highlight(shape);if(RG.Registry.get('chart.tooltip')){RG.Registry.get('chart.tooltip').__shape__=shape;RG.evaluateCursor(e);}
+e.cancelBubble=true;e.stopPropagation();return false;}}}
+if(RG.Registry.get('chart.adjusting')||RG.Registry.get('chart.adjusting.gantt')){if(obj&&obj.type==='line'){obj.data_arr=RG.arrayLinearize(obj.data);}
+RG.fireCustomEvent(RG.Registry.get('chart.adjusting'),'onadjustend');}
+RG.Registry.set('chart.adjusting',null);RG.Registry.set('chart.adjusting.shape',null);RG.Registry.set('chart.adjusting.gantt',null);if(shape||(obj.overChartArea&&obj.overChartArea(e))){break;}}}};obj.canvas.addEventListener('mouseup',obj.canvas.rgraph_mouseup_event_listener,false);}};RG.installCanvasMousemoveListener=RG.InstallCanvasMousemoveListener=function(obj)
+{if(!obj.canvas.rgraph_mousemove_event_listener){obj.canvas.rgraph_mousemove_event_listener=function(e)
+{if(navigator.userAgent.indexOf('Firefox')>=0)window.event=e;e=RG.fixEventObject(e);var objects=RG.OR.getObjectsByXY(e);var uids=[];if(objects&&objects.length>0){for(var i=0,len=objects.length;i<len;i+=1){var obj=objects[i];var id=obj.id;uids[obj.uid]=true;if(!obj.getShape){continue;}
+var shape=obj.getShape(e);if((!shape&&typeof obj.__mouseover_shape_index__==='number')||(shape&&typeof obj.__mouseover_shape_index__==='number'&&shape.index!==obj.__mouseover_shape_index__)){RG.fireCustomEvent(obj,'onmouseout');}
+if(obj.coords&&obj.coords.key&&obj.coords.key.length){var mouseXY=RG.getMouseXY(e);for(var i=0,overkey=false;i<obj.coords.key.length;++i){if(mouseXY[0]>=obj.coords.key[i][0]&&mouseXY[0]<=(obj.coords.key[i][0]+obj.coords.key[i][2])&&mouseXY[1]>=obj.coords.key[i][1]&&mouseXY[1]<=(obj.coords.key[i][1]+obj.coords.key[i][3])){RG.Registry.set('key-element',obj.coords.key[i]);overkey=true;}
+if(!overkey){RG.Registry.set('key-element',null);}}}
+var func=obj.get('chart.events.mousemove');if(!func&&typeof obj.onmousemove=='function'){var func=obj.onmousemove;}
+if(shape){var index=shape['object'].type=='scatter'?shape['index_adjusted']:shape['index'];if(typeof(obj['$'+index])=='object'&&typeof(obj['$'+index].onmousemove)=='function'){var func2=obj['$'+index].onmousemove;}}
+if(shape&&(typeof(func)=='function'||typeof(func2)=='function'||typeof obj.Get('link')==='string')){if(obj.Get('chart.events.mousemove.revertto')==null){obj.Set('chart.events.mousemove.revertto',e.target.style.cursor);}
+if(typeof(func)=='function')RGraph.custom_events_mousemove_pointer=func(e,shape);if(typeof(func2)=='function')RGraph.custom_events_mousemove_pointer=RGraph.custom_events_mousemove_pointer||func2(e,shape);if(typeof RG.events==='object'&&typeof RG.events[obj.uid]==='object'){for(i in RG.events[obj.uid]){if(typeof i==='string'&&typeof RG.events[obj.uid][i]==='object'&&RG.events[obj.uid][i][1]==='onmousemove'&&typeof RG.events[obj.uid][i][2]==='function'){(RG.events[obj.uid][i][2])(obj);}}}}else if(typeof(obj.Get('chart.events.mousemove.revertto'))=='string'){RG.cursor.push('default');obj.Set('chart.events.mousemove.revertto',null);}
+var func=obj.properties['chart.events.mouseover'];if(!func&&typeof obj.onmouseover==='function'){func=obj.onmouseover;}
+if(shape){var index=shape['object'].type=='scatter'?shape['index_adjusted']:shape['index'];if(typeof(obj['$'+index])=='object'&&typeof(obj['$'+index].onmouseover)=='function'){var func2=obj['$'+index].onmouseover;}}else{obj.__mouseover_shape_index__=null;RG.__mouseover_objects__=[];}
+if(typeof RG.__mouseover_objects__==='undefined'){RG.__mouseover_objects__=[];}
+if(shape){if((obj.__mouseover_shape_index__===shape.index)===false){obj.__mouseover_shape_index__=shape.index;RG.__mouseover_objects__.push(obj);if(func)func(e,shape);if(func2)func2(e,shape);if(typeof RG.events==='object'&&typeof RG.events[obj.uid]==='object'){for(i in RG.events[obj.uid]){if(typeof i==='string'&&typeof RG.events[obj.uid][i]==='object'&&RG.events[obj.uid][i][1]==='onmouseover'&&typeof RG.events[obj.uid][i][2]==='function'){(RG.events[obj.uid][i][2])(obj);}}}}}else{obj.__mouseover_shape_index__=null;RG.__mouseover_objects__=[];}
+var current_tooltip=RG.Registry.get('chart.tooltip');var tooltips=obj.get('chart.tooltips');var tooltips_event=obj.Get('chart.tooltips.event');if(shape&&(tooltips&&tooltips[shape['index']]||shape['tooltip'])&&tooltips_event.indexOf('mousemove')!==-1&&(RG.isNull(current_tooltip)||obj.uid!=current_tooltip.__object__.uid||(current_tooltip.__index__!=shape['index'])||(typeof shape['dataset']==='number'&&shape['dataset']!=current_tooltip.__shape__['dataset']))){RG.clear(obj.canvas);RG.hideTooltip();RG.redraw();obj.canvas.rgraph_mouseup_event_listener(e);return;}
+if(obj&&obj.get('chart.adjustable')){obj.Adjusting_mousemove(e);}
+if(shape||(obj.overChartArea&&obj.overChartArea(e))){break;}}
+var objects=RG.OR.getObjectsByCanvasID(e.target.id);for(var i=0;i<objects.length;++i){if(!uids[objects[i].uid]){objects[i].__mouseover_shape_index__=null;}}}else{var objects=RG.OR.getObjectsByCanvasID(e.target.id);for(var i=0;i<objects.length;i++){if(typeof objects[i].__mouseover_shape_index__==='number'){RG.fireCustomEvent(objects[i],'onmouseout');}
+objects[i].__mouseover_shape_index__=null;}
+RG.__mouseover_objects__=[];}
+if(e.target&&e.target.__object__&&e.target.__object__.get('chart.crosshairs')){RG.drawCrosshairs(e,e.target.__object__);}
+if(e.target.__object__&&e.target.__object__.get('chart.annotatable')&&RG.annotating_canvas_onmousemove){RG.annotating_canvas_onmousemove(e);}
+RG.evaluateCursor(e);};obj.canvas.addEventListener('mousemove',obj.canvas.rgraph_mousemove_event_listener,false);}};RG.installCanvasMousedownListener=RG.InstallCanvasMousedownListener=function(obj)
+{if(!obj.canvas.rgraph_mousedown_event_listener){obj.canvas.rgraph_mousedown_event_listener=function(e)
+{if(navigator.userAgent.indexOf('Firefox')>=0)window.event=e;e=RG.fixEventObject(e);if(e.target.__object__&&e.target.__object__.get('chart.annotatable')&&RG.annotating_canvas_onmousedown){RG.annotating_canvas_onmousedown(e);return;}
+var obj=RG.ObjectRegistry.getObjectByXY(e);if(obj){var id=obj.id;if(obj&&obj.isRGraph&&obj.get('chart.adjustable')){var obj=RG.OR.getObjectByXY(e);if(obj&&obj.isRGraph){switch(obj.type){case'bar':var shape=obj.getShapeByX(e);break;case'gantt':var shape=obj.getShape(e);var data=typeof shape.subindex==='number'?obj.data[shape.index][shape.subindex]:obj.data[shape.index];if(shape){var mouseXY=RG.getMouseXY(e);RG.Registry.set('chart.adjusting.gantt',{index:shape.index,subindex:shape.subindex,object:obj,mousex:mouseXY[0],mousey:mouseXY[1],event:data,event_start:data[0],event_duration:data[1],mode:(mouseXY[0]>(shape['x']+shape['width']-5)?'resize':'move'),shape:shape});}
+break;case'line':var shape=obj.getShape(e);break;case'hbar':var shape=obj.getShapeByY(e);break;default:var shape=null;}
+if(RG.isNull(obj.properties['chart.adjustable.only'])||typeof obj.properties['chart.adjustable.only']==='undefined'||(RG.isArray(obj.properties['chart.adjustable.only'])&&obj.isAdjustable&&obj.isAdjustable(shape))){RG.Registry.set('chart.adjusting.shape',shape);RG.fireCustomEvent(obj,'onadjustbegin');RG.Registry.set('chart.adjusting',obj);RG.clear(obj.canvas);RG.redraw();obj.canvas.rgraph_mousemove_event_listener(e);}}}
+RG.clear(obj.canvas);RG.redraw();}};obj.canvas.addEventListener('mousedown',obj.canvas.rgraph_mousedown_event_listener,false);}};RG.installCanvasClickListener=RG.InstallCanvasClickListener=function(obj)
+{if(!obj.canvas.rgraph_click_event_listener){obj.canvas.rgraph_click_event_listener=function(e)
+{if(navigator.userAgent.indexOf('Firefox')>=0)window.event=e;e=RG.fixEventObject(e);var objects=RG.ObjectRegistry.getObjectsByXY(e);for(var i=0,len=objects.length;i<len;i+=1){var obj=objects[i];var id=obj.id;var shape=obj.getShape(e);var func=obj.get('chart.events.click');if(!func&&typeof(obj.onclick)=='function'){func=obj.onclick;}
+if(shape&&typeof func=='function'){func(e,shape);if(typeof RG.events==='object'&&typeof RG.events[obj.uid]==='object'){for(i in RG.events[obj.uid]){if(typeof i==='string'&&typeof RG.events[obj.uid][i]==='object'&&RG.events[obj.uid][i][1]==='onclick'&&typeof RG.events[obj.uid][i][2]==='function'){(RG.events[obj.uid][i][2])(obj);}}}
+return;}
+var key=RG.Registry.get('key-element');if(key){RG.fireCustomEvent(obj,'onkeyclick');}
+if(shape){var index=shape['object'].type=='scatter'?shape['index_adjusted']:shape['index'];if(typeof(index)=='number'&&obj['$'+index]){var func=obj['$'+index].onclick;if(typeof(func)=='function'){func(e,shape);return;}}}
+if(shape||(obj.overChartArea&&obj.overChartArea(e))){break;}}};obj.canvas.addEventListener('click',obj.canvas.rgraph_click_event_listener,false);}};RG.evaluateCursor=RG.EvaluateCursor=function(e)
+{var obj=null;var mouseXY=RG.getMouseXY(e);var mouseX=mouseXY[0];var mouseY=mouseXY[1];var canvas=e.target;var objects=RG.OR.getObjectsByCanvasID(canvas.id);for(var i=0,len=objects.length;i<len;i+=1){if((objects[i].getShape&&objects[i].getShape(e))||(objects[i].overChartArea&&objects[i].overChartArea(e))){var obj=objects[i];var id=obj.id;}}
+if(!RG.isNull(obj)){if(obj.getShape&&obj.getShape(e)){var shape=obj.getShape(e);if(obj.get('chart.tooltips')){var text=RG.parseTooltipText(obj.get('chart.tooltips'),shape['index']);if(!text&&shape['object'].type=='scatter'&&shape['index_adjusted']){text=RG.parseTooltipText(obj.get('chart.tooltips'),shape['index_adjusted']);}
+if(text){var pointer=true;}}}
+if(!RG.isNull(obj)&&obj.Get('chart.key.interactive')){for(var j=0;j<obj.coords.key.length;++j){if(mouseX>obj.coords.key[j][0]&&mouseX<(obj.coords.key[j][0]+obj.coords.key[j][2])&&mouseY>obj.coords.key[j][1]&&mouseY<(obj.coords.key[j][1]+obj.coords.key[j][3])){var pointer=true;}}}}
+if(RGraph.custom_events_mousemove_pointer){var pointer=true;RGraph.custom_events_mousemove_pointer=false;}
+var objects=RG.OR.objects.byCanvasID;for(var i=0,len=objects.length;i<len;i+=1){if(objects[i]&&objects[i][1].Get('chart.resizable')){var resizable=true;}}
+if(resizable&&mouseX>(e.target.width-32)&&mouseY>(e.target.height-16)){pointer=true;}
+if(pointer){e.target.style.cursor='pointer';}else if(e.target.style.cursor=='pointer'){e.target.style.cursor='default';}else{e.target.style.cursor=null;}
+if(resizable&&mouseX>=(e.target.width-15)&&mouseY>=(e.target.height-15)){e.target.style.cursor='move';}else if(e.target.style.cursor==='move'){e.target.style.cursor='default';}
+if(typeof mouse_over_key=='boolean'&&mouse_over_key){e.target.style.cursor='pointer';}
+if(obj&&obj.type=='line'&&obj.get('chart.adjustable')){if(obj.getShape){var shape=obj.getShape(e);if(shape&&obj.isAdjustable(shape)){e.target.style.cursor='ns-resize';}}else{e.target.style.cursor='default';}}
+if(e.target.__object__&&e.target.__object__.get('chart.annotatable')){e.target.style.cursor='crosshair';}
+if(obj&&obj.type==='drawing.text'&&shape&&typeof obj.get('link')==='string'){e.target.style.cursor='pointer';}};RG.parseTooltipText=function(tooltips,idx)
+{if(!tooltips){return null;}
+if(typeof tooltips=='function'){var text=tooltips(idx);}else if(typeof tooltips=='string'){var text=tooltips;}else if(typeof tooltips=='object'&&typeof tooltips[idx]=='function'){var text=tooltips[idx](idx);}else if(typeof tooltips[idx]=='string'&&tooltips[idx]){var text=tooltips[idx];}else{var text='';}
+if(text=='undefined'){text='';}else if(text=='null'){text='';}
+return RG.getTooltipTextFromDIV?RG.getTooltipTextFromDIV(text):text;};RG.drawCrosshairs=RG.DrawCrosshairs=function(e,obj)
+{var e=RG.fixEventObject(e),width=obj.canvas.width,height=obj.canvas.height,mouseXY=RG.getMouseXY(e),x=mouseXY[0],y=mouseXY[1],gutterLeft=obj.gutterLeft,gutterRight=obj.gutterRight,gutterTop=obj.gutterTop,gutterBottom=obj.gutterBottom,Mathround=Math.round,prop=obj.properties,co=obj.context,ca=obj.canvas
+RG.redrawCanvas(ca);if(x>=gutterLeft&&y>=gutterTop&&x<=(width-gutterRight)&&y<=(height-gutterBottom)){var linewidth=prop['chart.crosshairs.linewidth']?prop['chart.crosshairs.linewidth']:1;co.lineWidth=linewidth?linewidth:1;co.beginPath();co.strokeStyle=prop['chart.crosshairs.color'];if(prop['chart.crosshairs.snap']){var point=null;var dist=null;var len=null;if(obj.type=='line'){for(var i=0;i<obj.coords.length;++i){var length=RG.getHypLength(obj.coords[i][0],obj.coords[i][1],x,y);if(typeof dist!='number'||length<dist){var point=i;var dist=length;}}
+x=obj.coords[point][0];y=obj.coords[point][1];for(var dataset=0;dataset<obj.coords2.length;++dataset){for(var point=0;point<obj.coords2[dataset].length;++point){if(obj.coords2[dataset][point][0]==x&&obj.coords2[dataset][point][1]==y){ca.__crosshairs_snap_dataset__=dataset;ca.__crosshairs_snap_point__=point;}}}}else{for(var i=0;i<obj.coords.length;++i){for(var j=0;j<obj.coords[i].length;++j){var len=RG.getHypLength(obj.coords[i][j][0],obj.coords[i][j][1],x,y);if(typeof(dist)!='number'||len<dist){var dataset=i;var point=j;var dist=len;}}}
+ca.__crosshairs_snap_dataset__=dataset;ca.__crosshairs_snap_point__=point;x=obj.coords[dataset][point][0];y=obj.coords[dataset][point][1];}}
+if(prop['chart.crosshairs.vline']){co.moveTo(Mathround(x),Mathround(gutterTop));co.lineTo(Mathround(x),Mathround(height-gutterBottom));}
+if(prop['chart.crosshairs.hline']){co.moveTo(Mathround(gutterLeft),Mathround(y));co.lineTo(Mathround(width-gutterRight),Mathround(y));}
+co.stroke();if(obj.type=='scatter'&&prop['chart.crosshairs.coords']){var xCoord=(((x-gutterLeft)/(width-gutterLeft-gutterRight))*(prop['chart.xmax']-prop['chart.xmin']))+prop['chart.xmin'];xCoord=xCoord.toFixed(prop['chart.scale.decimals']);var yCoord=obj.max-(((y-prop['chart.gutter.top'])/(height-gutterTop-gutterBottom))*obj.max);if(obj.type=='scatter'&&obj.properties['chart.xaxispos']=='center'){yCoord=(yCoord-(obj.max/2))*2;}
+yCoord=yCoord.toFixed(prop['chart.scale.decimals']);var div=RG.Registry.get('chart.coordinates.coords.div');var mouseXY=RG.getMouseXY(e);var canvasXY=RG.getCanvasXY(ca);if(!div){var div=document.createElement('DIV');div.__object__=obj;div.style.position='absolute';div.style.backgroundColor='white';div.style.border='1px solid black';div.style.fontFamily='Arial, Verdana, sans-serif';div.style.fontSize='10pt'
+div.style.padding='2px';div.style.opacity=1;div.style.WebkitBorderRadius='3px';div.style.borderRadius='3px';div.style.MozBorderRadius='3px';document.body.appendChild(div);RG.Registry.set('chart.coordinates.coords.div',div);}
+div.style.opacity=1;div.style.display='inline';if(!prop['chart.crosshairs.coords.fixed']){div.style.left=ma.max(2,(e.pageX-div.offsetWidth-3))+'px';div.style.top=ma.max(2,(e.pageY-div.offsetHeight-3))+'px';}else{div.style.left=canvasXY[0]+gutterLeft+3+'px';div.style.top=canvasXY[1]+gutterTop+3+'px';}
+div.innerHTML='<span style="color: #666">'+prop['chart.crosshairs.coords.labels.x']+':</span> '+xCoord+'<br><span style="color: #666">'+prop['chart.crosshairs.coords.labels.y']+':</span> '+yCoord;obj.canvas.addEventListener('mouseout',RG.hideCrosshairCoords,false);ca.__crosshairs_labels__=div;ca.__crosshairs_x__=xCoord;ca.__crosshairs_y__=yCoord;}else if(prop['chart.crosshairs.coords']){alert('[RGRAPH] Showing crosshair coordinates is only supported on the Scatter chart');}
+RG.fireCustomEvent(obj,'oncrosshairs');}else{RG.hideCrosshairCoords();}};RG.allowSegmentHighlight=function(opt)
+{var obj=opt.object,count=opt.count,fill=opt.fill,stroke=opt.stroke
+if(!RG.segmentHighlightFunction){RG.segmentHighlightFunction=function(e)
+{var mouseXY=RG.getMouseXY(e);var angle=RG.getAngleByXY(obj.centerx,obj.centery,mouseXY[0],mouseXY[1]);angle+=RG.HALFPI;if(angle>RG.TWOPI){angle-=RG.TWOPI;}
+RG.redraw();var start=0;var end=0;var a=(ma.PI*2)/count;var r=obj.radius;(function()
+{for(i=0;i<count;i+=1){if(angle<(a*(i+1))){start=i*a;end=(i+1)*a;return;}}})();start-=RG.HALFPI;end-=RG.HALFPI;RG.path2(obj.context,'b m % % a % % % % % false c s % f %',obj.centerx,obj.centery,obj.centerx,obj.centery,r,start,end,stroke,fill);};obj.canvas.addEventListener('mousemove',RG.segmentHighlightFunction,false);}}})(window,document);
\ No newline at end of file
diff --git a/src/scripts/rgraph.common.tooltips.js b/src/scripts/rgraph.common.tooltips.js
new file mode 100644
index 0000000..4f49ca3
--- /dev/null
+++ b/src/scripts/rgraph.common.tooltips.js
@@ -0,0 +1,33 @@
+
+RGraph=window.RGraph||{isRGraph:true};(function(win,doc,undefined)
+{var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.tooltips={};RG.tooltips.style={display:'inline-block',position:'absolute',padding:'6px',fontFamily:'Arial',fontSize:'10pt',fontWeight:'normal',textAlign:'center',left:0,top:0,backgroundColor:'rgb(255,255,239)',color:'black',visibility:'visible',zIndex:3,borderRadius:'5px',boxShadow:'rgba(96,96,96,0.5) 0 0 5px',opacity:0};RG.tooltip=RG.Tooltip=function(obj,text,x,y,idx,e)
+{if(RG.trim(text).length===0){return;}
+RG.fireCustomEvent(obj,'onbeforetooltip');if(typeof(obj.get('chart.tooltips.override'))=='function'){return obj.get('chart.tooltips.override')(obj,text,x,y,idx);}
+var originalX=x;var originalY=y;text=RG.getTooltipTextFromDIV(text);var timers=RG.Registry.Get('chart.tooltip.timers');if(timers&&timers.length){for(i=0;i<timers.length;++i){clearTimeout(timers[i]);}}
+RG.Registry.Set('chart.tooltip.timers',[]);if(obj.get('chart.contextmenu')){RG.hideContext();}
+var tooltipObj=document.createElement('DIV');tooltipObj.className=obj.get('chart.tooltips.css.class');for(var i in RGraph.tooltips.style){if(typeof i==='string'){tooltipObj.style[i]=RGraph.tooltips.style[i];}}
+tooltipObj.innerHTML=text;tooltipObj.__text__=text;tooltipObj.__canvas__=obj.canvas;tooltipObj.id='__rgraph_tooltip_'+obj.canvas.id+'_'+obj.uid+'_'+idx;tooltipObj.__event__=obj.Get('chart.tooltips.event')||'click';tooltipObj.__object__=obj;if(typeof idx==='number'){tooltipObj.__index__=idx;origIdx=idx;}
+if(obj.type==='line'||obj.type==='radar'){for(var ds=0;ds<obj.data.length;++ds){if(idx>=obj.data[ds].length){idx-=obj.data[ds].length;}else{break;}}
+tooltipObj.__dataset__=ds;tooltipObj.__index2__=idx;}
+document.body.appendChild(tooltipObj);var width=tooltipObj.offsetWidth;var height=tooltipObj.offsetHeight;tooltipObj.style.width=width+'px';var mouseXY=RG.getMouseXY(e);var canvasXY=RG.getCanvasXY(obj.canvas);tooltipObj.style.left=e.pageX-(parseFloat(tooltipObj.style.paddingLeft)+(width/2))+'px';tooltipObj.style.top=e.pageY-height-10+'px';if(parseFloat(tooltipObj.style.left)<=5){tooltipObj.style.left='5px';}
+if(parseFloat(tooltipObj.style.left)+parseFloat(tooltipObj.style.width)>window.innerWidth){tooltipObj.style.left=''
+tooltipObj.style.right='5px'}
+if(RG.isFixed(obj.canvas)){var scrollTop=window.scrollY||document.documentElement.scrollTop;tooltipObj.style.position='fixed';tooltipObj.style.top=e.pageY-scrollTop-height-10+'px';}
+if(obj.get('chart.tooltips.effect')==='fade'){for(var i=1;i<=10;++i){(function(index)
+{setTimeout(function()
+{tooltipObj.style.opacity=index/10;},index*25);})(i);}}else{tooltipObj.style.opacity=1;}
+tooltipObj.onmousedown=function(e){e.stopPropagation();}
+tooltipObj.onmouseup=function(e){e.stopPropagation();}
+tooltipObj.onclick=function(e){if(e.button==0){e.stopPropagation();}}
+RG.Registry.Set('chart.tooltip',tooltipObj);RG.fireCustomEvent(obj,'ontooltip');};RG.getTooltipTextFromDIV=function(text)
+{var result=/^id:(.*)/.exec(text);if(result&&result[1]&&document.getElementById(result[1])){text=document.getElementById(result[1]).innerHTML;}else if(result&&result[1]){text='';}
+return text;};RG.getTooltipWidth=function(text,obj)
+{var div=document.createElement('DIV');div.className=obj.Get('chart.tooltips.css.class');div.style.paddingLeft=RG.tooltips.padding;div.style.paddingRight=RG.tooltips.padding;div.style.fontFamily=RG.tooltips.font_face;div.style.fontSize=RG.tooltips.font_size;div.style.visibility='hidden';div.style.position='absolute';div.style.top='300px';div.style.left=0;div.style.display='inline';div.innerHTML=RG.getTooltipTextFromDIV(text);document.body.appendChild(div);return div.offsetWidth;};RG.hideTooltip=RG.HideTooltip=function()
+{var tooltip=RG.Registry.Get('chart.tooltip');var uid=arguments[0]&&arguments[0].uid?arguments[0].uid:null;if(tooltip&&tooltip.parentNode&&(!uid||uid==tooltip.__canvas__.uid)){tooltip.parentNode.removeChild(tooltip);tooltip.style.display='none';tooltip.style.visibility='hidden';RG.Registry.Set('chart.tooltip',null);}};RG.preLoadTooltipImages=RG.PreLoadTooltipImages=function(obj)
+{var tooltips=obj.Get('chart.tooltips');if(RG.hasTooltips(obj)){if(obj.type=='rscatter'){tooltips=[];for(var i=0;i<obj.data.length;++i){tooltips.push(obj.data[3]);}}
+for(var i=0;i<tooltips.length;++i){var div=document.createElement('DIV');div.style.position='absolute';div.style.opacity=0;div.style.top='-100px';div.style.left='-100px';div.innerHTML=tooltips[i];document.body.appendChild(div);var img_tags=div.getElementsByTagName('IMG');for(var j=0;j<img_tags.length;++j){if(img_tags&&img_tags[i]){var img=document.createElement('IMG');img.style.position='absolute';img.style.opacity=0;img.style.top='-100px';img.style.left='-100px';img.src=img_tags[i].src
+document.body.appendChild(img);setTimeout(function(){document.body.removeChild(img);},250);}}
+document.body.removeChild(div);}}};RG.tooltips_mousemove=RG.Tooltips_mousemove=function(obj,e)
+{var shape=obj.getShape(e);var changeCursor_tooltips=false
+if(shape&&typeof(shape['index'])=='number'&&obj.Get('chart.tooltips')[shape['index']]){var text=RG.parseTooltipText(obj.Get('chart.tooltips'),shape['index']);if(text){changeCursor_tooltips=true;if(obj.Get('chart.tooltips.event')=='onmousemove'){if(!RG.Registry.Get('chart.tooltip')||RG.Registry.Get('chart.tooltip').__object__.uid!=obj.uid||RG.Registry.Get('chart.tooltip').__index__!=shape['index']){RG.hideTooltip();RG.Clear(obj.canvas);RG.redraw();RG.tooltip(obj,text,e.pageX,e.pageY,shape['index']);obj.Highlight(shape);}}}}else if(shape&&typeof(shape['index'])=='number'){var text=RG.parseTooltipText(obj.Get('chart.tooltips'),shape['index']);if(text){changeCursor_tooltips=true}}
+return changeCursor_tooltips;};})(window,document);
\ No newline at end of file
diff --git a/src/scripts/rgraph.line.js b/src/scripts/rgraph.line.js
new file mode 100644
index 0000000..a9e1d6b
--- /dev/null
+++ b/src/scripts/rgraph.line.js
@@ -0,0 +1,245 @@
+
+RGraph=window.RGraph||{isRGraph:true};RGraph.Line=function(conf)
+{if(typeof conf==='object'&&typeof conf.data==='object'&&typeof conf.id==='string'){var id=conf.id;var canvas=document.getElementById(id);var data=conf.data;var parseConfObjectForOptions=true;}else{var id=conf;var canvas=document.getElementById(id);var data=arguments[1];}
+this.id=id;this.canvas=canvas;this.context=this.canvas.getContext('2d');this.canvas.__object__=this;this.type='line';this.max=0;this.coords=[];this.coords2=[];this.coords.key=[];this.coordsText=[];this.coordsSpline=[];this.coordsAxes={xaxis:[],yaxis:[]};this.hasnegativevalues=false;this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.colorsParsed=false;this.original_colors=[];this.firstDraw=true;this.properties={'chart.background.barcolor1':'rgba(0,0,0,0)','chart.background.barcolor2':'rgba(0,0,0,0)','chart.background.grid':1,'chart.background.grid.width':1,'chart.background.grid.hsize':25,'chart.background.grid.vsize':25,'chart.background.grid.color':'#ddd','chart.background.grid.vlines':true,'chart.background.grid.hlines':true,'chart.background.grid.border':true,'chart.background.grid.autofit':true,'chart.background.grid.autofit.align':true,'chart.background.grid.autofit.numhlines':5,'chart.background.grid.autofit.numvlines':null,'chart.background.grid.dashed':false,'chart.background.grid.dotted':false,'chart.background.hbars':null,'chart.background.image':null,'chart.background.image.stretch':true,'chart.background.image.x':null,'chart.background.image.y':null,'chart.background.image.w':null,'chart.background.image.h':null,'chart.background.image.align':null,'chart.background.color':null,'chart.labels':null,'chart.labels.bold':false,'chart.labels.color':null,'chart.labels.ingraph':null,'chart.labels.above':false,'chart.labels.above.size':8,'chart.labels.above.decimals':null,'chart.labels.above.color':null,'chart.labels.above.background':'white','chart.labels.above.font':null,'chart.labels.above.border':true,'chart.labels.above.offsety':5,'chart.labels.above.units.pre':'','chart.labels.above.units.post':'','chart.labels.above.specific':null,'chart.labels.offsetx':0,'chart.labels.offsety':0,'chart.xtickgap':20,'chart.smallxticks':3,'chart.largexticks':5,'chart.ytickgap':20,'chart.smallyticks':3,'chart.largeyticks':5,'chart.numyticks':10,'chart.linewidth':2.01,'chart.colors':['red','#0f0','#00f','#f0f','#ff0','#0ff','green','pink','blue','black'],'chart.hmargin':0,'chart.tickmarks.dot.stroke':'white','chart.tickmarks.dot.fill':null,'chart.tickmarks.dot.linewidth':3,'chart.tickmarks':'endcircle','chart.tickmarks.linewidth':null,'chart.tickmarks.image':null,'chart.tickmarks.image.halign':'center','chart.tickmarks.image.valign':'center','chart.tickmarks.image.offsetx':0,'chart.tickmarks.image.offsety':0,'chart.ticksize':3,'chart.gutter.left':25,'chart.gutter.right':25,'chart.gutter.top':25,'chart.gutter.bottom':30,'chart.tickdirection':-1,'chart.yaxispoints':5,'chart.fillstyle':null,'chart.xaxispos':'bottom','chart.xaxispos.value':0,'chart.yaxispos':'left','chart.xticks':null,'chart.text.size':12,'chart.text.angle':0,'chart.text.color':'black','chart.text.font':'Segoe UI, Arial, Verdana, sans-serif','chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':true,'chart.ymin':0,'chart.ymax':null,'chart.title':'','chart.title.background':null,'chart.title.hpos':null,'chart.title.vpos':null,'chart.title.bold':true,'chart.title.font':null,'chart.title.xaxis':'','chart.title.xaxis.bold':true,'chart.title.xaxis.size':null,'chart.title.xaxis.font':null,'chart.title.xaxis.color':null,'chart.title.yaxis':'','chart.title.yaxis.bold':true,'chart.title.yaxis.size':null,'chart.title.yaxis.font':null,'chart.title.yaxis.color':null,'chart.title.xaxis.pos':null,'chart.title.yaxis.pos':null,'chart.title.yaxis.x':null,'chart.title.yaxis.y':null,'chart.title.xaxis.x':null,'chart.title.xaxis.y':null,'chart.title.x':null,'chart.title.y':null,'chart.title.halign':null,'chart.title.valign':null,'chart.shadow':true,'chart.shadow.offsetx':2,'chart.shadow.offsety':2,'chart.shadow.blur':3,'chart.shadow.color':'rgba(128,128,128,0.5)','chart.tooltips':null,'chart.tooltips.hotspot.xonly':false,'chart.tooltips.hotspot.size':5,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.event':'onmousemove','chart.tooltips.highlight':true,'chart.tooltips.coords.page':false,'chart.highlight.style':null,'chart.highlight.stroke':'gray','chart.highlight.fill':'white','chart.stepped':false,'chart.key':null,'chart.key.background':'white','chart.key.position':'graph','chart.key.halign':null,'chart.key.shadow':false,'chart.key.shadow.color':'#666','chart.key.shadow.blur':3,'chart.key.shadow.offsetx':2,'chart.key.shadow.offsety':2,'chart.key.position.gutter.boxed':false,'chart.key.position.x':null,'chart.key.position.y':null,'chart.key.color.shape':'square','chart.key.rounded':true,'chart.key.linewidth':1,'chart.key.colors':null,'chart.key.interactive':false,'chart.key.interactive.highlight.chart.stroke':'rgba(255,0,0,0.3)','chart.key.interactive.highlight.label':'rgba(255,0,0,0.2)','chart.key.text.color':'black','chart.contextmenu':null,'chart.ylabels':true,'chart.ylabels.count':5,'chart.ylabels.inside':false,'chart.ylabels.offsetx':0,'chart.ylabels.offsety':0,'chart.scale.invert':false,'chart.xlabels.inside':false,'chart.xlabels.inside.color':'rgba(255,255,255,0.5)','chart.noaxes':false,'chart.noyaxis':false,'chart.noxaxis':false,'chart.noendxtick':false,'chart.noendytick':false,'chart.units.post':'','chart.units.pre':'','chart.scale.zerostart':true,'chart.scale.decimals':null,'chart.scale.point':'.','chart.scale.thousand':',','chart.crosshairs':false,'chart.crosshairs.color':'#333','chart.crosshairs.hline':true,'chart.crosshairs.vline':true,'chart.annotatable':false,'chart.annotate.color':'black','chart.axesontop':false,'chart.filled':false,'chart.filled.range':false,'chart.filled.range.threshold':null,'chart.filled.range.threshold.colors':['red','green'],'chart.filled.accumulative':true,'chart.variant':null,'chart.axis.color':'black','chart.axis.linewidth':1,'chart.numxticks':(data&&typeof(data[0])=='number'?data.length-1:(typeof data[0]==='object'&&data[0]&&typeof data[0][0]==='number'?data[0].length-1:20)),'chart.numyticks':10,'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':25,'chart.zoom.delay':16.666,'chart.zoom.shadow':true,'chart.zoom.background':true,'chart.zoom.action':'zoom','chart.backdrop':false,'chart.backdrop.size':30,'chart.backdrop.alpha':0.2,'chart.resizable':false,'chart.resize.handle.adjust':[0,0],'chart.resize.handle.background':null,'chart.adjustable':false,'chart.adjustable.only':null,'chart.noredraw':false,'chart.outofbounds':false,'chart.outofbounds.clip':false,'chart.chromefix':true,'chart.animation.factor':1,'chart.animation.unfold.x':false,'chart.animation.unfold.y':true,'chart.animation.unfold.initial':2,'chart.animation.trace.clip':1,'chart.curvy':false,'chart.line.visible':[],'chart.events.click':null,'chart.events.mousemove':null,'chart.errorbars':false,'chart.errorbars.color':'black','chart.errorbars.capped':true,'chart.errorbars.capped.width':12,'chart.errorbars.linewidth':1,'chart.combinedchart.effect':null,'chart.combinedchart.effect.options':null,'chart.combinedchart.effect.callback':null,'chart.clearto':'rgba(0,0,0,0)'}
+for(var i=1;i<arguments.length;++i){if(typeof(arguments[i])=='null'||!arguments[i]){arguments[i]=[];}}
+this.original_data=[];if(typeof conf==='object'&&conf.data){if(typeof conf.data[0]==='number'||RGraph.isNull(conf.data[0])){this.original_data[0]=RGraph.arrayClone(conf.data);}else{for(var i=0;i<conf.data.length;++i){this.original_data[i]=RGraph.arrayClone(conf.data[i]);}}}else{for(var i=1;i<arguments.length;++i){if(arguments[1]&&typeof(arguments[1])=='object'&&arguments[1][0]&&typeof(arguments[1][0])=='object'&&arguments[1][0].length){var tmp=[];for(var i=0;i<arguments[1].length;++i){tmp[i]=RGraph.array_clone(arguments[1][i]);}
+for(var j=0;j<tmp.length;++j){this.original_data[j]=RGraph.array_clone(tmp[j]);}}else{this.original_data[i-1]=RGraph.array_clone(arguments[i]);}}}
+if(!this.canvas){alert('[LINE] Fatal error: no canvas support');return;}
+for(var i=0;i<this.original_data.length;++i){for(var j=0;j<this.original_data[i].length;++j){if(typeof this.original_data[i][j]==='string'){this.original_data[i][j]=parseFloat(this.original_data[i][j]);}}}
+this.data_arr=RGraph.arrayLinearize(this.original_data);for(var i=0;i<this.data_arr.length;++i){this['$'+i]={};}
+if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
+var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math
+if(RG.Effects&&typeof RG.Effects.decorate==='function'){RG.Effects.decorate(this);}
+this.set=this.Set=function(name)
+{var value=typeof arguments[1]==='undefined'?null:arguments[1];if(arguments.length===1&&typeof name==='object'){RG.parseObjectStyleConfig(this,name);return this;}
+if(name.substr(0,6)!='chart.'){name='chart.'+name;}
+while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
+if(name=='chart.tooltips'&&typeof value=='object'&&value){var tooltips=[];for(var i=1;i<arguments.length;i++){if(typeof(arguments[i])=='object'&&arguments[i][0]){for(var j=0;j<arguments[i].length;j++){tooltips.push(arguments[i][j]);}}else if(typeof(arguments[i])=='function'){tooltips=arguments[i];}else{tooltips.push(arguments[i]);}}
+value=tooltips;}
+if(name=='chart.linewidth'&&navigator.userAgent.match(/Chrome/)){if(value==1){value=1.01;}else if(RGraph.is_array(value)){for(var i=0;i<value.length;++i){if(typeof(value[i])=='number'&&value[i]==1){value[i]=1.01;}}}}
+if(name=='chart.xaxispos'){if(value!='bottom'&&value!='center'&&value!='top'){alert('[LINE] ('+this.id+') chart.xaxispos should be top, center or bottom. Tried to set it to: '+value+' Changing it to center');value='center';}}
+if(name=='chart.xticks'){name='chart.numxticks';}
+if(name=='chart.spline'){name='chart.curvy';}
+if(name=='chart.ylabels.invert'){name='chart.scale.invert';}
+this.properties[name]=value;return this;};this.get=this.Get=function(name)
+{if(name.substr(0,6)!='chart.'){name='chart.'+name;}
+while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
+if(name=='chart.spline'){name='chart.curvy';}
+return prop[name];};this.draw=this.Draw=function()
+{if(typeof(prop['chart.background.image'])=='string'){RG.DrawBackgroundImage(this);}
+RG.FireCustomEvent(this,'onbeforedraw');if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
+this.gutterLeft=prop['chart.gutter.left'];this.gutterRight=prop['chart.gutter.right'];this.gutterTop=prop['chart.gutter.top'];this.gutterBottom=prop['chart.gutter.bottom'];this.data=RG.array_clone(this.original_data);this.max=0;if(prop['chart.filled']&&!prop['chart.filled.range']&&this.data.length>1&&prop['chart.filled.accumulative']){var accumulation=[];for(var set=0;set<this.data.length;++set){for(var point=0;point<this.data[set].length;++point){this.data[set][point]=Number(accumulation[point]?accumulation[point]:0)+this.data[set][point];accumulation[point]=this.data[set][point];}}}
+if(prop['chart.ymax']){this.max=prop['chart.ymax'];this.min=prop['chart.ymin']?prop['chart.ymin']:0;this.scale2=RG.getScale2(this,{'max':this.max,'min':prop['chart.ymin'],'strict':true,'scale.thousand':prop['chart.scale.thousand'],'scale.point':prop['chart.scale.point'],'scale.decimals':prop['chart.scale.decimals'],'ylabels.count':prop['chart.ylabels.count'],'scale.round':prop['chart.scale.round'],'units.pre':prop['chart.units.pre'],'units.post':prop['chart.units.post']});this.max=this.scale2.max?this.scale2.max:0;if(!prop['chart.outofbounds']){for(dataset=0;dataset<this.data.length;++dataset){if(RGraph.isArray(this.data[dataset])){for(var datapoint=0;datapoint<this.data[dataset].length;datapoint++){this.hasnegativevalues=(this.data[dataset][datapoint]<0)||this.hasnegativevalues;}}}}}else{this.min=prop['chart.ymin']?prop['chart.ymin']:0;for(dataset=0;dataset<this.data.length;++dataset){for(var datapoint=0;datapoint<this.data[dataset].length;datapoint++){this.max=Math.max(this.max,this.data[dataset][datapoint]?Math.abs(parseFloat(this.data[dataset][datapoint])):0);if(!prop['chart.outofbounds']){this.hasnegativevalues=(this.data[dataset][datapoint]<0)||this.hasnegativevalues;}}}
+this.scale2=RG.getScale2(this,{'max':this.max,'min':prop['chart.ymin'],'scale.thousand':prop['chart.scale.thousand'],'scale.point':prop['chart.scale.point'],'scale.decimals':prop['chart.scale.decimals'],'ylabels.count':prop['chart.ylabels.count'],'scale.round':prop['chart.scale.round'],'units.pre':prop['chart.units.pre'],'units.post':prop['chart.units.post']});this.max=this.scale2.max?this.scale2.max:0;}
+if(prop['chart.contextmenu']){RG.ShowContext(this);}
+this.coords=[];this.coordsText=[];this.grapharea=ca.height-this.gutterTop-this.gutterBottom;this.halfgrapharea=this.grapharea/2;this.halfTextHeight=prop['chart.text.size']/2;if(prop['chart.variant']=='3d'){RG.Draw3DAxes(this);}
+RG.background.Draw(this);if(prop['chart.background.hbars']&&prop['chart.background.hbars'].length>0){RG.DrawBars(this);}
+if(prop['chart.axesontop']==false){this.DrawAxes();}
+co.save()
+co.beginPath();co.rect(0,0,ca.width*prop['chart.animation.trace.clip'],ca.height);co.clip();for(var i=0,j=0,len=this.data.length;i<len;i++,j++){co.beginPath();if(!prop['chart.filled']){this.SetShadow(i);}
+if(prop['chart.fillstyle']){if(typeof(prop['chart.fillstyle'])=='object'&&prop['chart.fillstyle'][j]){var fill=prop['chart.fillstyle'][j];}else if(typeof(prop['chart.fillstyle'])=='object'&&prop['chart.fillstyle'].toString().indexOf('Gradient')>0){var fill=prop['chart.fillstyle'];}else if(typeof(prop['chart.fillstyle'])=='string'){var fill=prop['chart.fillstyle'];}}else if(prop['chart.filled']){var fill=prop['chart.colors'][j];}else{var fill=null;}
+if(prop['chart.tickmarks']&&typeof(prop['chart.tickmarks'])=='object'){var tickmarks=prop['chart.tickmarks'][i];}else if(prop['chart.tickmarks']&&typeof(prop['chart.tickmarks'])=='string'){var tickmarks=prop['chart.tickmarks'];}else if(prop['chart.tickmarks']&&typeof(prop['chart.tickmarks'])=='function'){var tickmarks=prop['chart.tickmarks'];}else{var tickmarks=null;}
+if(prop['chart.outofbounds.clip']){pa2(co,'sa b r % % % % cl b',0,this.gutterTop,ca.width,ca.height-this.gutterTop-this.gutterBottom);}
+this.drawLine(this.data[i],prop['chart.colors'][j],fill,this.getLineWidth(j),tickmarks,i);if(prop['chart.outofbounds.clip']){co.restore();}
+co.stroke();}
+if(prop['chart.filled']&&prop['chart.filled.accumulative']&&!prop['chart.curvy']){for(var i=0;i<this.coords2.length;++i){co.beginPath();co.lineWidth=this.GetLineWidth(i);co.strokeStyle=!this.hidden(i)?prop['chart.colors'][i]:'rgba(0,0,0,0)';for(var j=0,len=this.coords2[i].length;j<len;++j){if(j==0||this.coords2[i][j][1]==null||(this.coords2[i][j-1]&&this.coords2[i][j-1][1]==null)){co.moveTo(this.coords2[i][j][0],this.coords2[i][j][1]);}else{if(prop['chart.stepped']){co.lineTo(this.coords2[i][j][0],this.coords2[i][j-1][1]);}
+co.lineTo(this.coords2[i][j][0],this.coords2[i][j][1]);}}
+co.stroke();}
+if(prop['chart.tickmarks']){co.beginPath();co.fillStyle='white';for(var i=0,len=this.coords2.length;i<len;++i){co.beginPath();co.strokeStyle=prop['chart.colors'][i];for(var j=0;j<this.coords2[i].length;++j){if(typeof(this.coords2[i][j])=='object'&&typeof(this.coords2[i][j][0])=='number'&&typeof(this.coords2[i][j][1])=='number'){var tickmarks=typeof(prop['chart.tickmarks'])=='object'?prop['chart.tickmarks'][i]:prop['chart.tickmarks'];this.DrawTick(this.coords2[i],this.coords2[i][j][0],this.coords2[i][j][1],co.strokeStyle,false,j==0?0:this.coords2[i][j-1][0],j==0?0:this.coords2[i][j-1][1],tickmarks,j,i);}}}
+co.stroke();co.fill();}}else if(prop['chart.filled']&&prop['chart.filled.accumulative']&&prop['chart.curvy']){for(var i=0;i<this.coordsSpline.length;i+=1){co.beginPath();co.strokeStyle=prop['chart.colors'][i];co.lineWidth=this.GetLineWidth(i);for(var j=0,len=this.coordsSpline[i].length;j<len;j+=1){var point=this.coordsSpline[i][j];j==0?co.moveTo(point[0],point[1]):co.lineTo(point[0],point[1]);}
+co.stroke();}
+for(var i=0,len=this.coords2.length;i<len;i+=1){for(var j=0,len2=this.coords2[i].length;j<len2;++j){if(typeof(this.coords2[i][j])=='object'&&typeof(this.coords2[i][j][0])=='number'&&typeof(this.coords2[i][j][1])=='number'){var tickmarks=typeof prop['chart.tickmarks']=='object'&&!RGraph.is_null(prop['chart.tickmarks'])?prop['chart.tickmarks'][i]:prop['chart.tickmarks'];co.strokeStyle=prop['chart.colors'][i];this.DrawTick(this.coords2[i],this.coords2[i][j][0],this.coords2[i][j][1],prop['chart.colors'][i],false,j==0?0:this.coords2[i][j-1][0],j==0?0:this.coords2[i][j-1][1],tickmarks,j,i);}}}}
+co.restore();co.beginPath();if(prop['chart.axesontop']){this.DrawAxes();}
+this.DrawLabels();this.DrawRange();if(prop['chart.key']&&prop['chart.key'].length&&RG.DrawKey){RG.DrawKey(this,prop['chart.key'],prop['chart.colors']);}
+if(prop['chart.labels.above']){this.drawAboveLabels();}
+RG.DrawInGraphLabels(this);if(prop['chart.filled']&&prop['chart.filled.range']&&this.data.length==2){co.beginPath();var len=this.coords.length/2;co.lineWidth=prop['chart.linewidth'];co.strokeStyle=this.hidden(0)?'rgba(0,0,0,0)':prop['chart.colors'][0];for(var i=0;i<len;++i){if(!RG.isNull(this.coords[i][1])){if(i==0){co.moveTo(this.coords[i][0],this.coords[i][1]);}else{co.lineTo(this.coords[i][0],this.coords[i][1]);}}}
+co.stroke();co.beginPath();if(prop['chart.colors'][1]){co.strokeStyle=this.hidden(1)?'rgba(0,0,0,0)':prop['chart.colors'][1];}
+for(var i=this.coords.length-1;i>=len;--i){if(!RG.is_null(this.coords[i][1])){if(i==(this.coords.length-1)){co.moveTo(this.coords[i][0],this.coords[i][1]);}else{co.lineTo(this.coords[i][0],this.coords[i][1]);}}}
+co.stroke();}else if(prop['chart.filled']&&prop['chart.filled.range']){alert('[LINE] You must have only two sets of data for a filled range chart');}
+if(prop['chart.resizable']){RG.AllowResizing(this);}
+RG.InstallEventListeners(this);if(this.firstDraw){RG.fireCustomEvent(this,'onfirstdraw');this.firstDraw=false;this.firstDrawFunc();}
+RG.FireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
+{func(this);return this;};this.drawAxes=this.DrawAxes=function()
+{if(prop['chart.noaxes']){return;}
+RG.noShadow(this);co.lineWidth=prop['chart.axis.linewidth']+0.001;co.lineCap='square';co.lineJoin='miter';co.strokeStyle=prop['chart.axis.color'];coords={xaxis:{},yaxis:{}};co.beginPath();if(prop['chart.noxaxis']==false){if(prop['chart.xaxispos']=='center'){coords.xaxis=[this.gutterLeft,ma.round((this.grapharea/2)+this.gutterTop),ca.width-this.gutterRight,ma.round((this.grapharea/2)+this.gutterTop)];}else if(prop['chart.xaxispos']==='top'){coords.xaxis=[this.gutterLeft,this.gutterTop,ca.width-this.gutterRight,this.gutterTop];}else{var y=ma.round(this.getYCoord(prop['chart.ymin']!=0?prop['chart.ymin']:0));if(prop['chart.scale.invert']&&prop['chart.ymin']===0){y=this.getYCoord(this.scale2.max);}else if(prop['chart.scale.invert']||prop['chart.ymin']<0){y=this.getYCoord(0);}
+coords.xaxis=[this.gutterLeft,y,ca.width-this.gutterRight,y];}
+co.moveTo(coords.xaxis[0],coords.xaxis[1]);co.lineTo(coords.xaxis[2],coords.xaxis[3]);this.coordsAxes=coords;}
+if(prop['chart.noyaxis']==false){if(prop['chart.yaxispos']=='left'){co.moveTo(this.gutterLeft,this.gutterTop);co.lineTo(this.gutterLeft,ca.height-this.gutterBottom);}else{co.moveTo(ca.width-this.gutterRight,this.gutterTop);co.lineTo(ca.width-this.gutterRight,ca.height-this.gutterBottom);}}
+if(prop['chart.noxaxis']==false&&prop['chart.numxticks']>0){var xTickInterval=(ca.width-this.gutterLeft-this.gutterRight)/prop['chart.numxticks'];if(!xTickInterval||xTickInterval<=0){xTickInterval=(ca.width-this.gutterLeft-this.gutterRight)/(prop['chart.labels']&&prop['chart.labels'].length?prop['chart.labels'].length-1:10);}
+for(x=this.gutterLeft+(prop['chart.yaxispos']=='left'?xTickInterval:0);x<=(ca.width-this.gutterRight+1);x+=xTickInterval){if(prop['chart.yaxispos']=='right'&&x>=(ca.width-this.gutterRight-1)){break;}
+if(prop['chart.noendxtick']){if(prop['chart.yaxispos']=='left'&&x>=(ca.width-this.gutterRight-1)){break;}else if(prop['chart.yaxispos']=='right'&&x==this.gutterLeft){continue;}}
+var yStart=prop['chart.xaxispos']==='center'?(this.gutterTop+(this.grapharea/2))-3:ca.height-this.gutterBottom;var yEnd=prop['chart.xaxispos']==='center'?yStart+6:ca.height-this.gutterBottom-(x%60==0?prop['chart.largexticks']*prop['chart.tickdirection']:prop['chart.smallxticks']*prop['chart.tickdirection']);if(prop['chart.ymin']>=0&&prop['chart.xaxispos']==='bottom'){var yStart=this.getYCoord(prop['chart.ymin'])-(prop['chart.ymin']>=0?0:3),yEnd=this.getYCoord(prop['chart.ymin'])+3;if(prop['chart.scale.invert']){yStart=ca.height-prop['chart.gutter.bottom'];yEnd=yStart+3;}}else if(prop['chart.xaxispos']=='center'){var yStart=Math.round((this.gutterTop+(this.grapharea/2)))-3,yEnd=yStart+6;}else if(prop['chart.xaxispos']=='bottom'){var yStart=this.getYCoord(0)-(prop['chart.ymin']!==0?3:0),yEnd=this.getYCoord(0)-(x%60==0?prop['chart.largexticks']*prop['chart.tickdirection']:prop['chart.smallxticks']*prop['chart.tickdirection']);yEnd+=0;}else if(prop['chart.xaxispos']=='top'){yStart=this.gutterTop-3;yEnd=this.gutterTop;}
+co.moveTo(ma.round(x),yStart);co.lineTo(ma.round(x),yEnd);}}else if(prop['chart.noyaxis']==false&&prop['chart.numyticks']>0){if(!prop['chart.noendytick']){if(prop['chart.yaxispos']=='left'){co.moveTo(this.gutterLeft,Math.round(ca.height-this.gutterBottom));co.lineTo(this.gutterLeft-prop['chart.smallyticks'],Math.round(ca.height-this.gutterBottom));}else{co.moveTo(ca.width-this.gutterRight,Math.round(ca.height-this.gutterBottom));co.lineTo(ca.width-this.gutterRight+prop['chart.smallyticks'],Math.round(ca.height-this.gutterBottom));}}}
+var numyticks=prop['chart.numyticks'];if(prop['chart.noyaxis']==false&&numyticks>0){var counter=0,adjustment=0;if(prop['chart.yaxispos']=='right'){adjustment=(ca.width-this.gutterLeft-this.gutterRight);}
+if(prop['chart.xaxispos']=='center'){var interval=(this.grapharea/numyticks);var lineto=(prop['chart.yaxispos']=='left'?this.gutterLeft:ca.width-this.gutterRight+prop['chart.smallyticks']);for(y=this.gutterTop;y<(this.grapharea/2)+this.gutterTop;y+=interval){if(y<(this.grapharea/2)+this.gutterTop){co.moveTo((prop['chart.yaxispos']=='left'?this.gutterLeft-prop['chart.smallyticks']:ca.width-this.gutterRight),Math.round(y));co.lineTo(lineto,Math.round(y));}}
+for(y=this.gutterTop+(this.halfgrapharea)+interval;y<=this.grapharea+this.gutterTop;y+=interval){co.moveTo((prop['chart.yaxispos']=='left'?this.gutterLeft-prop['chart.smallyticks']:ca.width-this.gutterRight),Math.round(y));co.lineTo(lineto,Math.round(y));}}else if(prop['chart.xaxispos']=='top'){var interval=(this.grapharea/numyticks);var lineto=(prop['chart.yaxispos']=='left'?this.gutterLeft:ca.width-this.gutterRight+prop['chart.smallyticks']);for(y=this.gutterTop+interval;y<=this.grapharea+this.gutterBottom;y+=interval){co.moveTo((prop['chart.yaxispos']=='left'?this.gutterLeft-prop['chart.smallyticks']:ca.width-this.gutterRight),Math.round(y));co.lineTo(lineto,Math.round(y));}
+if(prop['chart.noxaxis']&&prop['chart.noendytick']==false){co.moveTo((prop['chart.yaxispos']=='left'?this.gutterLeft-prop['chart.smallyticks']:ca.width-this.gutterRight),this.gutterTop);co.lineTo(lineto,this.gutterTop);}}else{var lineto=(prop['chart.yaxispos']=='left'?this.gutterLeft-prop['chart.smallyticks']:ca.width-this.gutterRight+prop['chart.smallyticks']);for(y=this.gutterTop;y<(ca.height-this.gutterBottom)&&counter<numyticks;y+=((ca.height-this.gutterTop-this.gutterBottom)/numyticks)){if(ma.round(y)!==ma.round(this.coordsAxes.xaxis[1])){co.moveTo(this.gutterLeft+adjustment,ma.round(y));co.lineTo(lineto,ma.round(y));}
+var counter=counter+1;}
+if(prop['chart.ymin']<0){co.moveTo((prop['chart.yaxispos']=='left'?this.gutterLeft:ca.width-this.gutterRight),ma.round(y));co.lineTo(lineto,ma.round(y));}}}else if(prop['chart.noxaxis']==false&&prop['chart.numxticks']>0){if(prop['chart.yaxispos']=='left'){co.moveTo(this.gutterLeft,prop['chart.xaxispos']=='top'?this.gutterTop:ca.height-this.gutterBottom);co.lineTo(this.gutterLeft,prop['chart.xaxispos']=='top'?this.gutterTop-prop['chart.smallxticks']:ca.height-this.gutterBottom+prop['chart.smallxticks']);}else{co.moveTo(ca.width-this.gutterRight,ca.height-this.gutterBottom);co.lineTo(ca.width-this.gutterRight,ca.height-this.gutterBottom+prop['chart.smallxticks']);}}
+co.stroke();co.beginPath();};this.drawLabels=this.DrawLabels=function()
+{co.strokeStyle='black';co.fillStyle=prop['chart.text.color'];co.lineWidth=1;RG.NoShadow(this);var font=prop['chart.text.font'];var text_size=prop['chart.text.size'];var decimals=prop['chart.scale.decimals'];var context=co;var canvas=ca;var ymin=prop['chart.ymin'];if(prop['chart.ylabels']&&prop['chart.ylabels.specific']==null){var units_pre=prop['chart.units.pre'];var units_post=prop['chart.units.post'];var xpos=prop['chart.yaxispos']=='left'?this.gutterLeft-5:ca.width-this.gutterRight+5;var align=prop['chart.yaxispos']=='left'?'right':'left';var numYLabels=this.scale2.labels.length;var bounding=false;var bgcolor=prop['chart.ylabels.inside']?prop['chart.ylabels.inside.color']:null;var offsetx=prop['chart.ylabels.offsetx'];var offsety=prop['chart.ylabels.offsety'];if(prop['chart.ylabels.inside']==true&&align=='left'){xpos-=10;align='right';bounding=true;}else if(prop['chart.ylabels.inside']==true&&align=='right'){xpos+=10;align='left';bounding=true;}
+if(prop['chart.xaxispos']=='center'){var half=this.grapharea/2;for(var i=0;i<this.scale2.labels.length;++i){RG.text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':this.gutterTop+half-(((i+1)/numYLabels)*half)+offsety,'valign':'center','halign':align,'bounding':bounding,'boundingFill':bgcolor,'text':this.scale2.labels[i],'tag':'scale'});}
+for(var i=0;i<this.scale2.labels.length;++i){RG.text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':this.gutterTop+half+(((i+1)/numYLabels)*half)+offsety,'valign':'center','halign':align,'bounding':bounding,'boundingFill':bgcolor,'text':'-'+this.scale2.labels[i],'tag':'scale'});}
+if(prop['chart.noxaxis']==true||ymin!=0||prop['chart.scale.zerostart']){RG.text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':this.gutterTop+half+offsety,'text':prop['chart.units.pre']+ymin.toFixed(ymin===0?0:decimals)+prop['chart.units.post'],'bounding':bounding,'boundingFill':bgcolor,'valign':'center','halign':align,'tag':'scale'});}}else if(prop['chart.xaxispos']=='top'){var half=this.grapharea/2;if(prop['chart.scale.invert']){for(var i=0;i<this.scale2.labels.length;++i){RG.text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':this.gutterTop+((i/this.scale2.labels.length)*this.grapharea)+offsety,'valign':'center','halign':align,'bounding':bounding,'boundingFill':bgcolor,'text':'-'+this.scale2.labels[this.scale2.labels.length-(i+1)],'tag':'scale'});}}else{for(var i=0;i<this.scale2.labels.length;++i){RG.text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':this.gutterTop+(((i+1)/numYLabels)*this.grapharea)+offsety,'valign':'center','halign':align,'bounding':bounding,'boundingFill':bgcolor,'text':'-'+this.scale2.labels[i],'tag':'scale'});}}
+if((prop['chart.ymin']!=0||prop['chart.noxaxis'])||prop['chart.scale.invert']||prop['chart.scale.zerostart']){RG.text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':prop['chart.scale.invert']?ca.height-this.gutterBottom+offsety:this.gutterTop+offsety,'text':(prop['chart.ymin']!=0?'-':'')+RG.numberFormat(this,prop['chart.ymin'].toFixed(ymin===0?0:decimals),units_pre,units_post),'valign':'center','halign':align,'bounding':bounding,'boundingFill':bgcolor,'tag':'scale'});}}else{if(prop['chart.scale.invert']){RG.text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':this.gutterTop+offsety,'valign':'center','halign':align,'bounding':bounding,'boundingFill':bgcolor,'text':RG.numberFormat(this,this.min.toFixed(prop['chart.ymin']===0?0:prop['chart.scale.decimals']),units_pre,units_post),'tag':'scale'});for(var i=0,len=this.scale2.labels.length;i<len;++i){RG.Text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':this.gutterTop+(((i+1)/this.scale2.labels.length)*this.grapharea)+offsety,'valign':'center','halign':align,'bounding':bounding,'boundingFill':bgcolor,'text':this.scale2.labels[i],'tag':'scale'});}}else{for(var i=0,len=this.scale2.labels.length;i<len;++i){RG.text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':this.gutterTop+((i/this.scale2.labels.length)*this.grapharea)+offsety,'valign':'center','halign':align,'bounding':bounding,'boundingFill':bgcolor,'text':this.scale2.labels[this.scale2.labels.length-(i+1)],'tag':'scale'});}}
+if((prop['chart.ymin']!=0&&!prop['chart.scale.invert']||prop['chart.scale.zerostart'])||prop['chart.noxaxis']){RG.text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':prop['chart.scale.invert']?this.gutterTop+offsety:ca.height-this.gutterBottom+offsety,'text':RG.numberFormat(this,prop['chart.ymin'].toFixed(prop['chart.ymin']===0?0:prop['chart.scale.decimals']),units_pre,units_post),'valign':'center','halign':align,'bounding':bounding,'boundingFill':bgcolor,'tag':'scale'});}}
+if(prop['chart.noxaxis']==true&&prop['chart.ymin']==null&&prop['chart.xaxispos']!='center'&&prop['chart.noendytick']==false){RG.text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':prop['chart.xaxispos']=='top'?this.gutterTop+offsety:(ca.height-this.gutterBottom),'text':prop['chart.units.pre']+Number(0).toFixed(prop['chart.scale.decimals'])+prop['chart.units.post']+offsety,'valign':'center','halign':align,'bounding':bounding,'boundingFill':bgcolor,'tag':'scale'});}}else if(prop['chart.ylabels']&&typeof(prop['chart.ylabels.specific'])=='object'){var gap=this.grapharea/prop['chart.ylabels.specific'].length;var halign=prop['chart.yaxispos']=='left'?'right':'left';var bounding=false;var bgcolor=null;var ymin=prop['chart.ymin']!=null&&prop['chart.ymin'];if(prop['chart.yaxispos']=='left'){var x=this.gutterLeft-5;if(prop['chart.ylabels.inside']){x+=10;halign='left';bounding=true;bgcolor='rgba(255,255,255,0.5)';}}else if(prop['chart.yaxispos']=='right'){var x=ca.width-this.gutterRight+5;if(prop['chart.ylabels.inside']){x-=10;halign='right';bounding=true;bgcolor='rgba(255,255,255,0.5)';}}
+var offsetx=prop['chart.ylabels.offsetx'];var offsety=prop['chart.ylabels.offsety'];if(prop['chart.xaxispos']=='center'){for(var i=0;i<prop['chart.ylabels.specific'].length;++i){var y=this.gutterTop+(this.grapharea/(((prop['chart.ylabels.specific'].length-1))*2)*i);if(ymin&&ymin>0){var y=((this.grapharea/2)/(prop['chart.ylabels.specific'].length-(ymin?1:0)))*i;y+=this.gutterTop;}
+RG.text2(this,{'font':font,'size':text_size,'x':x+offsetx,'y':y+offsety,'text':String(prop['chart.ylabels.specific'][i]),'valign':'center','halign':halign,'bounding':bounding,'boundingFill':bgcolor,'tag':'ylabels.specific'});}
+var reversed_labels=RG.array_reverse(prop['chart.ylabels.specific']);for(var i=0;i<reversed_labels.length;++i){var y=(this.grapharea/2)+this.gutterTop+((this.grapharea/((reversed_labels.length-1)*2))*i);RG.text2(this,{'font':font,'size':text_size,'x':x+offsetx,'y':y+offsety,'text':i==0?'':String(reversed_labels[i]),'valign':'center','halign':halign,'bounding':bounding,'boundingFill':bgcolor,'tag':'ylabels.specific'});}}else if(prop['chart.xaxispos']=='top'){var reversed_labels=RG.array_reverse(prop['chart.ylabels.specific']);for(var i=0;i<reversed_labels.length;++i){var y=(this.grapharea/(reversed_labels.length-1))*i;y=y+this.gutterTop;RG.Text2(this,{'font':font,'size':text_size,'x':x+offsetx,'y':y+offsety,'text':String(reversed_labels[i]),'valign':'center','halign':halign,'bounding':bounding,'boundingFill':bgcolor,'tag':'ylabels.specific'});}}else{for(var i=0;i<prop['chart.ylabels.specific'].length;++i){var y=this.gutterTop+((this.grapharea/(prop['chart.ylabels.specific'].length-1))*i);RG.text2(this,{'font':font,'size':text_size,'x':x+offsetx,'y':y+offsety,'text':String(prop['chart.ylabels.specific'][i]),'valign':'center','halign':halign,'bounding':bounding,'boundingFill':bgcolor,'tag':'ylabels.specific'});}}}
+if(prop['chart.labels']&&prop['chart.labels'].length>0){var yOffset=5,bordered=false,bgcolor=null
+co.fillStyle=prop['chart.labels.color']||prop['chart.text.color'];var angle=0,valign='top',halign='center',bold=prop['chart.labels.bold']
+if(prop['chart.xlabels.inside']){yOffset=-5;bordered=true;bgcolor=prop['chart.xlabels.inside.color'];valign='bottom';}
+if(prop['chart.xaxispos']=='top'){valign='bottom';yOffset+=2;}
+if(typeof(prop['chart.text.angle'])=='number'&&prop['chart.text.angle']>0){angle=-1*prop['chart.text.angle'];valign='center';halign='right';yOffset=10;if(prop['chart.xaxispos']=='top'){yOffset=10;}}
+var numLabels=prop['chart.labels'].length,offsetx=prop['chart.labels.offsetx'],offsety=prop['chart.labels.offsety'];for(i=0;i<numLabels;++i){if(prop['chart.labels'][i]){var labelX=((ca.width-this.gutterLeft-this.gutterRight-(2*prop['chart.hmargin']))/(numLabels-1))*i;labelX+=this.gutterLeft+prop['chart.hmargin'];if(this.data.length===0||!this.data[0]||prop['chart.labels'].length!=this.data[0].length){labelX=this.gutterLeft+prop['chart.hmargin']+((ca.width-this.gutterLeft-this.gutterRight-(2*prop['chart.hmargin']))*(i/(prop['chart.labels'].length-1)));}
+if(!labelX){labelX=this.gutterLeft+prop['chart.hmargin'];}
+if(prop['chart.xaxispos']=='top'&&prop['chart.text.angle']>0){halign='left';}
+if(prop['chart.text.angle']!=0){halign='right';}
+RG.Text2(this,{'font':font,'size':text_size,'bold':bold,'x':labelX+offsetx,'y':(prop['chart.xaxispos']=='top')?this.gutterTop-yOffset-(prop['chart.xlabels.inside']?-22:0)+offsety:(ca.height-this.gutterBottom)+yOffset+offsety,'text':String(prop['chart.labels'][i]),'valign':valign,'halign':halign,'bounding':bordered,'boundingFill':bgcolor,'angle':angle,'tag':'labels'});}}}
+co.stroke();co.fill();}
+this.drawLine=this.DrawLine=function(lineData,color,fill,linewidth,tickmarks,index)
+{if(prop['chart.animation.unfold.y']&&prop['chart.animation.factor']!=1){for(var i=0;i<lineData.length;++i){lineData[i]*=prop['chart.animation.factor'];}}
+var penUp=false;var yPos=null;var xPos=0;co.lineWidth=1;var lineCoords=[];if(index>0){var prevLineCoords=this.coords2[index-1];}
+var xInterval=(ca.width-(2*prop['chart.hmargin'])-this.gutterLeft-this.gutterRight)/(lineData.length-1);for(i=0,len=lineData.length;i<len;i+=1){var data_point=lineData[i];var yPos=this.getYCoord(data_point);if(lineData[i]==null||(prop['chart.xaxispos']=='bottom'&&lineData[i]<this.min&&!prop['chart.outofbounds'])||(prop['chart.xaxispos']=='center'&&lineData[i]<(-1*this.max)&&!prop['chart.outofbounds'])||(((lineData[i]<this.min&&prop['chart.xaxispos']!=='center')||lineData[i]>this.max)&&!prop['chart.outofbounds'])){yPos=null;}
+co.lineCap='round';co.lineJoin='round';if(i>0){xPos=xPos+xInterval;}else{xPos=prop['chart.hmargin']+this.gutterLeft;}
+if(prop['chart.animation.unfold.x']){xPos*=prop['chart.animation.factor'];if(xPos<prop['chart.gutter.left']){xPos=prop['chart.gutter.left'];}}
+this.coords.push([xPos,yPos]);lineCoords.push([xPos,yPos]);}
+co.stroke();this.coords2[index]=lineCoords;if(RG.ISOLD&&prop['chart.shadow']){this.DrawIEShadow(lineCoords,co.shadowColor);}
+co.beginPath();co.strokeStyle='rgba(0,0,0,0)';if(fill){co.fillStyle=fill;}
+var isStepped=prop['chart.stepped'];var isFilled=prop['chart.filled'];if(prop['chart.xaxispos']=='top'){var xAxisPos=this.gutterTop;}else if(prop['chart.xaxispos']=='center'){var xAxisPos=this.gutterTop+(this.grapharea/2);}else if(prop['chart.xaxispos']=='bottom'){var xAxisPos=this.getYCoord(prop['chart.ymin'])}
+for(var i=0,len=lineCoords.length;i<len;i+=1){xPos=lineCoords[i][0];yPos=lineCoords[i][1];var set=index;var prevY=(lineCoords[i-1]?lineCoords[i-1][1]:null);var isLast=(i+1)==lineCoords.length;if(!prop['chart.outofbounds']&&(prevY<this.gutterTop||prevY>(ca.height-this.gutterBottom))){penUp=true;}
+if(i==0||penUp||!yPos||!prevY||prevY<this.gutterTop){if(prop['chart.filled']&&!prop['chart.filled.range']){if(!prop['chart.outofbounds']||prevY===null||yPos===null){co.moveTo(xPos+1,xAxisPos);}
+if(prop['chart.xaxispos']=='top'){co.moveTo(xPos+1,xAxisPos);}
+if(isStepped&&i>0){co.lineTo(xPos,lineCoords[i-1][1]);}
+co.lineTo(xPos,yPos);}else{if(RG.ISOLD&&yPos==null){}else{co.moveTo(xPos+1,yPos);}}
+if(yPos==null){penUp=true;}else{penUp=false;}}else{if(isStepped){co.lineTo(xPos,lineCoords[i-1][1]);}
+if((yPos>=this.gutterTop&&yPos<=(ca.height-this.gutterBottom))||prop['chart.outofbounds']){if(isLast&&prop['chart.filled']&&!prop['chart.filled.range']&&prop['chart.yaxispos']=='right'){xPos-=1;}
+if(!isStepped||!isLast){co.lineTo(xPos,yPos);if(isFilled&&lineCoords[i+1]&&lineCoords[i+1][1]==null){co.lineTo(xPos,xAxisPos);}}else if(isStepped&&isLast){co.lineTo(xPos,yPos);}
+penUp=false;}else{penUp=true;}}}
+if(prop['chart.filled']&&!prop['chart.filled.range']&&!prop['chart.curvy']){var fillStyle=prop['chart.fillstyle'];if(index>0&&prop['chart.filled.accumulative']){co.lineTo(xPos,prevLineCoords?prevLineCoords[i-1][1]:(ca.height-this.gutterBottom-1+(prop['chart.xaxispos']=='center'?(ca.height-this.gutterTop-this.gutterBottom)/2:0)));for(var k=(i-1);k>=0;--k){co.lineTo(k==0?prevLineCoords[k][0]+1:prevLineCoords[k][0],prevLineCoords[k][1]);}}else{if(prop['chart.xaxispos']=='top'){co.lineTo(xPos,prop['chart.gutter.top']+1);co.lineTo(lineCoords[0][0],prop['chart.gutter.top']+1);}else if(typeof(lineCoords[i-1][1])=='number'){var yPosition=this.getYCoord(0);co.lineTo(xPos,yPosition);co.lineTo(lineCoords[0][0],yPosition);}}
+co.fillStyle=!this.hidden(index)?fill:'rgba(0,0,0,0)';co.fill();co.beginPath();}
+co.stroke();if(prop['chart.backdrop']){this.DrawBackdrop(lineCoords,color);}
+co.save();co.beginPath();co.rect(0,0,ca.width*prop['chart.animation.trace.clip'],ca.height);co.clip();if(typeof prop['chart.errorbars']!=='null'){this.drawErrorbars();}
+this.SetShadow(index);this.RedrawLine(lineCoords,color,linewidth,index);co.stroke();RG.NoShadow(this);for(var i=0;i<lineCoords.length;++i){i=Number(i);co.strokeStyle=color;if(isStepped&&i==(lineCoords.length-1)){co.beginPath();}
+if((tickmarks!='endcircle'&&tickmarks!='endsquare'&&tickmarks!='filledendsquare'&&tickmarks!='endtick'&&tickmarks!='endtriangle'&&tickmarks!='arrow'&&tickmarks!='filledarrow')||(i==0&&tickmarks!='arrow'&&tickmarks!='filledarrow')||i==(lineCoords.length-1)){var prevX=(i<=0?null:lineCoords[i-1][0]);var prevY=(i<=0?null:lineCoords[i-1][1]);this.DrawTick(lineData,lineCoords[i][0],lineCoords[i][1],color,false,prevX,prevY,tickmarks,i,index);}}
+co.restore();co.beginPath();co.arc(ca.width+50000,ca.height+50000,2,0,6.38,1);};this.drawTick=this.DrawTick=function(lineData,xPos,yPos,color,isShadow,prevX,prevY,tickmarks,index,dataset)
+{if(this.hidden(dataset)){return;}else if(RG.is_null(yPos)){return false;}else if((yPos>(ca.height-this.gutterBottom))&&!prop['chart.outofbounds']){return;}else if((yPos<this.gutterTop)&&!prop['chart.outofbounds']){return;}
+co.beginPath();var offset=0;co.lineWidth=prop['chart.tickmarks.linewidth']?prop['chart.tickmarks.linewidth']:prop['chart.linewidth'];co.strokeStyle=isShadow?prop['chart.shadow.color']:co.strokeStyle;co.fillStyle=isShadow?prop['chart.shadow.color']:co.strokeStyle;if(tickmarks=='circle'||tickmarks=='filledcircle'||tickmarks=='endcircle'){if(tickmarks=='circle'||tickmarks=='filledcircle'||(tickmarks=='endcircle'&&(index==0||index==(lineData.length-1)))){co.beginPath();co.arc(xPos+offset,yPos+offset,prop['chart.ticksize'],0,360/(180/RG.PI),false);if(tickmarks=='filledcircle'){co.fillStyle=isShadow?prop['chart.shadow.color']:co.strokeStyle;}else{co.fillStyle=isShadow?prop['chart.shadow.color']:'white';}
+co.stroke();co.fill();}}else if(tickmarks=='halftick'){co.beginPath();co.moveTo(Math.round(xPos),yPos);co.lineTo(Math.round(xPos),yPos+prop['chart.ticksize']);co.stroke();}else if(tickmarks=='tick'){co.beginPath();co.moveTo(Math.round(xPos),yPos-prop['chart.ticksize']);co.lineTo(Math.round(xPos),yPos+prop['chart.ticksize']);co.stroke();}else if(tickmarks=='endtick'&&(index==0||index==(lineData.length-1))){co.beginPath();co.moveTo(Math.round(xPos),yPos-prop['chart.ticksize']);co.lineTo(Math.round(xPos),yPos+prop['chart.ticksize']);co.stroke();}else if(tickmarks=='cross'){co.beginPath();var ticksize=prop['chart.ticksize'];co.moveTo(xPos-ticksize,yPos-ticksize);co.lineTo(xPos+ticksize,yPos+ticksize);co.moveTo(xPos+ticksize,yPos-ticksize);co.lineTo(xPos-ticksize,yPos+ticksize);co.stroke();}else if(tickmarks=='triangle'||tickmarks=='filledtriangle'||(tickmarks=='endtriangle'&&(index==0||index==(lineData.length-1)))){co.beginPath();if(tickmarks=='filledtriangle'){co.fillStyle=isShadow?prop['chart.shadow.color']:co.strokeStyle;}else{co.fillStyle='white';}
+co.moveTo(ma.round(xPos-prop['chart.ticksize']),yPos+prop['chart.ticksize']);co.lineTo(ma.round(xPos),yPos-prop['chart.ticksize']);co.lineTo(ma.round(xPos+prop['chart.ticksize']),yPos+prop['chart.ticksize']);co.closePath();co.stroke();co.fill();}else if(tickmarks=='borderedcircle'||tickmarks=='dot'){co.lineWidth=prop['chart.tickmarks.dot.linewidth']||0.00000001;pa2(co,['b','a',xPos,yPos,prop['chart.ticksize'],0,360/(180/RG.PI),false,'c','f',prop['chart.tickmarks.dot.fill']||color,'s',prop['chart.tickmarks.dot.stroke']||color]);}else if(tickmarks=='square'||tickmarks=='filledsquare'||(tickmarks=='endsquare'&&(index==0||index==(lineData.length-1)))||(tickmarks=='filledendsquare'&&(index==0||index==(lineData.length-1)))){co.fillStyle='white';co.strokeStyle=co.strokeStyle;co.beginPath();co.rect(Math.round(xPos-prop['chart.ticksize']),Math.round(yPos-prop['chart.ticksize']),prop['chart.ticksize']*2,prop['chart.ticksize']*2);if(tickmarks=='filledsquare'||tickmarks=='filledendsquare'){co.fillStyle=isShadow?prop['chart.shadow.color']:co.strokeStyle;co.rect(Math.round(xPos-prop['chart.ticksize']),Math.round(yPos-prop['chart.ticksize']),prop['chart.ticksize']*2,prop['chart.ticksize']*2);}else if(tickmarks=='square'||tickmarks=='endsquare'){co.fillStyle=isShadow?prop['chart.shadow.color']:'white';co.rect(Math.round((xPos-prop['chart.ticksize'])+1),Math.round((yPos-prop['chart.ticksize'])+1),(prop['chart.ticksize']*2)-2,(prop['chart.ticksize']*2)-2);}
+co.stroke();co.fill();}else if(tickmarks=='filledarrow'){var x=Math.abs(xPos-prevX);var y=Math.abs(yPos-prevY);if(yPos<prevY){var a=Math.atan(x/y)+1.57;}else{var a=Math.atan(y/x)+3.14;}
+co.beginPath();co.moveTo(Math.round(xPos),Math.round(yPos));co.arc(Math.round(xPos),Math.round(yPos),7,a-0.5,a+0.5,false);co.closePath();co.stroke();co.fill();}else if(tickmarks=='arrow'){var orig_linewidth=co.lineWidth;var x=Math.abs(xPos-prevX);var y=Math.abs(yPos-prevY);co.lineWidth;if(yPos<prevY){var a=Math.atan(x/y)+1.57;}else{var a=Math.atan(y/x)+3.14;}
+co.beginPath();co.moveTo(Math.round(xPos),Math.round(yPos));co.arc(Math.round(xPos),Math.round(yPos),7,a-0.5-(doc.all?0.1:0.01),a-0.4,false);co.moveTo(Math.round(xPos),Math.round(yPos));co.arc(Math.round(xPos),Math.round(yPos),7,a+0.5+(doc.all?0.1:0.01),a+0.5,true);co.stroke();co.fill();co.lineWidth=orig_linewidth;}else if(typeof tickmarks==='string'&&(tickmarks.substr(0,6)==='image:'||tickmarks.substr(0,5)==='data:'||tickmarks.substr(0,1)==='/'||tickmarks.substr(0,3)==='../'||tickmarks.substr(0,7)==='images/')){var img=new Image();if(tickmarks.substr(0,6)==='image:'){img.src=tickmarks.substr(6);}else{img.src=tickmarks;}
+img.onload=function()
+{if(prop['chart.tickmarks.image.halign']==='center')xPos-=(this.width/2);if(prop['chart.tickmarks.image.halign']==='right')xPos-=this.width;if(prop['chart.tickmarks.image.valign']==='center')yPos-=(this.height/2);if(prop['chart.tickmarks.image.valign']==='bottom')yPos-=this.height;xPos+=prop['chart.tickmarks.image.offsetx'];yPos+=prop['chart.tickmarks.image.offsety'];co.drawImage(this,xPos,yPos);};}else if(typeof(tickmarks)=='function'){tickmarks(this,lineData,lineData[index],index,xPos,yPos,color,prevX,prevY);}};this.drawRange=this.DrawRange=function()
+{if(prop['chart.filled.range']&&prop['chart.filled']){if(RG.isNull(prop['chart.filled.range.threshold'])){prop['chart.filled.range.threshold']=this.ymin
+prop['chart.filled.range.threshold.colors']=[prop['chart.fillstyle'],prop['chart.fillstyle']]}
+for(var idx=0;idx<2;++idx){var threshold_colors=prop['chart.filled.range.threshold.colors'];var y=this.getYCoord(prop['chart.filled.range.threshold'])
+co.save();if(idx==0){co.beginPath();co.rect(0,0,ca.width,y);co.clip();}else{co.beginPath();co.rect(0,y,ca.width,ca.height);co.clip();}
+co.beginPath();co.fillStyle=(idx==1?prop['chart.filled.range.threshold.colors'][1]:prop['chart.filled.range.threshold.colors'][0]);co.lineWidth=!this.hidden(idx)?1:0;var len=(this.coords.length/2);for(var i=0;i<len;++i){if(!RG.is_null(this.coords[i][1])){if(i==0){co.moveTo(this.coords[i][0],this.coords[i][1])}else{co.lineTo(this.coords[i][0],this.coords[i][1])}}}
+for(var i=this.coords.length-1;i>=len;--i){if(RG.is_null(this.coords[i][1])){co.moveTo(this.coords[i][0],this.coords[i][1])}else{co.lineTo(this.coords[i][0],this.coords[i][1])}}
+co.fill();co.restore();}}};this.redrawLine=this.RedrawLine=function(coords,color,linewidth,index)
+{if(prop['chart.noredraw']||prop['chart.filled.range']){return;}
+co.strokeStyle=(typeof(color)=='object'&&color&&color.toString().indexOf('CanvasGradient')==-1?color[0]:color);co.lineWidth=linewidth;if(this.hidden(index)){co.strokeStyle='rgba(0,0,0,0)';}
+if(!RG.ISOLD&&(prop['chart.curvy']||prop['chart.spline'])){this.DrawCurvyLine(coords,this.hidden(index)?'rgba(0,0,0,0)':color,linewidth,index);return;}
+co.beginPath();var len=coords.length;var width=ca.width
+var height=ca.height;var penUp=false;for(var i=0;i<len;++i){var xPos=coords[i][0];var yPos=coords[i][1];if(i>0){var prevX=coords[i-1][0];var prevY=coords[i-1][1];}
+if(((i==0&&coords[i])||(yPos<this.gutterTop)||(prevY<this.gutterTop)||(yPos>(height-this.gutterBottom))||(i>0&&prevX>(width-this.gutterRight))||(i>0&&prevY>(height-this.gutterBottom))||prevY==null||penUp==true)&&(!prop['chart.outofbounds']||yPos==null||prevY==null)){if(RG.ISOLD&&yPos==null){}else{co.moveTo(coords[i][0],coords[i][1]);}
+penUp=false;}else{if(prop['chart.stepped']&&i>0){co.lineTo(coords[i][0],coords[i-1][1]);}
+co.lineTo(coords[i][0],coords[i][1]);penUp=false;}}
+if(prop['chart.colors.alternate']&&typeof(color)=='object'&&color[0]&&color[1]){for(var i=1;i<len;++i){var prevX=coords[i-1][0];var prevY=coords[i-1][1];if(prevY!=null&&coords[i][1]!=null){co.beginPath();co.strokeStyle=color[coords[i][1]<prevY?0:1];co.lineWidth=prop['chart.linewidth'];co.moveTo(prevX,prevY);co.lineTo(coords[i][0],coords[i][1]);co.stroke();}}}};this.drawIEShadow=this.DrawIEShadow=function(coords,color)
+{var offsetx=prop['chart.shadow.offsetx'];var offsety=prop['chart.shadow.offsety'];co.lineWidth=prop['chart.linewidth'];co.strokeStyle=color;co.beginPath();for(var i=0;i<coords.length;++i){var isNull=RG.isNull(coords[i][1]);var prevIsNull=RG.isNull(coords[i-1])||RG.isNull(coords[i-1][1]);if(i==0||isNull||prevIsNull){if(!isNull){co.moveTo(coords[i][0]+offsetx,coords[i][1]+offsety);}}else{co.lineTo(coords[i][0]+offsetx,coords[i][1]+offsety);}}
+co.stroke();};this.drawBackdrop=this.DrawBackdrop=function(coords,color)
+{var size=prop['chart.backdrop.size'];co.lineWidth=size;co.globalAlpha=prop['chart.backdrop.alpha'];co.strokeStyle=color;var yCoords=[];co.beginPath();if(prop['chart.curvy']&&!RG.ISOLD){for(var i=0;i<coords.length;++i){yCoords.push(coords[i][1])}
+this.DrawSpline(co,yCoords,color,null);}else{co.moveTo(coords[0][0],coords[0][1]);for(var j=1;j<coords.length;++j){co.lineTo(coords[j][0],coords[j][1]);}}
+co.stroke();co.globalAlpha=1;RG.NoShadow(this);};this.getLineWidth=this.GetLineWidth=function(i)
+{var linewidth=prop['chart.linewidth'];if(typeof(linewidth)=='number'){return linewidth;}else if(typeof(linewidth)=='object'){if(linewidth[i]){return linewidth[i];}else{return linewidth[0];}
+alert('[LINE] Error! chart.linewidth should be a single number or an array of one or more numbers');}};this.getShape=this.getPoint=function(e)
+{var obj=this,RG=RGraph,ca=canvas=e.target,co=context=this.context,prop=this.properties;var mouseXY=RG.getMouseXY(e),mouseX=mouseXY[0],mouseY=mouseXY[1];if(arguments[1]){obj=arguments[1];}
+for(var i=0;i<obj.coords.length;++i){var x=obj.coords[i][0];var y=obj.coords[i][1];if(mouseX<=(x+prop['chart.tooltips.hotspot.size'])&&mouseX>=(x-prop['chart.tooltips.hotspot.size'])&&mouseY<=(y+prop['chart.tooltips.hotspot.size'])&&mouseY>=(y-prop['chart.tooltips.hotspot.size'])){if(RG.parseTooltipText){var tooltip=RG.parseTooltipText(prop['chart.tooltips'],i);}
+var dataset=0;var idx=i;while((idx+1)>this.data[dataset].length){idx-=this.data[dataset].length;dataset++;}
+return{0:obj,1:x,2:y,3:i,'object':obj,'x':x,'y':y,'index':i,'tooltip':tooltip,'dataset':dataset,'index_adjusted':idx};}else if(prop['chart.tooltips.hotspot.xonly']==true&&mouseX<=(x+prop['chart.tooltips.hotspot.size'])&&mouseX>=(x-prop['chart.tooltips.hotspot.size'])){var tooltip=RG.parseTooltipText(prop['chart.tooltips'],i);return{0:obj,1:x,2:y,3:i,'object':obj,'x':x,'y':y,'index':i,'tooltip':tooltip};}}};this.drawAboveLabels=this.DrawAboveLabels=function()
+{var size=prop['chart.labels.above.size'],font=prop['chart.labels.above.font']||prop['chart.text.font'],units_pre=prop['chart.labels.above.units.pre'],units_post=prop['chart.labels.above.units.post'],decimals=prop['chart.labels.above.decimals'],color=prop['chart.labels.above.color']||prop['chart.text.color'],bgcolor=prop['chart.labels.above.background']||'white',border=((typeof prop['chart.labels.above.border']==='boolean'||typeof prop['chart.labels.above.border']==='number')?prop['chart.labels.above.border']:true),offsety=prop['chart.labels.above.offsety']+size,specific=prop['chart.labels.above.specific'];co.beginPath();for(var i=0,len=this.coords.length;i<len;i+=1){var coords=this.coords[i];RG.text2(this,{color:color,'font':font,'size':size,'x':coords[0],'y':coords[1]-offsety,'text':(specific&&specific[i])?specific[i]:(specific?null:RG.numberFormat(this,typeof decimals==='number'?this.data_arr[i].toFixed(decimals):this.data_arr[i],units_pre,units_post)),'valign':'center','halign':'center','bounding':true,'boundingFill':bgcolor,'boundingStroke':border?'black':'rgba(0,0,0,0)','tag':'labels.above'});}};this.drawCurvyLine=this.DrawCurvyLine=function(coords,color,linewidth,index)
+{var yCoords=[];for(var i=0;i<coords.length;++i){yCoords.push(coords[i][1]);}
+if(prop['chart.filled']){co.beginPath();var xaxisY=this.getYCoord(prop['chart.ymin']);co.moveTo(coords[0][0],xaxisY);this.drawSpline(co,yCoords,color,index);if(prop['chart.filled.accumulative']&&index>0){for(var i=(this.coordsSpline[index-1].length-1);i>=0;i-=1){co.lineTo(this.coordsSpline[index-1][i][0],this.coordsSpline[index-1][i][1]);}}else{co.lineTo(coords[coords.length-1][0],xaxisY);}
+co.fill();}
+co.beginPath();this.DrawSpline(co,yCoords,color,index);co.stroke();};this.getValue=function(arg)
+{if(arg.length==2){var mouseX=arg[0];var mouseY=arg[1];}else{var mouseCoords=RG.getMouseXY(arg);var mouseX=mouseCoords[0];var mouseY=mouseCoords[1];}
+var obj=this;var xaxispos=prop['chart.xaxispos'];if(mouseY<prop['chart.gutter.top']){return xaxispos=='bottom'||xaxispos=='center'?this.max:this.min;}else if(mouseY>(ca.height-prop['chart.gutter.bottom'])){return xaxispos=='bottom'?this.min:this.max;}
+if(prop['chart.xaxispos']=='center'){var value=(((obj.grapharea/2)-(mouseY-prop['chart.gutter.top']))/obj.grapharea)*(obj.max-obj.min);value*=2;value>0?value+=this.min:value-=this.min;return value;}else if(prop['chart.xaxispos']=='top'){var value=((obj.grapharea-(mouseY-prop['chart.gutter.top']))/obj.grapharea)*(obj.max-obj.min);value=Math.abs(obj.max-value)* -1;return value;}else{var value=((obj.grapharea-(mouseY-prop['chart.gutter.top']))/obj.grapharea)*(obj.max-obj.min)
+value+=obj.min;return value;}};this.highlight=this.Highlight=function(shape)
+{if(prop['chart.tooltips.highlight']){if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}else if(prop['chart.highlight.style']==='halo'){var obj=shape.object,color=prop['chart.colors'][shape.dataset];RG.path2(obj.context,'b a % % 13 0 6.2830 false f rgba(255,255,255,0.75)',shape.x,shape.y);RG.path2(obj.context,'ga 0.15 b a % % 13 0 6.2830 false f % ga 1',shape.x,shape.y,color);RG.path2(obj.context,'b a % % 7 0 6.2830 false f white',shape.x,shape.y);RG.path2(obj.context,'b a % % 5 0 6.2830 false f %',shape.x,shape.y,color);}else{RG.Highlight.Point(this,shape);}}};this.getObjectByXY=function(e)
+{var mouseXY=RG.getMouseXY(e);if((mouseXY[0]>prop['chart.gutter.left']-5)&&mouseXY[0]<(ca.width-prop['chart.gutter.right']+5)&&mouseXY[1]>(prop['chart.gutter.top']-5)&&mouseXY[1]<(ca.height-prop['chart.gutter.bottom']+5)){return this;}};this.adjusting_mousemove=this.Adjusting_mousemove=function(e)
+{if(prop['chart.adjustable']&&RG.Registry.Get('chart.adjusting')&&RG.Registry.Get('chart.adjusting').uid==this.uid){var value=Number(this.getValue(e));var shape=RG.Registry.Get('chart.adjusting.shape');if(shape){RG.Registry.Set('chart.adjusting.shape',shape);this.original_data[shape['dataset']][shape['index_adjusted']]=Number(value);RG.redrawCanvas(e.target);RG.fireCustomEvent(this,'onadjust');}}};this.getYCoord=function(value)
+{if(typeof(value)!='number'){return null;}
+var y;var xaxispos=prop['chart.xaxispos'];if(xaxispos=='top'){y=((value-this.min)/(this.max-this.min))*this.grapharea;if(prop['chart.scale.invert']){y=this.grapharea-y;}
+y=y+this.gutterTop}else if(xaxispos=='center'){y=((value-this.min)/(this.max-this.min))*(this.grapharea/2);y=(this.grapharea/2)-y;y+=this.gutterTop;}else{if((value<this.min||value>this.max)&&prop['chart.outofbounds']==false){return null;}
+y=((value-this.min)/(this.max-this.min))*this.grapharea;if(prop['chart.scale.invert']){y=this.grapharea-y;}
+y=ca.height-this.gutterBottom-y;}
+return y;};this.drawSpline=this.DrawSpline=function(context,coords,color,index)
+{this.coordsSpline[index]=[];var xCoords=[];var gutterLeft=prop['chart.gutter.left'];var gutterRight=prop['chart.gutter.right'];var hmargin=prop['chart.hmargin'];var interval=(ca.width-(gutterLeft+gutterRight)-(2*hmargin))/(coords.length-1);co.strokeStyle=color;for(var i=0,len=coords.length;i<len;i+=1){if(typeof coords[i]=='object'&&coords[i]&&coords[i].length==2){coords[i]=Number(coords[i][1]);}}
+var P=[coords[0]];for(var i=0;i<coords.length;++i){P.push(coords[i]);}
+P.push(coords[coords.length-1]+(coords[coords.length-1]-coords[coords.length-2]));for(var j=1;j<P.length-2;++j){for(var t=0;t<10;++t){var yCoord=Spline(t/10,P[j-1],P[j],P[j+1],P[j+2]);xCoords.push(((j-1)*interval)+(t*(interval/10))+gutterLeft+hmargin);co.lineTo(xCoords[xCoords.length-1],yCoord);if(typeof index=='number'){this.coordsSpline[index].push([xCoords[xCoords.length-1],yCoord]);}}}
+co.lineTo(((j-1)*interval)+gutterLeft+hmargin,P[j]);if(typeof index=='number'){this.coordsSpline[index].push([((j-1)*interval)+gutterLeft+hmargin,P[j]]);}
+function Spline(t,P0,P1,P2,P3)
+{return 0.5*((2*P1)+
+((0-P0)+P2)*t+
+((2*P0-(5*P1)+(4*P2)-P3)*(t*t)+
+((0-P0)+(3*P1)-(3*P2)+P3)*(t*t*t)));}};this.parseColors=function()
+{if(this.original_colors.length===0){this.original_colors['chart.colors']=RGraph.array_clone(prop['chart.colors']);this.original_colors['chart.fillstyle']=RGraph.array_clone(prop['chart.fillstyle']);this.original_colors['chart.key.colors']=RGraph.array_clone(prop['chart.key.colors']);this.original_colors['chart.background.barcolor1']=prop['chart.background.barcolor1'];this.original_colors['chart.background.barcolor2']=prop['chart.background.barcolor2'];this.original_colors['chart.background.grid.color']=prop['chart.background.grid.color'];this.original_colors['chart.background.color']=prop['chart.background.color'];this.original_colors['chart.text.color']=prop['chart.text.color'];this.original_colors['chart.crosshairs.color']=prop['chart.crosshairs.color'];this.original_colors['chart.annotate.color']=prop['chart.annotate.color'];this.original_colors['chart.title.color']=prop['chart.title.color'];this.original_colors['chart.title.yaxis.color']=prop['chart.title.yaxis.color'];this.original_colors['chart.key.background']=prop['chart.key.background'];this.original_colors['chart.axis.color']=prop['chart.axis.color'];this.original_colors['chart.highlight.fill']=prop['chart.highlight.fill'];}
+for(var i=0;i<prop['chart.colors'].length;++i){if(typeof(prop['chart.colors'][i])=='object'&&prop['chart.colors'][i][0]&&prop['chart.colors'][i][1]){prop['chart.colors'][i][0]=this.parseSingleColorForGradient(prop['chart.colors'][i][0]);prop['chart.colors'][i][1]=this.parseSingleColorForGradient(prop['chart.colors'][i][1]);}else{prop['chart.colors'][i]=this.parseSingleColorForGradient(prop['chart.colors'][i]);}}
+if(prop['chart.fillstyle']){if(typeof(prop['chart.fillstyle'])=='string'){prop['chart.fillstyle']=this.parseSingleColorForGradient(prop['chart.fillstyle'],'vertical');}else{for(var i=0;i<prop['chart.fillstyle'].length;++i){prop['chart.fillstyle'][i]=this.parseSingleColorForGradient(prop['chart.fillstyle'][i],'vertical');}}}
+if(!RG.is_null(prop['chart.key.colors'])){for(var i=0;i<prop['chart.key.colors'].length;++i){prop['chart.key.colors'][i]=this.parseSingleColorForGradient(prop['chart.key.colors'][i]);}}
+var properties=['chart.background.barcolor1','chart.background.barcolor2','chart.background.grid.color','chart.background.color','chart.text.color','chart.crosshairs.color','chart.annotate.color','chart.title.color','chart.title.yaxis.color','chart.key.background','chart.axis.color','chart.highlight.fill'];for(var i=0;i<properties.length;++i){prop[properties[i]]=this.parseSingleColorForGradient(prop[properties[i]]);}};this.reset=function()
+{};this.parseSingleColorForGradient=function(color)
+{if(!color||typeof(color)!='string'){return color;}
+var dir=typeof(arguments[1])=='string'?arguments[1]:'vertical';if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){var parts=RegExp.$1.split(':');if(dir=='horizontal'){var grad=co.createLinearGradient(0,0,ca.width,0);}else{var grad=co.createLinearGradient(0,ca.height-prop['chart.gutter.bottom'],0,prop['chart.gutter.top']);}
+var diff=1/(parts.length-1);grad.addColorStop(0,RG.trim(parts[0]));for(var j=1;j<parts.length;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}}
+return grad?grad:color;};this.setShadow=this.SetShadow=function(i)
+{if(prop['chart.shadow']){var shadowColor=prop['chart.shadow.color'];if(typeof(shadowColor)=='object'&&shadowColor[i-1]){co.shadowColor=shadowColor[i];}else if(typeof(shadowColor)=='object'){co.shadowColor=shadowColor[0];}else if(typeof(shadowColor)=='string'){co.shadowColor=shadowColor;}
+co.shadowBlur=prop['chart.shadow.blur'];co.shadowOffsetX=prop['chart.shadow.offsetx'];co.shadowOffsetY=prop['chart.shadow.offsety'];}};this.interactiveKeyHighlight=function(index)
+{var coords=this.coords2[index];if(coords){var pre_linewidth=co.lineWidth;var pre_linecap=co.lineCap;co.lineWidth=prop['chart.linewidth']+10;co.lineCap='round';co.strokeStyle=prop['chart.key.interactive.highlight.chart.stroke'];co.beginPath();if(prop['chart.curvy']){this.DrawSpline(co,coords,prop['chart.key.interactive.highlight.chart'],null);}else{for(var i=0,len=coords.length;i<len;i+=1){if(i==0||RG.is_null(coords[i][1])||(typeof coords[i-1][1]!=undefined&&RG.is_null(coords[i-1][1]))){co.moveTo(coords[i][0],coords[i][1]);}else{co.lineTo(coords[i][0],coords[i][1]);}}}
+co.stroke();co.lineWidth=pre_linewidth;co.lineCap=pre_linecap;}};this.on=function(type,func)
+{if(type.substr(0,2)!=='on'){type='on'+type;}
+if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
+return this;};this.firstDrawFunc=function()
+{};this.drawErrorbars=function()
+{co.save();RG.noShadow(this);var coords=this.coords,x=0,errorbars=prop['chart.errorbars'],length=0;if(!prop['chart.errorbars.capped']){prop['chart.errorbars.capped.width']=0.001;halfwidth=0.0005;}
+co.lineWidth=prop['chart.errorbars.linewidth'];for(var i=0;i<coords.length;++i){var halfwidth=prop['chart.errorbars.capped.width']/2||5,color=prop['chart.errorbars.color']||'black';if(errorbars[i]&&typeof errorbars[i][3]==='number'){co.lineWidth=errorbars[i][3];}else if(typeof prop['chart.errorbars.linewidth']==='number'){co.lineWidth=prop['chart.errorbars.linewidth'];}else{co.lineWidth=1;}
+if(typeof errorbars==='number'||typeof errorbars[i]==='number'){if(typeof errorbars==='number'){var positiveLength=this.getYCoord(this.min)-this.getYCoord(this.min+errorbars),negativeLength=positiveLength;}else{var positiveLength=this.getYCoord(this.min)-this.getYCoord(this.min+errorbars[i]),negativeLength=positiveLength;}
+if(positiveLength||negativeLength){pa2(co,'lj miter lc square b m % % l % % m % % l % % l % % m % % l % % s %',coords[i][0]-halfwidth,coords[i][1]+negativeLength,coords[i][0]+halfwidth,coords[i][1]+negativeLength,coords[i][0],coords[i][1]+negativeLength,coords[i][0],coords[i][1]-positiveLength,coords[i][0]-halfwidth,coords[i][1]-positiveLength,coords[i][0],coords[i][1]-positiveLength,coords[i][0]+halfwidth,coords[i][1]-positiveLength,color);pa2(co,'lj miter lc square b m % % l % % s %',coords[i][0]-halfwidth,coords[i][1]+negativeLength,coords[i][0]+halfwidth,coords[i][1]+negativeLength,color);}}else if(typeof errorbars[i]==='object'&&!RG.isNull(errorbars[i])){var positiveLength=this.getYCoord(this.min)-this.getYCoord(this.min+errorbars[i][0]),negativeLength=this.getYCoord(this.min)-this.getYCoord(this.min+errorbars[i][1]);if(typeof errorbars[i][2]==='string'){color=errorbars[i][2];}
+halfwidth=typeof errorbars[i][4]==='number'?errorbars[i][4]/2:halfwidth;if(typeof errorbars[i]==='object'&&typeof errorbars[i][3]==='number'){co.lineWidth=errorbars[i][3];}else if(typeof prop['chart.errorbars.linewidth']==='number'){co.lineWidth=prop['chart.errorbars.linewidth'];}else{co.lineWidth=1;}
+if(!RG.isNull(errorbars[i][0])){pa2(co,'lc square b  m % % l % % l % % m % % l % % s %',coords[i][0],coords[i][1],coords[i][0],coords[i][1]-positiveLength,coords[i][0]-halfwidth,ma.round(coords[i][1]-positiveLength),coords[i][0],ma.round(coords[i][1]-positiveLength),coords[i][0]+halfwidth,ma.round(coords[i][1]-positiveLength),color);}
+if(typeof errorbars[i][1]==='number'){var negativeLength=ma.abs(this.getYCoord(errorbars[i][1])-this.getYCoord(0));pa2(co,'b m % % l % % l % % m % % l % % s %',coords[i][0],coords[i][1],coords[i][0],coords[i][1]+negativeLength,coords[i][0]-halfwidth,ma.round(coords[i][1]+negativeLength),coords[i][0],ma.round(coords[i][1]+negativeLength),coords[i][0]+halfwidth,ma.round(coords[i][1]+negativeLength),color);}}}
+co.restore();};this.hide=function()
+{if(typeof arguments[0]==='number'){prop['chart.line.visible'][arguments[0]]=false;}else if(typeof arguments[0]==='object'){for(var i=0;i<arguments[0].length;++i){prop['chart.line.visible'][arguments[0][i]]=false;}}else{for(var i=0;i<this.original_data.length;++i){prop['chart.line.visible'][i]=false;}}
+RG.redraw();return this;};this.show=function()
+{if(typeof arguments[0]==='number'){prop['chart.line.visible'][arguments[0]]=true;}else if(typeof arguments[0]==='object'){for(var i=0;i<arguments[0].length;++i){prop['chart.line.visible'][arguments[0][i]]=true;}}else{for(var i=0;i<this.original_data.length;++i){prop['chart.line.visible'][i]=true;}}
+RG.redraw();return this;};this.hidden=function(index)
+{return!prop['chart.line.visible'][index];};this.unfold=function()
+{var obj=this;var opt=arguments[0]?arguments[0]:{};var frames=opt.frames?opt.frames:30;var frame=0;var callback=arguments[1]?arguments[1]:function(){};var initial=prop['chart.animation.unfold.initial'];prop['chart.animation.factor']=prop['chart.animation.unfold.initial'];function iterator()
+{prop['chart.animation.factor']=((1-initial)*(frame/frames))+initial;RG.clear(obj.canvas);RG.redrawCanvas(obj.canvas);if(frame<frames){frame++;RG.Effects.updateCanvas(iterator);}else{callback(obj);}}
+iterator();return this;};this.trace=this.trace2=function()
+{var obj=this;var callback=arguments[2];var opt=arguments[0]||{};var frames=opt.frames||30;var frame=0;var callback=arguments[1]||function(){};obj.Set('animation.trace.clip',0);function iterator()
+{RG.clear(obj.canvas);RG.redrawCanvas(obj.canvas);if(frame++<frames){obj.Set('animation.trace.clip',frame/frames);RG.Effects.updateCanvas(iterator);}else{callback(obj);}}
+iterator();return this;};this.foldtocenter=this.foldToCenter=function()
+{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||30;var frame=0;var callback=arguments[1]||function(){};var center_value=obj.scale2.max/2;obj.Set('chart.ymax',obj.scale2.max);var original_data=RG.array_clone(obj.original_data);function iterator()
+{for(var i=0,len=obj.data.length;i<len;++i){if(obj.data[i].length){for(var j=0,len2=obj.data[i].length;j<len2;++j){var dataset=obj.original_data[i];if(dataset[j]>center_value){dataset[j]=original_data[i][j]-((original_data[i][j]-center_value)*(frame/frames));}else{dataset[j]=original_data[i][j]+(((center_value-original_data[i][j])/frames)*frame);}}}}
+RG.clear(obj.canvas);RG.redrawCanvas(obj.canvas)
+if(frame++<frames){RG.Effects.updateCanvas(iterator);}else{callback(obj);}}
+iterator();return this;};this.unfoldFromCenterTrace=this.unfoldFromCenterTrace2=function()
+{var obj=this,opt=arguments[0]||{},frames=opt.frames||30,frame=0,data=RG.arrayClone(obj.original_data),callback=arguments[1]||function(){};obj.canvas.style.visibility='hidden';obj.draw();var max=obj.scale2.max;RG.clear(obj.canvas);obj.canvas.style.visibility='visible';var unfoldCallback=function()
+{obj.original_data=data;obj.unfoldFromCenter({frames:frames/2},callback);};var half=obj.Get('chart.xaxispos')=='center'?obj.min:((obj.max-obj.min)/2)+obj.min;obj.Set('chart.ymax',obj.max);for(var i=0,len=obj.original_data.length;i<len;++i){for(var j=0;j<obj.original_data[i].length;++j){obj.original_data[i][j]=(obj.Get('chart.filled')&&obj.Get('chart.filled.accumulative')&&i>0)?0:half;}}
+RG.clear(obj.canvas);obj.trace2({frames:frames/2},unfoldCallback);return obj;};this.unfoldFromCenter=function()
+{var obj=this;var opt=arguments[0]||{};var frames=opt.frames||30;var frame=0;var callback=arguments[1]||function(){};obj.canvas.style.visibility='hidden';obj.Draw();var max=obj.scale2.max;RG.clear(obj.canvas);obj.canvas.style.visibility='visible';var center_value=obj.Get('chart.xaxispos')==='center'?prop['chart.ymin']:((obj.max-obj.min)/2)+obj.min;var original_data=RG.array_clone(obj.original_data);var steps=null;obj.Set('chart.ymax',max);if(!steps){steps=[];for(var dataset=0,len=original_data.length;dataset<len;++dataset){steps[dataset]=[]
+for(var i=0,len2=original_data[dataset].length;i<len2;++i){if(prop['chart.filled']&&prop['chart.filled.accumulative']&&dataset>0){steps[dataset][i]=original_data[dataset][i]/frames;obj.original_data[dataset][i]=center_value;}else{steps[dataset][i]=(original_data[dataset][i]-center_value)/frames;obj.original_data[dataset][i]=center_value;}}}}
+function unfoldFromCenter()
+{for(var dataset=0;dataset<original_data.length;++dataset){for(var i=0;i<original_data[dataset].length;++i){obj.original_data[dataset][i]+=steps[dataset][i];}}
+RG.clear(obj.canvas);RG.redrawCanvas(obj.canvas);if(--frames>0){RG.Effects.updateCanvas(unfoldFromCenter);}else{obj.original_data=RG.array_clone(original_data);RG.clear(obj.canvas);RG.redrawCanvas(obj.canvas);callback(obj);}}
+unfoldFromCenter();return this;};RG.att(ca);this.isAdjustable=function(shape)
+{if(RG.isNull(prop['chart.adjustable.only'])){return true;}
+if(RG.isArray(prop['chart.adjustable.only'])&&prop['chart.adjustable.only'][shape.index]){return true;}
+return false;};RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}
+for(var i=0;i<this.original_data.length;++i){prop['chart.line.visible'][i]=true;}};
\ No newline at end of file
diff --git a/src/views/elements/ManagegroupsElement.php b/src/views/elements/ManagegroupsElement.php
index 724e937..cb1fd8d 100755
--- a/src/views/elements/ManagegroupsElement.php
+++ b/src/views/elements/ManagegroupsElement.php
@@ -77,6 +77,12 @@ class ManagegroupsElement extends Element
                     <div class="clear">&nbsp;</div><?php
                 }
                 return;
+            case "lastactivity":
+                $this->renderLastActivity($data);
+                if (C\MOBILE) { ?>
+                    <div class="clear">&nbsp;</div><?php
+                }
+                return;
             default:
                 $this->renderGroupsForm($data);
         }
@@ -86,7 +92,7 @@ class ManagegroupsElement extends Element
             $data['TABLE_TITLE'] = tl('managegroups_element_groups');
         }
         $context = "";
-        if ($data['FORM_TYPE'] == 'search' || 
+        if ($data['FORM_TYPE'] == 'search' ||
             !empty($data['context']) && $data['context'] == 'search') {
             $context = 'context=search&amp;';
         }
@@ -710,6 +716,8 @@ class ManagegroupsElement extends Element
         $admin_url = htmlentities(B\controllerUrl('admin', true));
         $base_url = $admin_url . C\CSRF_TOKEN."=".$data[C\CSRF_TOKEN].
             "&amp;a=manageGroups";
+        $last_activity_url = $base_url. "&amp;arg=lastactivity&amp;group_id=".
+            $data['CURRENT_GROUP']['id'];
         ?>
         <div class='float-opposite'><a href='<?=$base_url ?>'><?=
             tl('managegroups_element_addgroup_form') ?></a></div>
@@ -754,18 +762,43 @@ class ManagegroupsElement extends Element
                             tl('managegroup_element_no_activity').
                             "</p>");
                     } else {
-                        e("<p><b>$period_heading</b>: ".
-                            $data['STATISTICS'][$field][
-                            $time_period][0]['NUM_VIEWS']."</p>");
+                        if ($time_period == C\ONE_HOUR ||
+                           $time_period == C\FOREVER) {
+                            e("<p><b>$period_heading</b>: ".
+                                $data['STATISTICS'][$field]
+                                [$time_period][0]['NUM_VIEWS'].
+                                "</p>");
+                        }
+                        else {
+                        e("<p><b>$period_heading</b>:
+                            <a href='".$last_activity_url.
+                            "&amp;impression=".$field.
+                            "&amp;time=".$time_period.
+                            "&amp;item=".$data['STATISTICS'][$field]
+                            [$time_period][0]['ID']."'> ".
+                            $data['STATISTICS'][$field]
+                            [$time_period][0]['NUM_VIEWS'].
+                            "</a></p>");
+                        }
                     }
                 } else {
-                    if(!empty($data['STATISTICS'][$field][
+                    if (!empty($data['STATISTICS'][$field][
                         $time_period])) {
                         ?><h4><?=$period_heading ?>:</h4><?php
                         foreach ($data['STATISTICS'][$field][
                             $time_period] as $item_name => $item_data) {
-                            e("<p>$item_name: ". $item_data[0]['NUM_VIEWS'].
-                                "<p>");
+                            if ($time_period == C\ONE_HOUR ||
+                                $time_period == C\FOREVER) {
+                                e("<p>$item_name: ". $item_data[0]['NUM_VIEWS'].
+                                "</p>");
+                            } else {
+                                e("<p>$item_name: <a href='".$last_activity_url.
+                                    "&amp;impression=".$field.
+                                    "&amp;time=".$time_period.
+                                    "&amp;item=".$item_data[0]['ID']."'> ".
+                                    $item_data[0]['NUM_VIEWS'].
+                                    "</a></p>");
+                            }
                         }
                     } else {
                         e("<p><b>$period_heading</b>: ".
@@ -814,4 +847,82 @@ class ManagegroupsElement extends Element
         $view->helper("searchform")->render($data, $controller, $activity,
             $view, $title, $return_form_name, $fields, $dropdowns);
     }
-}
+    /**
+     * Draws chart of the group statistics in terms of number
+     * of views in different time periods.
+     *
+     * @param array $data from the social component controller
+     *     containing statistical information of specific group item
+     *     including time period, number of views, update timestamp
+     */
+    public function renderLastActivity($data)
+    {
+        $admin_url = htmlentities(B\controllerUrl('admin', true));
+        $base_url = $admin_url . C\CSRF_TOKEN."=".$data[C\CSRF_TOKEN].
+            "&amp;a=manageGroups";
+        ?>
+        <div class='float-opposite'><a href='<?=$base_url ?>'><?=
+            tl('managegroups_element_addgroup_form') ?></a></div>
+        <canvas id="cvs" width="600" height="250">[No canvas support]</canvas>
+        <?php
+        $stat_types = [
+            C\GROUP_IMPRESSION => tl('managegroup_element_group_views'),
+            C\THREAD_IMPRESSION => tl('managegroup_element_thread_views'),
+            C\WIKI_IMPRESSION => tl('managegroup_element_wiki_views'),
+            ];
+        $time_periods = [
+           C\ONE_HOUR => tl('managegroup_element_last_hour'),
+           C\ONE_DAY => tl('managegroup_element_last_day'),
+           C\ONE_MONTH => tl('managegroup_element_last_month'),
+           C\ONE_YEAR => tl('managegroup_element_last_year'),
+           C\FOREVER => tl('managegroup_element_all_time'),
+        ];
+        $total_view = 0;
+        if (array_key_exists(C\ONE_DAY, $data['STATISTICS'])) {
+            $period = C\ONE_DAY;
+            $column_name = tl('managegroup_element_hour');
+            $dt_format = "m-d-Y H:i";
+        } else if (array_key_exists(C\ONE_MONTH, $data['STATISTICS'])) {
+            $period = C\ONE_MONTH;
+            $column_name = tl('managegroup_element_day');
+            $dt_format = "m-d-Y";
+        } else if (array_key_exists(C\ONE_YEAR, $data['STATISTICS'])) {
+            $period = C\ONE_YEAR;
+            $column_name = tl('managegroup_element_month');
+            $dt_format = "m-d-Y";
+        }
+        ?>
+        <h2><?= $data['CURRENT_GROUP']['name']." ".
+            $stat_types[$data['STATISTICS'][$period][0]['TYPE']]." : ".
+            $time_periods[$period] ?></h2>
+        <table class="role-table table-margin">
+            <tr>
+                <th><?= $column_name ?></th>
+                <th><?= tl('managegroup_element_num_visits')?></th>
+            </tr>
+        <?php
+        foreach ($data['STATISTICS'] as $statistics => $statistics_array) {
+            foreach ($statistics_array as $key => $statistics_value) {
+        ?>
+        <tr>
+            <?php
+            $timestamp = $statistics_value['UPDATE_TIMESTAMP'];
+            $dt = date_create("@$timestamp");
+            $dt = date_format($dt, $dt_format);
+            $total_view += $statistics_value['VIEWS'];
+            ?>
+            <td><?= $dt ?></td>
+            <td><?= $statistics_value['VIEWS'] ?></td>
+        </tr>
+        <?php
+            }
+        }
+        ?>
+        <tr>
+            <th>Total</th>
+            <th><?= $total_view ?></th>
+        </tr>
+        </table>
+    <?php
+    }
+}
\ No newline at end of file
-- 
2.8.4 (Apple Git-73)

