search
Homephp教程php手册php与Open Flash Chart多报表切换例子

<?php
//
// This is the MODEL section:
//
include &#39;../php-ofc-library/open-flash-chart.php&#39;;
$title = new title(date("D M d Y"));
$bar = new bar();
$bar->set_values( array(9,8,7,6,5,4,3,2,1) ); 
$chart_1 = new open_flash_chart();
$chart_1->set_title($title);
$chart_1->add_element($bar);
// generate some random data
srand((double)microtime() * 1000000);
$tmp = array();
for ($i = 0; $i < 9; $i++) $tmp[] = rand(1, 10);
$bar_2 = new bar();
$bar_2->set_values($tmp);
$chart_2 = new open_flash_chart();
$chart_2->set_title(new title("Chart 2 :-)"));
$chart_2->add_element($bar_2);
?>

// 

// This is the VIEW section: 

// 

 

<html> 
<head> 
<script type="text/<a href="/js_a/js.html" target="_blank">javascript</a>" src="js/json/json2.js"></script> 
<script type="text/javascript" src="js/swfobject.js"></script> 
<script type="text/javascript"> 
swfobject.embedSWF("open-flash-chart.swf", "my_chart", "350", "200", "9.0.0"); 
</script> 
<script type="text/javascript"> 
function ofc_ready() 
{ 
alert(&#39;ofc_ready&#39;); 
} 
function open_flash_chart_data() 
{ 
alert( &#39;reading data&#39; ); 
return JSON.stringify(data_1); 
} 
function load_1() 
{ 
  tmp = findSWF("my_chart"); 
  x = tmp.load( JSON.stringify(data_1) ); 
} 
function load_2() 
{ 
  alert("loading data_2"); 
  tmp = findSWF("my_chart"); 
  x = tmp.load( JSON.stringify(data_2) ); 
} 
function findSWF(movieName) { 
  if (navigator.appName.indexOf("Microsoft")!= -1) { 
return window[movieName]; 
  } else { 
return document[movieName]; 
  } 
} 
var data_1 = <?php echo $chart_1->toPrettyString(); ?>; 
var data_2 = <?php echo $chart_2->toPrettyString(); ?>; 
</script> 
 
</head> 
<body> 
<p>Open Flash Chart</p> 
 
<div id="my_chart"></div> 
<br> 
<a href="javascript:load_1()">display data_1</a> || <a href="javascript:load_2()">display data_2</a> 
<p> 
Don&#39;t forget to &#39;view source&#39; to see how the Javascript JSON data is loaded. 
</p> 
</body> 
</html>


教程链接:

随意转载~但请保留教程地址★

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools