Hi. I'm using JS for d3. What I intend to do is get some data from database and plot them in a diagram I've created. Here's what I've done so far:
Fetched the data from database:
<?php
while($row = mysql_fetch_assoc($query)){
$q_id[] = $row['q_id'];
$res_val[] = $row['response_value'];
$chpt[] = $row['cr_chpt'];
$lvl[] = $row['ql_level'];
}
?>
Sent it to JS:
var id = <?php echo json_encode($q_id); ?>;
var val = <?php echo json_encode($res_val); ?>;
var chpt = <?php echo json_encode($chpt); ?>;
var lvl = <?php echo json_encode($lvl); ?>;
I'm having trouble creating an array for the data though. For static data I've made it something like this:
var dataLevel = [
[280, "ANALYZE", 260, 560],
[230, "APPLY", 260, 510],
[180, "UNDERSTAND", 260, 460],
[130, "REMEMBER", 260, 410]
];
I'll use the array I want to create to plot.
Any help would be appreciated. Thanks.
Atikah