php中OpenFlashChart使用之线性图表使用例子

2024-05-16 08:50:38

OpenFlashChart使用之线性图表典型使用例子,使用swfobject.js将html图表代码写入到id="my_chart"的DIV中,效果如下:

点击查看原图

html代码:

  1. <html>

  2. <head>

  3. <scripttype="text/javascript"src="js/swfobject.js"></script>

  4. <scripttype="text/javascript">

  5. swfobject.embedSWF(

  6. "open-flash-chart.swf", "my_chart",

  7. "600", "350", "9.0.0", "expressInstall.swf",

  8. {"data-file":"gallery/x-legend.php"} );

  9. </script>

  10. </head>

  11. <body>

  12. <p>Hello World</p>

  13. <divid="my_chart"></div>

  14. </body>

  15. </html>

x-legend.php代码如下:

  1. <?php

  2. include'../php-ofc-library/open-flash-chart.php';

  3. $year = array();

  4. $price = array();

  5. $year[] = '1983'; $price[] = 36.7;

  6. $year[] = '1984'; $price[] = 38.7;

  7. $year[] = '1985'; $price[] = 42.8;

  8. $year[] = '1986'; $price[] = 38.2;

  9. $year[] = '1987'; $price[] = 37.8;

  10. $year[] = '1988'; $price[] = 34.7;

  11. $year[] = '1989'; $price[] = 38.4;

  12. $year[] = '1990'; $price[] = 40.2;

  13. $year[] = '1991'; $price[] = 39.5;

  14. $year[] = '1992'; $price[] = 40.3;

  15. $year[] = '1993'; $price[] = 45.9;

  16. $year[] = '1994'; $price[] = 48.9;

  17. $year[] = '1995'; $price[] = 50.9;

  18. $year[] = '1996'; $price[] = 52.9;

  19. $year[] = '1997'; $price[] = 57.9;

  20. $year[] = '1998'; $price[] = 60.9;

  21. $year[] = '1999'; $price[] = 61.9;

  22. $year[] = '2000'; $price[] = 76.9;

  23. $year[] = '2001'; $price[] = 77.9;

  24. $year[] = '2002'; $price[] = 69.9;

  25. $year[] = '2003'; $price[] = 77.9;

  26. $year[] = '2004'; $price[] = 77.9;

  27. $year[] = '2005'; $price[] = 79.9;

  28. $year[] = '2006'; $price[] = 88.9;

  29. $year[] = '2007'; $price[] = 87.9;

  30. $year[] = '2008'; $price[] = 103.9;

  31. $chart = new open_flash_chart();

  32. $title = new title( 'UK Petrol price (pence) per Litre' );

  33. $title->set_style( "{font-size: 20px; color: #A2ACBA; text-align: center;}" );

  34. $chart->set_title( $title );

  35. $area = new area();

  36. $area->set_colour( '#5B56B6' );

  37. $area->set_values( $price );

  38. $area->set_key( 'Price', 12 );

  39. $chart->add_element( $area );

  40. $x_labels = new x_axis_labels();

  41. $x_labels->set_steps( 2 );

  42. $x_labels->set_vertical();

  43. $x_labels->set_colour( '#A2ACBA' );

  44. $x_labels->set_labels( $year );

  45. $x = new x_axis();

  46. $x->set_colour( '#A2ACBA' );

  47. $x->set_grid_colour( '#D7E4A3' );

  48. $x->set_offset( false );

  49. $x->set_steps(4);

  50. // Add the X Axis Labels to the X Axis

  51. $x->set_labels( $x_labels );

  52. $chart->set_x_axis( $x );

  53. //

  54. // LOOK:

  55. //

  56. $x_legend = new x_legend( '1983 to 2008' );

  57. $x_legend->set_style( '{font-size: 20px; color: #778877}' );

  58. $chart->set_x_legend( $x_legend );

  59. //

  60. // remove this when the Y Axis is smarter

  61. //

  62. $y = new y_axis();

  63. $y->set_range( 0, 150, 30 );

  64. $chart->add_y_axis( $y );

  65. echo$chart->toPrettyString();

注意:如果不能正常显示图表请检查 swfobject.js 和x-legend.php的引用路径是否正确(html代码中的 第4行和第10行)

转载于:https://blog.51cto.com/janson/1264018

php中OpenFlashChart使用之线性图表使用例子相关推荐

  1. 计算机网络中各层的协议图表(TCP/IP)

    计算机网络中各层的协议图表:

  2. .net 从txt中读取行数据_【VBA项目】从指定文件中读取数据并绘制图表

    VBA 是一种很久远的编程语言,但并不过时.在满足以下两个条件时,借助 VBA 可以极大的提升生产率,降低出错率: 你的电脑上不允许自主安装软件: 你需要执行的工作中大部分的步骤都是固定且重复的. 项 ...

  3. 问题 B: 调整表中元素顺序(线性表)

    问题 B: 调整表中元素顺序(线性表) 时间限制: 1 Sec  内存限制: 2 MB 提交: 28  解决: 11 [提交][状态][讨论版] 题目描述 若一个线性表L采用顺序存储结构存储,其中所有 ...

  4. 如何在Swift中创建漂亮的iOS图表

    通过图形和图表呈现数据是当今移动应用程序最显着的特征之一.iOS图表使应用程序看起来更漂亮,更有吸引力. 在本教程中,我们将向您展示如何使用代码示例在Swift中实现我们的iOS图表.我们将看一下Sw ...

  5. LabVIEW中的波形图和波形图表有什么区别在LabVIEW中更改波形图表的历史长度

    LabVIEW中的波形图和波形图表有什么区别 在LabVIEW中,应该分别在什么情况下使用波形图和波形图表?这两种控件的数据显示方式有什么区别?应该使用哪一个控件来查看数据的历史记录? 解决方案 波形 ...

  6. python中如何画logistic_如何在 Python 中建立和训练线性和 logistic 回归 ML 模型?

    原标题:如何在 Python 中建立和训练线性和 logistic 回归 ML 模型? 英语原文: 翻译:(Key.君思) 线性回归与logistic回归,是. 在我的里,你们已经学习了线性回归机器学 ...

  7. 手把手教你用plotly绘制excel中常见的16种图表(下)

    大家好,我是才哥. 上一期咱们介绍<手把手教你用plotly绘制excel中常见的16种图表(上)>演示了8种常见图表,今天我们继续演示另外8种常见图表的绘制. 文章目录 1. 树状图 2 ...

  8. ercharts一个页面能放几个_在同一页面中显示多个echart图表

    整理了一下大概有两种做法来实现在同一个页面中显示多个echart图表,废话不说直接上代码. 在同一个echart对象中绘制多个图表 echart .chart { width: 1500px; } i ...

  9. 在Vue中使用eCharts的地图图表,及生成自定义地图数据(乡镇级)

    如何在Vue中使用eCharts的地图图表,及如何生成自定义地图数据(乡镇级) 文章目录 一.在Vue使用ECharts地图功能 二.生成地图数据 1.安装Bigemap 程序 2.生成需要的各乡镇地 ...

最新文章

  1. 《Android传感器开发与智能设备案例实战》——导读
  2. 【Python学习笔记】异常处理try-except
  3. php程序xml有必要学习吗,对初学者非常有用的PHP技巧
  4. python模块的使用方法_python中requests模块的使用方法
  5. L1-057 PTA使我精神焕发 (5 分)-PAT 团体程序设计天梯赛 GPLT
  6. html全局事件,HTML5全局属性和事件
  7. 磁盘类型 GetDriveType
  8. 如何在windows电脑网页上创建苹果ID?
  9. 不喜欢学计算机专业怎么办,录取到不喜欢的专业怎么办?说说我有所不同的“转系生活”...
  10. php的pdo mysql扩展模块_php pdo链接
  11. 麒麟985和麒麟990有什么区别(手机常见问题)
  12. 次微分(subdifferential)
  13. IDEA 出现 Exception in thread main java.lang.OutOfMemoryError: Java heap space 解决方式
  14. java_java开发工程师
  15. mysql 查询后根据值的不同进行判断与修改,SQL中的条件判断语句(case when zhen)用法
  16. 怎样制作网站的流程和步骤
  17. django学习007-MVT的T(模板)的使用
  18. X战警-最后战役 X-Men: The Last Stand
  19. 十月 Z 星月度速览 | Hacktoberfest 开源挑战赛、飞书深诺电商场景实践、Paddlepaddle推荐系统部署……...
  20. 放置江湖html5游戏,放置江湖单机离线版

热门文章

  1. 关于Struts2的通配方法、转发重定向
  2. python/Django(增、删、改、查)操作
  3. Sprint2-2.0
  4. 搭建SpringMVC+Hibernate4+Spring3+Ajax+Maven项目(二)
  5. C++求数组子数组和的最大值并将该子数组和最大值打印出来
  6. 【洛谷P1378】油滴扩展
  7. Spring注解方式实现定时器
  8. 【Oracle】Exadata虚拟机配置(一)
  9. 兼容ie浏览器的placeholder的几种方法
  10. [asp.net] 获取网页访问来路的几种方法