jqplot help

Hi

anyone got a example of how to to make jqplot with dynamic php data?

Thanks
LVL 3
3xtr3m3dAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
3xtr3m3dAuthor Commented:
this is my current plot

line = [0,0,0,6,1,0,0,0,0,0,0,0];	
plot = $.jqplot('chartdiv', [line], {
    legend:{show:false},
    title:'Monthly Completed Orders For 2011',
    seriesDefaults:{
        renderer:$.jqplot.BarRenderer,
		rendererOptions:{ varyBarColor : true, barWidth: 20}
    },
    series:[{label:'2011'}],
    axes:{
        xaxis:{
            renderer:$.jqplot.CategoryAxisRenderer, 
            ticks:['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        }, 
        yaxis:{autoscale:true,tickOptions: {formatString: '%d'}}
    },
	seriesColors: [ "#4bb2c5", "#c5b47f"]

});

Open in new window


any idea how to build this line = [0,0,0,6,1,0,0,0,0,0,0,0]; with php and draw plot?
0
leakim971PluritechnicianCommented:
you don't like my links? check the first one for example : http://stackoverflow.com/questions/3445962/wait-for-response-with-getjson

on the php side something like :


<?php

$j = array();

$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}

// example of query
$query = "SELECT quantity FROM orders ORDER BY id DESC LIMIT 12";
$result = mysql_query($query,$link);

if (!$result) {
    $message  = 'Invalid query: ' . mysql_error() . "\n";
    $message .= 'Whole query: ' . $query;
    die($message);
}

var $a = array()

while ($row = mysql_fetch_assoc($result)) {
    $a[] = $row['quantity'];
}

$j["arrayName"] = $a
$j["newTitle"] = "title";

$json = json_encode($j);
header("Content-type: application/json");
echo $json;

?>

Open in new window

0
3xtr3m3dAuthor Commented:
you are awesome. Thank you verymuch.
0
leakim971PluritechnicianCommented:
You're welcome! Thanks for the points!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.