javascript - How to make multiple drilldown highcharts? -


i have succeeded in making 1 drilled highcharts. btw, highcharts' data taken database, not manually typed. want make multiple drill this: http://jsfiddle.net/vf3yt/1108/

here table :

faculty

enter image description here

department

enter image description here

major

enter image description here

i have controller , view this:

controller

    public function actionindex()     {   //data usia fakultas         $categoryarray = [];          $faculty = (new \yii\db\query())             ->select(['faculty'])             ->from('faculty')             ->limit(10)             ->column();          array_push($categoryarray,                     array('id'=>0,                         'categories'=>$faculty));          $faculty2 = array_map('floatval', $faculty);           $lessfaculty = (new \yii\db\query())             ->select(['lessthan25'])             ->from('faculty')             ->limit(10)             ->column();          $fakultas = $faculty;            $lessfaculty = array_map('floatval', $lessfaculty);          foreach ($lessfaculty $key => $lessfaculty_value) {             $lessfaculty[$key] = [                 'name' => 'fakultas',                 'y' => $lessfaculty_value,                 'drilldown' => 'department'.$fakultas[$key].'less'             ];         };           $betweenfaculty = (new \yii\db\query())             ->select(['btween25to29'])             ->from('faculty')             ->limit(10)             ->column();                        $betweenfaculty = array_map('floatval', $betweenfaculty);          foreach ($betweenfaculty $key => $betweenfaculty_value) {             $betweenfaculty[$key] = [                 'name' => 'fakultas',                 'y' => $betweenfaculty_value,                 'drilldown' => 'department'.$fakultas[$key].'betw'             ];         };            $data['faculty'] = json_encode($faculty);         $data['lessfaculty'] = json_encode($lessfaculty);         $data['betweenfaculty'] = json_encode($betweenfaculty);   // next         $i = 1;         $drilldownarray = [];         foreach($faculty2 $keyf=>$faculty_value){          $department = (new \yii\db\query())             ->select(['department'])             ->from('department')             ->where('department "'.$fakultas[$keyf].'%"')             ->limit(10)             ->column();          array_push($categoryarray,                     array('id'=>$i,                         'categories'=>$department));         $department2 = array_map('floatval', $department);            $lessdepartment = (new \yii\db\query())             ->select(['lessthan25'])             ->from('department')             ->where('department "'.$fakultas[$keyf].'%"')             ->limit(10)             ->column();         $departemen = $department;         $lessdepartment = array_map('floatval', $lessdepartment);          foreach ($lessdepartment $key => $lessdepartment_value) {                 $lessdepartment[$key] = [                 'name' => $fakultas[$keyf].($key+1),                 'y' => $lessdepartment_value,                 'drilldown' => 'major'.$departemen[$key].'less'             ];             };          array_push($drilldownarray,                     array('name'=>'lessthan25',                         'xaxis'=> $keyf+1,                         'id'=>'department'.$fakultas[$keyf].'less',                         'data'=>$lessdepartment));           $betweendepartment = (new \yii\db\query())             ->select(['btween25to29'])             ->from('department')             ->where('department "'.$fakultas[$keyf].'%"')             ->limit(10)             ->column();          $betweendepartment = array_map('floatval', $betweendepartment);         foreach ($betweendepartment $key => $betweendepartment_value) {                 $betweendepartment[$key] = [                 'name' => $fakultas[$keyf].($key+1),                 'y' => $betweendepartment_value,                 'drilldown' => 'major'.$departemen[$key].'betw',             ];             };               array_push($drilldownarray,                     array('name'=>'btween25to29',                         'xaxis'=> $keyf+1,                         'id'=>'department'.$fakultas[$keyf].'betw',                         'data'=>$betweendepartment));          //next         foreach($department2 $keyd=>$department_value){         $major = (new \yii\db\query())             ->select(['major'])             ->from('major')             ->where('major "'.$departemen[$keyd].'%"')             ->limit(10)             ->column();          array_push($categoryarray,                     array('id'=>$i,                         'categories'=>$major));          $lessmajor = (new \yii\db\query())             ->select(['lessthan25'])             ->from('major')             ->where('major "'.$departemen[$keyd].'%"')             ->limit(10)             ->column();         $lessmajor = array_map('floatval', $lessmajor);          foreach ($lessmajor $key => $lessmajor_value) {                 $lessdmajor[$key] = [                 'name' => $departemen[$keyd].($key+1),                 'y' => $lessmajor_value             ];             };          array_push($drilldownarray,                     array('name'=>'lessthan25',                         'xaxis'=> $keyd+1,                         'id'=>'major'.$departemen[$key].'less',                         'data'=>$lessdepartment));          $betweenmajor = (new \yii\db\query())             ->select(['btween25to29'])             ->from('major')             ->where('major "'.$departemen[$keyd].'%"')             ->limit(10)             ->column();          $betweenmajor = array_map('floatval', $betweenmajor);          foreach ($betweenmajor $key => $betweenmajor_value) {                 $betweenmajor[$key] = [                 'name' => $departemen[$keyd].($key+1),                 'y' => $betweenmajor_value             ];             };              array_push($drilldownarray,                     array('name'=>'btween25to29',                         'xaxis'=> $keyd+1,                         'id'=>'major'.$departemen[$key].'betw',                         'data'=>$betweendepartment));     }          $i++;      }           $data['categoryarray'] = json_encode($categoryarray);          $data['drilldownarray'] = json_encode($drilldownarray);          $data['major'] = json_encode($major);         $data['lessmajor'] = json_encode($lessmajor);         $data['betweenmajor'] = json_encode($betweenmajor);               return $this->render('index',$data);          } 

view

$(function () {       $('#containers').highcharts({         chart: {             type: 'column'         },         title: {             text: 'basic drilldown'         },          xaxis: $categoryarray,         legend: {             enabled: false         },          plotoptions: {             series: {                 borderwidth: 0,                 datalabels: {                     enabled: true,                 }             }         },          series: [             {                 name: 'lessthan25',                  data: $lessfaculty,              },             {                 name: 'btween25to29',                  data: $betweenfaculty,              }],          drilldown: {               series: $drilldownarray           }     }) }); ")?> 

when tried make multiple drilldwon, result this:

enter image description here

here link of full code anyway

controller : https://pastebin.com/rgmgp4ci

view : https://pastebin.com/hcqlzv5b

what may fix that?

thanks in advance


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -