10 - Data visualization
Giving Data Meaning
Prezentácia
Motivácia
Dať dátam ich význam a zobraziť ich tak, aby sme ich vedeli porovnať a spracovať.
Porovnaj:
Inšpirácia
Zadanie
Použité príkazy
loadTable()
Reads the contents of a file or URL and creates a p5.Table object with its values.
get() (p5.Table)
Retrieves a value from the Table's specified row and column. The row is specified by its ID, while the column may be specified by either its ID or title. https://p5js.org/reference/p5.Table/get
lerpColor()
Blends two colors to find a third color between them.
Zdroje dát
let tempData = []; // Array to store upcoming temperature data
let apiKey = 'P2ePAXCKPdyu2bqEESAWgAMqhzIFvr53';
let city = 'Bratislava'; // City name
function preload() {
let apiURL = `https://api.tomorrow.io/v4/timelines?location=${city}&fields=temperature×teps=1d&units=metric&apikey=${apiKey}`;
loadJSON(apiURL, processWeatherData);
}
function processWeatherData(data) {
// Extract daily temperatures
tempData = data.data.timelines[0].intervals.map(interval => interval.values.temperature);
}
Last updated