官术网_书友最值得收藏!

  • Expert Data Visualization
  • Jos Dirksen
  • 103字
  • 2021-07-09 18:22:41

Creating dummy data

The first thing it does is that it creates some dummy data. This is the data that determines how many rectangles to render, and how large the rectangles will be:

var rectangleWidth = 100, 
data = [],
numberOfRectangles = Math.ceil(Math.random() * 7);

for (var i = 0 ; i < numberOfRectangles ; i++) {
data.push((Math.random() * rectangleWidth / 2)
+ rectangleWidth / 2);
}

This is just plain JavaScript, and this will result in the data array being filled with one to seven numeric values ranging from 50 to 100. It could look something like this:

[52.653238934888726, 88.52709144102309, 81.70794256804369, 58.10611357491862]
主站蜘蛛池模板: 家居| 陆良县| 莱州市| 青州市| 满城县| 布拖县| 漳浦县| 高陵县| 甘洛县| 呼图壁县| 繁昌县| 富锦市| 尚义县| 湟中县| 综艺| 长子县| 邯郸市| 龙岩市| 栾川县| 临夏县| 砚山县| 商丘市| 通许县| 额敏县| 大洼县| 门头沟区| 满城县| 伊通| 霍林郭勒市| 阿坝| 黄山市| 博野县| 万全县| 轮台县| 黎城县| 荣昌县| 福鼎市| 荆门市| 加查县| 永靖县| 兴义市|