Chart Elements - Title

Object: title( $text )

Methods:

  • set_style( $css )
    A css string. Can optionally contain:
    • font-size
    • font-family
    • font-weight
    • color
    • background-color
    • text-align
    • margin
    • margin-left
    • margin-right
    • margin-top
    • margin-bottom
    • padding
    • padding-left
    • padding-right
    • padding-top
    • padding-bottom
    See the example code below for a better idea of how this works.
  • This goes into the <head> of the page:

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

    swfobject.embedSWF(
    "open-flash-chart.swf", "my_chart",
    "550", "400", "9.0.0", "expressInstall.swf",
    {"data-file":"gallery/title.php"} );

    </script>
    This writes the chart into a div with id="my_chart", right click and view source to see it in action, [the tutorials have more details]

    gallery/title.php
    <?php

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

    //
    // Create a title object and set the text to todays date
    //
    $title = new titledate("D M d Y") );
    $title->set_style"{font-size: 20px; font-family: Times New Roman; font-weight: bold; color: #A2ACBA; text-align: center;}" );

    $line_dot = new line_dot();
    $line_dot->set_values( array(9,8,7,6,5,4,3,2,1) );

    $chart = new open_flash_chart();
    $chart->set_title$title );
    $chart->add_element$line_dot );

    $x = new x_axis();
    $x->set_colour'#D7E4A3' );
    $x->set_grid_colour'#A2ACBA' );
    $x->set_labels( array('a','b','c','d','e','f','g','h','i') );

    $chart->set_x_axis$x );

    echo 
    $chart->toPrettyString();
    To see the data produced : gallery/title.php, then 'view source'.
Support This Project

Open Flash Chart logo by numb.me.uk. | Syntax highlights are by GeSHi