d3.js

interaction between html document and console

Naranjito 2020. 12. 28. 16:05
  • HTML document
<!DOCTYPE html>
<html lang="en">
<head>
    
    <title>D3js</title>
    <script src="https://d3js.org/d3.v6.min.js"></script>

</head>
<body>

    

    <script>

        var data = [10,20,30,40,50];

       
    </script>
    
</body>
</html> 

 

 

  • Console in the Inspector
> data.shift(); //shift gives me the first value in the array
< 10

> data.sort(d3.descending); //get data by descending
< [50, 40, 30, 20] (4)

> d3.min(data);
< 10

> d3.extent(data); //extent gives me both minimum and maximum value 
< [10, 50] (2)

> d3.shuffle(data); //it shuffles around the values in array, random order
< [50, 30, 10, 20, 40] (5)

 

'd3.js' 카테고리의 다른 글

path  (0) 2020.12.29
load external data(json data)  (0) 2020.12.28
duration, delay, transition, on  (0) 2020.12.28
enter, update, exit  (0) 2020.12.28
axis, ticks  (0) 2020.12.28