- 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]
推薦閱讀
- Cocos2d Cross-Platform Game Development Cookbook(Second Edition)
- Getting Started with Gulp(Second Edition)
- Docker and Kubernetes for Java Developers
- Fundamentals of Linux
- Docker技術入門與實戰(第3版)
- 精通軟件性能測試與LoadRunner實戰(第2版)
- Python GUI Programming Cookbook
- Hands-On GPU:Accelerated Computer Vision with OpenCV and CUDA
- Java EE 7 Performance Tuning and Optimization
- Hands-On Natural Language Processing with Python
- Swift語言實戰精講
- C語言開發基礎教程(Dev-C++)(第2版)
- C專家編程
- FPGA嵌入式項目開發實戰
- Instant Zurb Foundation 4