- 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]
推薦閱讀
- Django開發從入門到實踐
- Visual Basic程序設計實驗指導(第4版)
- Serverless架構
- Android底層接口與驅動開發技術詳解
- Python數據結構與算法(視頻教學版)
- Salesforce Reporting and Dashboards
- Learning Modular Java Programming
- 智能手機故障檢測與維修從入門到精通
- Python自然語言理解:自然語言理解系統開發與應用實戰
- Android Sensor Programming By Example
- Swift High Performance
- Data Manipulation with R(Second Edition)
- Android應用程序設計
- React and React Native
- 川哥教你Spring Boot 2實戰