作者 主題: open flash chart 使用 ?  (閱讀 3108 次)

0 會員 與 1 訪客 正在閱讀本文。

NARs

  • 活潑的大學生
  • ***
  • 文章數: 227
    • 檢視個人資料
open flash chart 使用 ?
« 於: 2012-05-08 16:51 »
各位大大,
我用open flash chart去呈現每一個規則所佔的比例的pie chart,可是在網頁上呈現時卻一片空白,
有大大使用過這個套件嗎?請問是那裡錯了嗎?

chart.html
代碼: [選擇]
    <html>
    <head>
        <title></title>
    <script type="text/javascript" src="js/swfobject.js"></script>
    <script type="text/javascript">

    swfobject.embedSWF(
      "open-flash-chart.swf?t=" + (new Date()).getTime()", "pie_chart",
      "700", "400", "9.0.0", "expressInstall.swf",
      {"data-file":" data.php "} );
    </script>
    </head>
    <body>
    <div id="pie_chart">
    </div>
    </body>
    </html>


data.php
代碼: [選擇]
    <?php
    $die 
false;
    
$link = @mysql_connect(&#39;localhost&#39;,&#39;user&#39;, &#39;pwd&#39;) or ($die = true);
    
if($die)
    {
        echo &
#39;<h3>Database connection error!!!</h3>&#39;;
        
echo &#39;A connection to the Database could not be established.<br />&#39;;
        
echo &#39;Please check your username, password, database name and host.<br />&#39;;
        
echo &#39;Also make sure <i>mysql.class.php</i> is rightly configured!<br /><br />&#39;;
    
}
    
mysql_select_db(&#39;testdatabase&#39;);
    
include_once &#39;php-ofc-library/open-flash-chart.php&#39;;
    
$query mysql_query(&#39;select count(*) counts,rule from  book where modifydate between &#39;2012-05-06&#39; and &#39;2012-05-12&#39; and cat = &#39;computer&#39; group by rule ;
    
&#39;);
    
While($queryRow mysql_fetch_array($queryMYSQL_ASSOC))
    {
        
$label[] = $queryRow[&#39;rule &#39;];
        
$dataForGraph[] = intval($queryRow[&#39;counts&#39;]);
    
}
    
$title = new title( &#39;The grades distribution : &#39;.date("D M d Y").&#39; are&#39; );
    
$title->set_style( &#39;{color: #567300; font-size: 14px}&#39; );
    
$chart = new open_flash_chart();
    
$chart->set_title$title );

    
$pie = new pie();
    
$pie->set_alpha(0.6);
    
$pie->set_start_angle35 );
    
$pie->add_animation( new pie_fade() );
    
$pie->set_tooltip( &#39;#val# of #total#<br>#percent# of total strength&#39; );
    
$pie->set_colours( array(&#39;#1C9E05&#39;,&#39;#FF368D&#39;,&#39;#1A3453&#39;,&#39;#1A3789&#39;) );
    
$pie->set_values( array(new pie_value($dataForGraph[0], "rule" $label[0]),
                    new 
pie_value($dataForGraph[1], "rule " $label[1]),
                    new 
pie_value($dataForGraph[2], "rule " $label[2]),
                new 
pie_value($dataForGraph[3], "rule " $label[3])) );

    
$chart->add_element$pie );
    echo 
$chart->toPrettyString();
    
?>


« 上次編輯: 2012-05-17 16:36 由 NARs »