Jump to content

Recommended Posts

Can anyone look at this script and tell me what is wrong here. The chart isn't showing any data. My eyes hurt from looking at it, and I still can't find the problem.

 

<?php
$db_server = "localhost";
$db_baza = "husqvarn_web";
$db_user = "*****";
$db_pass= "*******";

$veza = mysql_connect($db_server,$db_user, $db_pass) or DIE('Nisam se uspio spojiti na server'); 
$veza_baza = mysql_select_db($db_baza,$veza) or DIE('Nisam uspio odabrati bazu');

$data = array();
$upit = "SELECT user_id,COUNT(*) as puno FROM narudba GROUP BY user_id";
$rezultat = mysql_query($upit, $veza);
$broj = mysql_num_rows($rezultat);
while ($row = mysql_fetch_array($rezultat)){

while(list($key,$val) = each($row)){
	if (is_int($key)) continue;
	$GLOBALS[$key] = $val;
	}
$data[] = $puno;
}

// Kraj kupljenja broja narudžbi
$upit2 = "SELECT * FROM users WHERE id = '$user_id'";
$rezultat2 = mysql_query($upit2,$veza);
$broj2 = mysql_num_rows($rezultat2);
while ($row2 = mysql_fetch_array($rezultat2)){

while(list($key,$val) = each($row2)){
	if (is_int($key)) continue;
	$GLOBALS[$key] = $val;
	}
//$data[] = $username;
}
print_r($data);
//Kraj kupljenja imena ljudi koji su naručivali
include_once( 'ofc-library/open-flash-chart.php' );
$bar = new bar_outline( 50, '#9933CC', '#8010A0' );
$bar->key( 'Broj narudzbi', 10 );

for( $i=0; $i<$broj; $i++ )
{
  $bar->data[] = $data;
}
print_r($bar);
$g = new graph();
$g->title( 'Internet narucivanje'." ". date("Y"), '{font-size: 20px;}' );
//
// BAR CHART:
//
//$g->set_data( $data );
//$g->bar_filled( 50, '#9933CC', '#8010A0', 'Broj narudzbi', 10 );
//
// ------------------------
//
$g->data_sets[] = $bar;
//
// X axis tweeks:
//
$g->set_x_labels( array( 'Diler1','Diler2','Diler3', 'Diler4', 'Diler5', 'Diler6' ) );
//
// set the X axis to show every 2nd label:
//
$g->set_x_label_style( 10, '#9933CC', 0, 1 );
//
// and tick every second value:
//
$g->set_x_axis_steps( 1 );
//
$g->set_y_max( 100 );
$g->y_label_steps( 4 );
$g->set_y_legend( 'Broj narudzbi', 12, '#736AFF' );
echo $g->render();
?>

Link to comment
https://forums.phpfreaks.com/topic/99943-open-source-chart-problem/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.