HTML5 Canvas Fundamentals - Creating a Simple Bar Chart

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

When you fill the rectangle, how does currX += work? How does it advance the x value?

dawnbroadbent
Автор

Thank you great video, you speech is very clear and mild speed. i learned a lot. one more sub for ya

girlandhercomputer
Автор

Incredible tutorial, thank you, thank you sir

solomonjenkins
Автор

Hi, it isnt working for me, when I run the code the browser remains white. Here is the code:
<!DOCTYPE html>
<html>
<head>
<script>
window.onload function() {

var canvas =
var ctx = canvas.getContext("2d");

var data = [1, 12, 20, 14, 13, 9, 5];
var width = 50;
var currX = 50;
var base = 200;

ctx.fillStyle = "green";

for (var i = 0; i < data.lenght; i++) {
var h = data[i];
ctx.fillRect(currX, canvas.height - h, width, h);
currX += width + 10;
}
};

</script>
</head>
<body>
<canvas id="myCanvas" width="400" height="200">
</body>
</html>

Tomco-
Автор

Thanks, very helpful! ..adding to my favorites

evarona
Автор

hiii man 
Thank u so much 
simple and helpful just the way i like it :D

akomakrony