- 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]
推薦閱讀
- Java EE框架整合開發(fā)入門到實戰(zhàn):Spring+Spring MVC+MyBatis(微課版)
- Flink SQL與DataStream入門、進階與實戰(zhàn)
- C語言程序設計實訓教程
- Python編程與幾何圖形
- C語言程序設計
- 算法訓練營:提高篇(全彩版)
- MySQL程序員面試筆試寶典
- Java Hibernate Cookbook
- Python Linux系統(tǒng)管理與自動化運維
- JavaWeb從入門到精通(視頻實戰(zhàn)版)
- 面向物聯(lián)網的Android應用開發(fā)與實踐
- Learning Google Apps Script
- 三步學Python
- Unity AI Game Programming(Second Edition)
- 3ds Max瘋狂設計學院