<?php
/*
	$g = new chart;


	foreach ($elemy as $k => $v)
	{
	    $g->xValue[] = $elemx[$k];
	    $g->DataValue[] = $v;
	}

	$g->Title = "Ilosc odslon strony";
	$g->SubTitle = $domain_name;
	$g->Width = (count($elemx)*45) + 75;
	$g->Height = 300;
	
	$g->xCount = count($elemx);
	$g->xCaption = "Liczba odslon z 7 dni: ".array_sum($elemy);
	$g->xShowValue = TRUE;
	$g->xShowGrid = FALSE;
	
	$g->yCount = $scale; //
	$g->yCaption = "Liczba odslon";
	$g->yShowValue = TRUE;
	$g->yShowGrid = FALSE;
	
	$g->DataDecimalPlaces = 0;
	$g->DataMax = $ymax;
	$g->DataMin = 0;
	$g->DataShowValue = TRUE;
	
	$g->MakeBarChart();
	*/
		include 'files/php-ofc-library/open-flash-chart.php';
		
		srand((double)microtime()*1000000);
		
		$data_1 = array();
		$data_2 = array();
		$data_3 = array();
		for( $i=0; $i<9; $i++ )
		{
		    $data_1[] = rand(1,6);
		    $data_2[] = rand(7,13);
		    $data_3[] = rand(14,19);
		}
		
		$default_dot = new dot();
		$default_dot->size(5)->colour('#DFC329');
		
		$line_dot = new line();
		$line_dot->set_default_dot_style($default_dot);
		$line_dot->set_width( 4 );
		$line_dot->set_colour( '#DFC329' );
		$line_dot->set_values( $data_1 );
		$line_dot->set_key( "Line 1", 10 );
		
		
		$default_hollow_dot = new hollow_dot();
		$default_hollow_dot->size(5)->colour('#6363AC');
		
		$line_hollow = new line();
		$line_hollow->set_default_dot_style($default_hollow_dot);
		$line_hollow->set_width( 1 );
		$line_hollow->set_colour( '#6363AC' );
		$line_hollow->set_values( $data_2 );
		$line_hollow->set_key( "Line 2", 10 );
		
		$star = new star();
		$star->size(5);
		
		$line = new line();
		$line_hollow->set_default_dot_style($star);
		$line->set_width( 1 );
		$line->set_colour( '#5E4725' );
		$line->set_values( $data_3 );
		$line->set_key( "Line 3", 10 );
		
		$y = new y_axis();
		$y->set_range( 0, 20, 5 ); 
		
		
		$x_labels = new x_axis_labels();
		$x_labels->set_steps( 2 );
		$x_labels->set_vertical();
		
		$x = new x_axis();
		$x->set_range( 0, 8, 1 );
		$x->set_labels( $x_labels );
		
		
		
		$chart = new open_flash_chart();
		$chart->set_title( new title( 'Three lines example' ) );
		$chart->set_y_axis( $y );
		
		$chart->set_x_axis( $x );
		//
		// here we add our data sets to the chart:
		//
		$chart->add_element( $line_dot );
		$chart->add_element( $line_hollow );
		$chart->add_element( $line );	
?>
<script type="text/javascript" src="/files/js/json/json2.js"></script>
<script type="text/javascript" src="/files/js/swfobject.js"></script>
<script type="text/javascript">
	swfobject.embedSWF("/files/open-flash-chart.swf", "my_chart", "350", "200", "9.0.0");
</script>

<script type="text/javascript">

function ofc_ready()
{
   // alert('ofc_ready');
}

function open_flash_chart_data()
{
    //alert( 'reading data' );
    return JSON.stringify(data);
}

function findSWF(movieName) {
  if (navigator.appName.indexOf("Microsoft")!= -1) {
    return window[movieName];
  } else {
    return document[movieName];
  }
}
    
var data = <?php echo $chart->toPrettyString(); ?>;

</script>
<div id="my_chart"></div>
