- 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]
推薦閱讀
- Objective-C Memory Management Essentials
- Learning Cython Programming
- C程序設計簡明教程(第二版)
- 數字媒體應用教程
- MySQL數據庫應用與管理 第2版
- 算法訓練營:入門篇(全彩版)
- Kotlin Standard Library Cookbook
- 精通網絡視頻核心開發技術
- MongoDB權威指南(第3版)
- Unity UI Cookbook
- PHP編程基礎與實例教程
- Tableau 10 Bootcamp
- Mobile Device Exploitation Cookbook
- Internet of Things with ESP8266
- Node.js 12實戰