}
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($hbar);
$step_count = $max_value > 0 ? $max_value / 10 : 1;
$x = new x_axis();
$x->set_offset(false);
$x->set_steps($max_value / 10);
$chart->set_x_axis($x);
$y = new y_axis();
$y->set_offset(true);
$y->set_labels($y_labels);
$chart->add_y_axis($y);
if (isset($yaxis_label)) {
    $y_legend = new y_legend($yaxis_label);
    $y_legend->set_style('{font-size: 20px; color: #000000}');
    $chart->set_y_legend($y_legend);
}
if (isset($xaxis_label)) {
    $x_legend = new x_legend($xaxis_label);
    $x_legend->set_style('{font-size: 20px; color: #000000}');
    $chart->set_x_legend($x_legend);
}
$chart->set_bg_colour("#f3f3f3");
$tooltip = new tooltip();
$tooltip->set_hover();
$tooltip->set_stroke(1);
$tooltip->set_colour("#000000");
$tooltip->set_background_colour("#ffffff");
$chart->set_tooltip($tooltip);
echo $chart->toPrettyString();
Exemple #2
0
    exit;
} else {
    while ($row = mysql_fetch_object($ok)) {
        $time_axis[] = date("H:i", strtotime($row->Time));
        $data_watt[] = round((double) $row->Watt, 3);
        //$data_max[]    = round((float)$row->maxWatt,3) ;
        $data_tot[] = round((double) $row->ETotal, 3);
    }
    $chart = new open_flash_chart();
    if (count($time_axis) == 0) {
        echo 0;
        exit;
    }
    $title = new title("\n" . date('l dS F Y', $time) . " (" . round(max($data_tot) - min($data_tot), 2) . " kWh)");
    $title->set_style('{font-size: 20px; color: #778877;}');
    $tooltip = new tooltip();
    $tooltip->set_hover();
    $sline = new scatter_line('#3D3D3D', 3);
    $def = new hollow_dot();
    $def->size(0)->halo_size(0);
    $sline->set_default_dot_style($def);
    $sline->set_key('Leistung (W)', 11);
    $v = array();
    foreach ($data_watt as $key => $val) {
        $v[] = new scatter_value($key, $val);
        $v[] = new scatter_value($key + 1, $val);
    }
    $sline->set_values($v);
    $bars_curr = new bar_glass();
    $bars_curr->set_key('Leistung (W)', 10);
    $bars_curr->set_colour('#EFC01D');
$data_max = ceil($data_max / $data_step) * $data_step;
//DRAW X AXIS
$x = new x_axis();
$x->set_offset(false);
$xl_tmp = array();
foreach ($dates as $date) {
    $xl_tmp[] = date('d.m', strtotime($date));
}
$x->steps(10);
$x->set_labels_from_array($xl_tmp);
//DRAW Y AXIS
$y = new y_axis();
$y->set_offset(false);
$y->set_range(0, $data_max, $data_step);
//SET TOOLTIP FORMAT
$t = new tooltip();
$t->set_shadow(false);
$t->set_stroke(5);
$t->set_colour("#cccccc");
$t->set_background_colour("#efefef");
$t->set_body_style("{font-size:10px; font-weight:bold; color:#000000;}");
//PREPARE FINAL CHART AND RETURN IT
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($line_1);
$chart->add_element($line_5);
//moved above to make sure line 2 is above line 5
$chart->add_element($line_2);
$chart->add_element($line_3);
$chart->add_element($line_4);
$chart->set_x_axis($x);
 function indexAction()
 {
     //		$this->_helper->layout->disableLayout();
     //		$login = "******";
     //		$password = "******";
     //		include_once 'sina.php';
     //		$resultarray = get_sinacontacts($login, $password);
     //		Zend_Debug::dump($resultarray);
     //		include_once '163.php';
     //		$login = '******';
     //		$password = '******';
     //		$resultarray = get_163contacts($login, $password);
     //		Zend_Debug::dump($resultarray);
     //		include_once 'yahoo.php';
     //		$obj = new GrabYahoo();
     //		$contacts = $obj->getAddressbook('*****@*****.**','19990402');
     //		Zend_Debug::dump($contacts);
     //		include_once "contacts_fn.php";
     //		$ret_array = get_msncontacts('*****@*****.**', '1999040211');
     //		Zend_Debug::dump($ret_array);
     //		$this->_helper->layout->setLayout("layout_admin");
     $this->_helper->layout->disableLayout();
     // get date from db
     $db = Zend_Registry::get('db');
     $select = $db->select();
     $select->from('report', array('left(create_date,10) as date', 'accesscode'))->where('report.campaign_id = 3')->where("report.state = 'APPROVED'")->order('date');
     $results = $db->fetchAll($select);
     $accesscodeDbMatchArray = array();
     foreach ($results as $result) {
         $accesscodeDbMatchArray[$result['accesscode']] = $result['date'];
     }
     $accesscodeArray = array_keys($accesscodeDbMatchArray);
     //		Zend_Debug::Dump($accesscodematchArray);
     // get value from ws
     $indicate2Connect = new Indicate2_Connect();
     $response = $indicate2Connect->getAnswerSetForSurvey(385, null, array(array('ContextIndex' => 1, 'QuestionIndex' => 1), array('ContextIndex' => 1, 'QuestionIndex' => 4)), 0);
     //        Zend_Debug::Dump($response);
     $talkingdurationArray = array();
     $accesscodeResponseMathArray = array();
     if (isset($response->AnswerSetType)) {
         foreach ($response->AnswerSetType as $answerSet) {
             if (isset($answerSet->AnswerType) && is_array($answerSet->AnswerType) && !empty($answerSet->AnswerType)) {
                 foreach ($answerSet->AnswerType as $answer) {
                     if ($answer->QuestionId == 573) {
                         $accesscodeResponseMathArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answer->AnswerText)));
                     }
                     if ($answer->QuestionId == 576) {
                         $talkingdurationArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answer->AnswerText)));
                     }
                 }
             } else {
                 //get min value, like '11-15' = 11
                 $accesscodeResponseMathArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answerSet->AnswerType->AnswerText)));
             }
         }
     }
     //		Zend_Debug::Dump($accesscodeResponseMathArray);
     //		Zend_Debug::Dump($talkingdurationArray);
     $resultmatchArray = array();
     foreach ($accesscodeArray as $accesscode) {
         $resultmatchArray[$accesscodeDbMatchArray[$accesscode]] = 0;
     }
     foreach ($accesscodeArray as $accesscode) {
         if (array_key_exists($accesscode, $accesscodeResponseMathArray)) {
             $resultmatchArray[$accesscodeDbMatchArray[$accesscode]] += $accesscodeResponseMathArray[$accesscode];
         }
     }
     //		 Zend_Debug::Dump($resultmatchArray);
     $dateArray = array_keys($resultmatchArray);
     foreach ($dateArray as $date) {
         $resultmatchArray[$date] = floor($resultmatchArray[$date] * 1.65);
     }
     //        Zend_Debug::Dump($resultmatchArray);
     include 'open-flash-chart.php';
     $data_1 = array();
     $base = floor(1472 * 1.65);
     $temp = 0;
     $resultmatchArray[0] = 0;
     foreach ($dateArray as $date) {
         $resultmatchArray[$date] += $resultmatchArray[$temp];
         $data_1[] = $resultmatchArray[$date] + $base;
         $temp = $date;
     }
     //		Zend_Debug::Dump($data_1);
     $title = new title("Impressions of BugsLock by day");
     $y = new y_axis();
     $y->set_range(0, 40000, 10000);
     $x = new x_axis();
     $x_labels = new x_axis_labels();
     $x_labels->set_labels($dateArray);
     $x_labels->set_steps(2);
     $x_labels->rotate(40);
     $x->set_labels($x_labels);
     $line_1_default_dot = new dot();
     $line_1_default_dot->colour('#f00000')->tooltip('#x_label#: #val#');
     $line_1 = new line();
     $line_1->set_default_dot_style($line_1_default_dot);
     $line_1->set_values($data_1);
     $line_1->set_width(1);
     $line_1->set_key('Impression', 10);
     $this->view->chart = new open_flash_chart();
     $this->view->chart->set_title($title);
     $this->view->chart->add_element($line_1);
     $this->view->chart->set_y_axis($y);
     $this->view->chart->set_x_axis($x);
     $this->view->chart->set_bg_colour('#FFFFFF');
     //
     include 'ofc_sugar.php';
     $this->view->chart2 = new open_flash_chart();
     $this->view->chart2->set_title(new title('Generation Chart'));
     $line_1 = new line();
     $array_1 = array();
     $f = 1.5;
     for ($i = 0; $i <= 50; $i++) {
         array_push($array_1, $f);
     }
     $line_1->set_values($array_1);
     //		$line_1->set_default_dot_style( new s_hollow_dot('#FBB829', 4) );
     $line_1->set_width(1);
     $line_1->set_colour('#FF0000');
     $line_1->set_tooltip("Gen0");
     $line_1->set_key('Gen0', 10);
     $line_1->loop();
     $area = new area();
     // set the circle line width:
     $area->set_width(1);
     //		$area->set_default_dot_style( new s_hollow_dot('#45909F', 5) );
     $area->set_colour('#FF0000');
     //		$area->set_fill_colour( '#FF0000' );
     //		$area->set_fill_alpha( 0.4 );
     $area->set_loop();
     $area->set_values($array_1);
     $line_2 = new line();
     $array_2 = array();
     $f = 2.8;
     for ($i = 0; $i <= 50; $i++) {
         array_push($array_2, $f);
     }
     $line_2->set_values($array_2);
     //		$line_2->set_default_dot_style( new s_hollow_dot('#FBB829', 4) );
     $line_2->set_width(1);
     $line_2->set_colour('#FBB829');
     $line_2->set_tooltip("Gold<br>#val#");
     $line_2->set_key('Gen1', 10);
     $line_2->loop();
     $line_4 = new line();
     $array_4 = array();
     $f = 5;
     for ($i = 0; $i <= 50; $i++) {
         array_push($array_4, $f);
     }
     $line_4->set_values($array_4);
     //		$line_2->set_default_dot_style( new s_star('#8000FF', 4) );
     $line_4->set_width(1);
     $line_4->set_colour('#3030D0');
     $line_4->set_tooltip("Purple<br>#val#");
     $line_4->set_key('Gen2', 10);
     $line_4->loop();
     // add the area object to the chart:
     $this->view->chart2->add_element($line_1);
     $this->view->chart2->add_element($line_2);
     $this->view->chart2->add_element($line_4);
     $r = new radar_axis(5);
     $r->set_colour('#FFFFFF');
     $r->set_grid_colour('#FFFFFF');
     $labels = new radar_axis_labels(array('G0', '', 'G1', '', 'G2'));
     $labels->set_colour('#9F819F');
     $r->set_labels($labels);
     $this->view->chart2->set_radar_axis($r);
     $tooltip = new tooltip();
     $tooltip->set_proximity();
     $this->view->chart2->set_tooltip($tooltip);
     $this->view->chart2->set_bg_colour('#ffffff');
     //		echo $this->view->chart2->toPrettyString();
 }
 private function getChart($aGraphs)
 {
     $this->prepareData();
     $oLabels = new x_axis_labels();
     $oLabels->set_labels($this->aData[0]);
     $oLabels->rotate(-45);
     $oX = new x_axis();
     $oX->set_labels($oLabels);
     $oX->set_colours('#000000', '#ffffff');
     $oChart = new open_flash_chart();
     $oChart->set_bg_colour('#FFFFFF');
     $oTitle = new title($this->getTitle());
     $oTitle->set_style('font-size: 12px; font-weight: bold;');
     $oChart->set_title($oTitle);
     $oTooltip = new tooltip('#val#');
     $oTooltip->set_body_style('font-size: 10px');
     $oTooltip->set_stroke(1);
     $oTooltip->set_shadow(true);
     $oTooltip->set_background_colour('#ffffcc');
     $oTooltip->set_colour('#cccc99');
     $oChart->set_tooltip($oTooltip);
     $aY = array();
     foreach ($aGraphs as $k => $v) {
         $y = empty($v['y-right']) ? 0 : 1;
         $scale = empty($v['scale']) ? 1 : $v['scale'];
         if (!isset($aY[$y])) {
             $aY[$y] = new y_axis();
             $aY[$y]->set_colours($v['colour'], '#f6f6f6');
         }
         if (empty($v['y-remap'])) {
             $this->setAxisRange($aY[$y], $k, $scale);
         } else {
             $this->remapSeries($aY[$y], $k, $scale);
         }
         $oSeries = $this->getSeries($k, $v['type'], $v['colour']);
         if (!empty($this->drillDown)) {
             $oSeries->set_on_click($this->drillDown);
         }
         $oSeries->set_on_show($v['effect']);
         if ($y) {
             $oSeries->attach_to_right_y_axis();
         }
         $aGraphs[$k] = $oSeries;
     }
     $oChart->set_x_axis($oX);
     foreach ($aY as $y => $e) {
         $method = $y ? 'set_y_axis_right' : 'set_y_axis';
         $oChart->{$method}($e);
     }
     foreach ($aGraphs as $e) {
         $oChart->add_element($e);
     }
     return $oChart;
 }
Exemple #6
0
}
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($hbar);
$step_count = $max_value > 0 ? $max_value / 10 : 1;
$x = new x_axis();
$x->set_offset(false);
$x->set_steps($max_value / 10);
$chart->set_x_axis($x);
$y = new y_axis();
$y->set_offset(true);
$y->set_labels(array_reverse($y_labels));
$chart->add_y_axis($y);
if (isset($yaxis_label)) {
    $y_legend = new y_legend($yaxis_label);
    $y_legend->set_style('{font-size: 20px; color: #000000}');
    $chart->set_y_legend($y_legend);
}
if (isset($xaxis_label)) {
    $x_legend = new x_legend($xaxis_label);
    $x_legend->set_style('{font-size: 20px; color: #000000}');
    $chart->set_x_legend($x_legend);
}
$chart->set_bg_colour('#f3f3f3');
$tooltip = new tooltip();
$tooltip->set_hover();
$tooltip->set_stroke(1);
$tooltip->set_colour('#000000');
$tooltip->set_background_colour('#ffffff');
$chart->set_tooltip($tooltip);
echo $chart->toPrettyString();
 $data_val2 = array();
 if (sizeof($listeJeux) > 3) {
     for ($j = 0; $j < sizeof($listeJoueurs); $j++) {
         $tab_libelles2[] = $listeJoueurs[$j]['nom'];
         for ($i = sizeof($listeJeux) - 3; $i < sizeof($listeJeux); $i++) {
             $data_val2[$i][] = $G_ListeResultatsMoyens[$i][$j];
         }
     }
 }
 // Ordonnées
 $y2 = new y_axis();
 $y2->set_range($valmin, $valmax, 5);
 $y2->set_stroke(2);
 $y2->set_colour("#d000d0");
 // ToolTip
 $t2 = new tooltip();
 $t2->set_shadow(true);
 $t2->set_stroke(2);
 $t2->set_colour("#6E604F");
 $t2->set_background_colour("#BDB396");
 $t2->set_title_style("{font-size: 14px; color: #CC2A43;}");
 $t2->set_body_style("{font-size: 10px; font-weight: bold; color: #000000;}");
 // titre des absisses
 //$x_labels = new x_axis_labels();
 //$x_labels->set_steps( 1 );
 //$x_labels->set_vertical();
 //$x_labels->set_labels( $tab_libelles );
 //$x_labels->set_vertical();
 // Nouveau grAphique
 $chart2 = new open_flash_chart();
 //$posy=0;
 function load_tooltips()
 {
     global $SQL, $EQ_SLOT;
     $tooltip = new tooltip($this->items, $this->item_instance, $this->guid, $this->data);
     for ($i = 0; $i < 19; $i++) {
         $tooltip->transform($i);
         $this->item_tooltips[$i] = $tooltip->output;
     }
 }
Exemple #9
0
function stacked_bar_chart($host_instance_list)
{
    $title = new title('所有instance实际内存使用');
    $title->set_style("{color: #567300; font-size: 16px; font-weight:bold;}");
    $bar_stack = new bar_stack();
    $bar_stack->set_colours(array('#C4D318', '#7D7B6A'));
    $max = 64;
    foreach ($host_instance_list as $i => $instance) {
        $jvmmem = isset($instance['jvmmem']) ? explode('/', $instance['jvmmem']) : array();
        if ($jvmmem) {
            foreach ($jvmmem as &$j) {
                $j = intval($j);
            }
            $max = $max < $jvmmem[1] ? $jvmmem[1] : $max;
            $jvmmem[1] = $jvmmem[1] - $jvmmem[0];
        }
        $bar_stack->append_stack($jvmmem);
        $lables[] = $instance['port_num'];
        $services[$i] = $instance['service_name'];
    }
    $bar_stack->set_keys(array(new bar_stack_key('#C4D318', 'used', 13), new bar_stack_key('#7D7B6A', 'total', 13)));
    $bar_stack->set_on_click('(function(x){var services=' . json_encode($services) . ';alert(services[x]);})');
    //js
    $bar_stack->set_tooltip('#val#M,共#total#M');
    $y = new y_axis();
    $y->set_range(0, $max + 32, 256);
    $x = new x_axis();
    $x->set_labels_from_array($lables);
    $tooltip = new tooltip();
    $tooltip->set_hover();
    $chart = new open_flash_chart();
    $chart->set_title($title);
    $chart->add_element($bar_stack);
    $chart->set_x_axis($x);
    $chart->add_y_axis($y);
    $chart->set_tooltip($tooltip);
    return $chart->toPrettyString();
}
 function gsitedata()
 {
     $this->autoRender = false;
     $solid = $this->Session->read('sol');
     $host_id = $this->Session->read('host_id');
     $tinterval = 3600;
     $host_srch = "";
     if (!empty($host_id) && $host_id != 0) {
         $host_srch = " AND source_id = " . $host_id;
     }
     $this->DnsMessage->recursive = -1;
     $site_count = $this->DnsMessage->query('SELECT hostname, COUNT(*) FROM dns_messages WHERE sol_id = ' . $solid . $host_srch . ' GROUP BY hostname ORDER BY COUNT(*) DESC LIMIT 50');
     //sort($site_count);
     $data = array();
     $x = array();
     $max_resp = 0;
     foreach ($site_count as $site) {
         $data[] = array((int) $site[0]['COUNT(*)'], 0);
         if ($max_resp < (int) $site[0]['COUNT(*)']) {
             $max_resp = (int) $site[0]['COUNT(*)'];
         }
         if (empty($site[0]['hostname'])) {
             $x[] = (string) $site['dns_messages']['hostname'];
         } else {
             $x[] = (string) $site[0]['hostname'];
         }
     }
     // joson data format
     $title = new title(__("Host Popularity", true));
     $title->set_style("{font-size: 14px; color: #990000; text-align: center; font-weight:bold;}");
     $bar = new bar_stack();
     $bar->set_colours(array('#e77919', '#577261'));
     $bar->set_on_show(new bar_on_show('grow-up', 0, 0.5));
     $bar->set_values($data);
     $bar->set_tooltip('Host: #x_label#<br>Response #val#<br>');
     $tooltip = new tooltip();
     $tooltip->set_hover();
     $tooltip->set_shadow(false);
     $tooltip->set_stroke(5);
     $tooltip->set_colour("#6E604F");
     $tooltip->set_background_colour("#BDB396");
     $data_labels = new x_axis_labels();
     $data_labels->rotate(90);
     $data_labels->set_labels($x);
     $x_axis = new x_axis();
     $x_axis->set_labels($data_labels);
     $y = new y_axis();
     $y->set_range(0, $max_resp * 1.1, (int) ($max_resp / 10));
     $chart = new open_flash_chart();
     $chart->set_bg_colour('#F9F9F9');
     $chart->set_title($title);
     $chart->add_element($bar);
     $chart->set_x_axis($x_axis);
     $chart->set_y_axis($y);
     $chart->set_tooltip($tooltip);
     // menu'
     $m = new ofc_menu("#f0E0ff", "#878787");
     $m->values(array(new ofc_menu_item(__('DNS Response', true), 'go_gpage')));
     $chart->set_menu($m);
     header("Content-Type: text/plain");
     echo $chart->toPrettyString();
     die;
 }
Exemple #11
0
function generateStats($params)
{
    global $reportCacheLocation;
    // Computer Statistics Generation
    $dbTrackHandler = connectDb();
    $resultBag = generateStatsBag($params, $dbTrackHandler);
    // ----------------------------------------------------
    // Generate charts
    $animation_1 = isset($params['animation_1']) ? $params['animation_1'] : 'pop';
    $delay_1 = isset($params['delay_1']) ? $params['delay_1'] : 0.5;
    $cascade_1 = isset($params['cascade_1']) ? $params['cascade_1'] : 1;
    $title = new title("Genie Report: " . $params['reportName'] . " - Generated on " . date('Y/m/d h:i:s A'));
    $title->set_style("{font-size: 12px; color: #000000; text-align: center;}");
    $bar_stack = new bar_stack();
    if ($params['reportType'] == 'computerStats') {
        foreach ($resultBag as $elm) {
            $tmpTotal = $elm[AVAIBILITY_TYPE_OFFLINE] + $elm[AVAIBILITY_TYPE_AVAILABLE] + $elm[AVAIBILITY_TYPE_BUSY];
            if ($tmpTotal == 0) {
                $tmpTotal = 1;
            }
            // Only Chuck Norris can divide by Zero.
            $bar_stack->append_stack(array($elm[AVAIBILITY_TYPE_OFFLINE] / $tmpTotal * 100, $elm[AVAIBILITY_TYPE_AVAILABLE] / $tmpTotal * 100, $elm[AVAIBILITY_TYPE_BUSY] / $tmpTotal * 100));
        }
        $bar_stack->set_colours(array('#FF0000', '#00FF00', '#A25B00'));
        $bar_stack->set_keys(array(new bar_stack_key('#FF0000', 'OFFLINE', 13), new bar_stack_key('#00FF00', 'FREE', 13), new bar_stack_key('#A25B00', 'BUSY', 13)));
    } else {
        $allProgNames = array();
        foreach ($resultBag as $elm) {
            $progNames = array_keys($elm);
            foreach ($progNames as $progName) {
                if (validProgram($progName)) {
                    if (!array_key_exists($progName, $allProgNames)) {
                        $allProgNames[$progName] = "#" . dechex(rand(0, 10000000));
                    }
                }
            }
        }
        $progsArray = array();
        foreach ($resultBag as $elm) {
            $tmpTotal = 0;
            $progNames = array_keys($elm);
            foreach ($elm as $programName => $programWeight) {
                if (validProgram($programName)) {
                    $tmpTotal += $programWeight;
                }
            }
            //echo "<h1>$tmpTotal</h1>";
            if ($tmpTotal == 0) {
                $tmpTotal = 1;
            }
            // Only Chuck Norris can divide by Zero.
            $progs = array();
            foreach ($elm as $programName => $programWeight) {
                if (validProgram($programName)) {
                    $percentVal = $programWeight / $tmpTotal * 100;
                    $progs[] = new bar_stack_value($percentVal, $allProgNames[$programName]);
                    $progsArray[$percentVal * 1000000] = $programName;
                }
            }
            $bar_stack->append_stack($progs);
        }
        $legends = array();
        //$strAllProgNames = array_keys($allProgNames);
        foreach ($allProgNames as $programName => $programColor) {
            $legends[] = new bar_stack_key($programColor, $programName, 13);
        }
        $bar_stack->set_keys($legends);
        ksort($progsArray);
        echo "<pre>";
        while (list($key, $value) = each($progsArray)) {
            $kw = $key / 1000000;
            echo "{$kw}: {$value}<br />\n";
        }
        echo "</pre>";
    }
    //$bar_stack->set_tooltip( 'In #x_label# you get #total# days holiday a year.<br>Number of days: #val#' );
    $bar_stack->set_on_show(new bar_on_show($animation_1, $cascade_1, $delay_1));
    $y = new y_axis();
    $y->set_range(0, 100, 10);
    //$y->set_range( 0, $tmpMax, $tmpMax/10 );
    $x_labels = new x_axis_labels();
    $x_labels->rotate(45);
    $x_labels->set_labels(array_keys($resultBag));
    $x = new x_axis();
    $x->set_labels($x_labels);
    $tooltip = new tooltip();
    $tooltip->set_hover();
    $chart = new open_flash_chart();
    $chart->set_title($title);
    $chart->add_element($bar_stack);
    $chart->set_x_axis($x);
    $chart->add_y_axis($y);
    $chart->set_tooltip($tooltip);
    // ----------------------------------------------------
    $cacheid = time();
    $filename = $cacheid . '.cache.json';
    $myFile = "{$reportCacheLocation}/reports-cache/" . $filename;
    $fh = fopen($myFile, 'w') or die("can't open file");
    fwrite($fh, $chart->toPrettyString());
    fclose($fh);
    return $cacheid;
}