Gnacer

Members
  • Content count

    1
  • Joined

  • Last visited

About Gnacer

  • Rank
    Forum Newbie
  1. Does anyone know if it is possible to use multi-dimensional associative arrays to generate chart data. I am trying to write my own extention to FC, but am running into a snag when it comes to making entries line up where they should. In the following examply of what I'm trying to do, I have 3 categories (employees) along the X-axis, and I have 3 dataset (Bid, Awards, Completed). 2 of the employees have both Bids and Awarded Data, while the third only has Completed Data. I would like to pass the associated array, and have the chart reflect the data correctly. $data['Emp 1']['Bids'] = 14; $data['Emp 1']['Awarded'] = 4; $data['Emp 2']['Bids'] = 12; $data['Emp 2']['Awarded'] = 3; $data['Emp 3']['Complete'] = 20; foreach ($data as $k => $v) { $FC->AddCategory($k); foreach ($v as $k1 => $v1) { if ($v1 != 0) { $sets[$k1][$k] = $v1; } else { $sets[$k1][$k] = ''; } } } foreach ($sets as $k => $v) { $FC->AddDataset($k); foreach ($v as $val) { $FC->AddChartData($val); } } However, when I do this, the 20 jobs listed for Emp 3 and Completed wind up under Emp 1 Completed. Without several 'foreach' loops created empty data to ensure placeholders are there so the data shows up correct, is there a better way to handle this problem? Any help would be appreciated