- 分享
- 0
- 人气
- 0
- 主题
- 2
- 帖子
- 45
- UID
- 82425
- 积分
- 39
- 阅读权限
- 11
- 注册时间
- 2007-6-16
- 最后登录
- 2012-2-15
- 在线时间
- 126 小时
|
Below is my code for obtaining the data file :
- require_once("simple_html_dom.php");
- $html=file_get_html("http://finance.yahoo.com/q/hp?s=4707.KL+Historical+Prices");
- foreach ($html->find('td[class=yfnc_tabledata1]') as $e)
- echo $e->innertext . '<br />' ;
-
复制代码 This is my code for output the "preset" data into open flash chart :
- <?php
- include 'php-ofc-library/open-flash-chart.php';
- $month = array();
- $price = array();
- $month[] = 'Jan 4'; $price[] = 36.7;
- $month[] = 'Feb 2'; $price[] = 38.7;
- $month[] = 'Mar 1'; $price[] = 42.8;
- $month[] = 'Apr 1'; $price[] = 38.2;
- $month[] = 'May 3'; $price[] = 37.8;
- $month[] = 'Jun 1'; $price[] = 34.7;
- $month[] = 'Jul 1'; $price[] = 38.4;
- $month[] = 'Aug 2'; $price[] = 40.2;
- $month[] = 'Sep 1'; $price[] = 39.5;
- $month[] = 'Oct 1'; $price[] = 40.3;
- $month[] = 'Nov 1'; $price[] = 45.9;
- $month[] = 'Dec 1'; $price[] = 48.9;
- $chart = new open_flash_chart();
- $title = new title( 'Nestle (M) SDN BHD' );
- $title->set_style( "{font-size: 20px; color: #A2ACBA; text-align: center;}" );
- $chart->set_title( $title );
- $area = new area();
- $area->set_colour( '#5B56B6' );
- $area->set_values( $price );
- $area->set_key( 'Share Price(RM)/unit', 12 );
- $chart->add_element( $area );
- $x_labels = new x_axis_labels();
- $x_labels->set_steps(1);
- $x_labels->set_vertical();
- $x_labels->set_colour( '#A2ACBA' );
- $x_labels->set_labels( $month );
- $x = new x_axis();
- $x->set_colour( '#A2ACBA' );
- $x->set_grid_colour( '#D7E4A3' );
- $x->set_offset( false );
- $x->set_steps(1);
- // Add the X Axis Labels to the X Axis
- $x->set_labels( $x_labels );
- $chart->set_x_axis( $x );
- $x_legend = new x_legend( '1 year graph' );
- $x_legend->set_style( '{font-size: 20px; color: #778877}' );
- $chart->set_x_legend( $x_legend );
- $y = new y_axis();
- $y->set_range( 0, 60, 20 );
- $chart->add_y_axis( $y );
- echo $chart->toPrettyString();
复制代码 请问有什么方法能把两个combine起来?也就是说我能利用simple_html_dom取回来的资料来output在我的open flash chart 上?由于我的flash chart‘s output是根据我preset data,但是我想要让flash chart’s output是依据我用simple-html-dom取回来的资料。请问要怎样才能做到呢? |
|