Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
98 - 1
<?php
2
# $Id: data_table.example2.php 999 2011-08-05 19:00:48Z lbayuk $
3
# phplot / contrib / data_table example 2: Line plot with data table on the side
4
require_once 'phplot.php';
5
require_once 'data_table.php';
6
 
7
$data = array();
8
for ($i = 0; $i < 20; $i++)
9
  $data[] = array('', $i, 2 * $i, $i * $i);
10
 
11
// The $settings array configures the data table:
12
$settings = array(
13
    'headers' => array(NULL, 'X', '2Y', 'Y^2'),
14
    'position' => array(640, 20),
15
    'width' => 150,
16
    'data' => $data,
17
    'font' => 3,
18
);
19
 
20
$plot = new PHPlot(800, 600);
21
$plot->SetTitle('Line Plot with Data Table on Right Side');
22
$plot->SetDataValues($data);
23
$plot->SetDataType('data-data');
24
$plot->SetPlotType('linepoints');
25
$plot->SetPlotAreaPixels(NULL, NULL, 630, NULL);
26
$plot->SetCallback('draw_graph', 'draw_data_table', $settings);
27
$plot->SetLegend(array('2Y', 'Y^2'));
28
$plot->DrawGraph();