An extra array line appears out of nowhere, using each function

1. Initial example

2. Example

I had a strange problem when using the graphics plugin from this site . Can anyone understand why the array from the first div.largeareaappears out of nowhere in the lower left corner in the second example?

enter image description here

It has no problems at all, if the page has only div.largearea, as you can see in the first example.

HTML:      

<div class="get" data-stats="10.3,'1','#222222'"></div>
<div class="get" data-stats="15.2,'2','#7D252B'"></div>
<div class="get" data-stats="13.1,'3','#EB9781'"></div>
<div class="get" data-stats="16.3,'4','#FFD2B5'"></div>
<div class="get" data-stats="14.5,'5','#4A4147'"></div></div>
<div class="largearea">
<div class="exampleSimple"></div>

<div class="get" data-stats="10.3,'Nov','#222222'"></div>
<div class="get" data-stats="15.2,'Dec','#7D252B'"></div>
<div class="get" data-stats="13.1,'Oct','#EB9781'"></div>
<div class="get" data-stats="16.3,'June','#FFD2B5'"></div>
<div class="get" data-stats="14.5,'May','#4A4147'"></div></div>

JQuery

$(function() {
    var arrayOfData = [];
    $('.largearea').each(function(){
        var getbar = $(this).find('.get'),
            getpie = $(this).find('.exampleSimple');
            getbar.each(function(){
             var getstats = $(this).data('stats').split(',');
              getstats[1] = getstats[1].replace(/'/g,'');
              getstats[2] = getstats[2].replace(/'/g,'');
              arrayOfData.push(getstats);
            });

        getpie.jqbargraph({
        data: arrayOfData 
    });
  });


});
+4
source share
1 answer

, , div. , div .

, div .

,

0

Source: https://habr.com/ru/post/1544638/


All Articles