Fetching class from array of circles created using javascript -
var a1 = linegroup.selectall("circle")[0]; // gives array of circles //here code not working: var a1 = linegroup.selectall("circle")[0]; function classarray() { return linegroup.select("circle").attr("class"); } var = a1.map(classarray);
following array of circles get:
[<circle cx="74" cy="425.5" r="8" class="limited circlesmall preliteracy"></circle>, <circle cx="108" cy="368" r="8" class="intermediate circlesmall earlywriting"></circle>, <circle cx="142" cy="273.7" r="8" class="advanced circlesmall preliteracy"></circle>, <circle cx="346" cy="391" r="8" class="basic circlesmall writing"></circle>, <circle cx="380" cy="460" r="8" class="limited circlesmall preliteracy"></circle>, <circle cx="380" cy="172.5" r="8" class="basic circlesmall reading"></circle>, <circle cx="414" cy="151.79999999999998" r="8" class="basic circlesmall reading"></circle>, <circle cx="448" cy="105.8" r="8" class="intermediate circlesmall reading"></circle>, <circle cx="482" cy="96.59999999999998" r="8" class="intermediate circlesmall reading"></circle>, <circle cx="516" cy="80.50000000000001" r="8" class="high circlesmall reading"></circle>]
my doubt is, how check if class name preliteracy, reading, high, intermediate, writing, earlywriting (i.e.last value of classes)? how class name in different array?
Comments
Post a Comment