datavisyn/chartjs-scale-hierarchical

Error if children has only 1 member

Closed this issue · 3 comments

kocil commented

Dear developer.
This plugin is really awesome.
Just reporting, there is a problem with data like attached below.
If the "A" node is expanded, the chart will disappear.

const data = {  
   "labels":[{  
         "label":"A",
         "expand":false,
         "children":["2013"]
      },{  
         "label":"E",
         "expand":false,
         "children":["2013","2014","2015"]
      }],
   "datasets":[{  
         "label":"Exemplary",
         "backgroundColor":"blue",
         "tree":[{  
               "value":39.57,
               "children":[39.57]
            },
            {  
               "value":73.84,
               "children":[58.93,75.93,86.67]
            }]
      },{  
         "label":"Satisfactory",
         "backgroundColor":"green",
         "tree":[{
               "value":38.4,
               "children":[38.4]  
            },
            {  
               "value":19.23,
               "children":[32.14,16.67,8.89]
            }]
      },{  
         "label":"Developing",
         "backgroundColor":"orange",
         "tree":[{  
               "value":18.11,
               "children":[18.11]  
            },{  
               "value":6.33,
               "children":[7.14,7.41,4.44]
            }
         ]
      },{  
         "label":"Unsatisfactory",
         "backgroundColor":"red",
         "tree":[{  
               "value":3.92,
               "children":[3.92]  
            },{  
               "value":0.6,
               "children":[1.79,0,0]
            }]
      }]
};
kocil commented

Great. Thank you very much 👍