From 5cc3e97c868394722c42eccb5827a61d2d2e8763 Mon Sep 17 00:00:00 2001 From: The Coding Aviator <34807532+thecodingaviator@users.noreply.github.com> Date: Mon, 3 Dec 2018 09:14:30 +0530 Subject: [PATCH] [Fixed Bug] Data Visualization with D3: Learn About SVG in D3 (#27022) --- .../learn-about-svg-in-d3.english.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/learn-about-svg-in-d3.english.md b/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/learn-about-svg-in-d3.english.md index 65dd78320f..ed43c985d7 100644 --- a/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/learn-about-svg-in-d3.english.md +++ b/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/learn-about-svg-in-d3.english.md @@ -16,8 +16,8 @@ CSS can be scalable when styles use relative units (such as vh, -Add an svg node to the body using append(). Give it a width attribute set to the provided w constant and a height attribute set to the provided h constant using the attr() method for each. You'll see it in the output because there's a background-color of pink applied to it in the style tag. -Note
Width and height attributes do not have units. This is the building block of scaling - the element will always have a 5:1 width to height ratio, no matter what the zoom level is. +Add an svg node to the body using append(). Give it a width attribute set to the provided w constant and a height attribute set to the provided h constant using the attr() or style() methods for each. You'll see it in the output because there's a background-color of pink applied to it in the style tag. + Note
When using attr() width and height attributes do not have units. This is the building block of scaling - the element will always have a 5:1 width to height ratio, no matter what the zoom level is. ## Tests @@ -27,10 +27,10 @@ Add an svg node to the body using append()svg element. testString: assert($('svg').length == 1, 'Your document should have 1 svg element.'); - - text: The svg element should have a width attribute set to 500. - testString: assert($('svg').attr('width') == '500', 'The svg element should have a width attribute set to 500.'); - - text: The svg element should have a height attribute set to 100. - testString: assert($('svg').attr('height') == '100', 'The svg element should have a height attribute set to 100.'); + - text: The svg element should have a width attribute set to 500 or styled to have a width of 500px. + testString: assert($('svg').attr('width') == '500'||$('svg').css('width') == '500px', 'The svg element should have a width attribute set to 500 or styled to have a width of 500px.'); + - text: The svg element should have a height attribute set to 100 or styled to have a height of 100px. + testString: assert($('svg').attr('height') == '100'||$('svg').css('height') == '100px', 'The svg element should have a height attribute set to 100 or styled to have a height of 100px.'); ```