This code creates a bar chart using an SVG node embedded in the HTML. The SVG node uses class "chart" which the style specification at the top refers to as ".chart" and specifies that rectangles should be filled with a steel blue color. The SVG node contains six rectangles, hard coded using "x" and "y" attributes for positioning, and "width" and "height" attributes for sizing. Note also that the SVG coordinate system has its origin in the upper-left corner, so that x values increase to the right and y values increase down from the top of the image.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<style> .chart rect { fill: steelblue } </style> | |
<html><body><p>Here are the magic numbers from Lost:</p> | |
<svg class="chart" width="120" height="420"> | |
<g transform="translate(0,380)"> | |
<rect width="19" height="40"></rect> | |
</g> | |
<g transform="translate(20,340)"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<style> .chart rect { fill: steelblue } </style> | |
<html><body> | |
<p>Here are the magic numbers from Lost: <span id="data"></span></p> | |
<svg class="chart" width="120" height="500"> | |
<rect id="bar-1"></rect> | |
<rect id="bar-2"></rect> | |
<rect id="bar-3"></rect> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
height: 350 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
height: 450 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<script src="//d3js.org/d3.v3.min.js"></script> | |
<style> | |
.chart rect { fill: steelblue } | |
.axis path, | |
.axis line { | |
fill: none; | |
stroke: black; | |
shape-rendering: crispEdges; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<style> .chart rect { fill: steelblue } </style> | |
<html><body> | |
<p>Here are the magic numbers from Lost: <span id="data"></span></p> | |
<svg class="chart" width="120" height="500"> | |
<rect></rect> | |
<rect></rect> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<style> .chart rect { fill: steelblue } </style> | |
<html><body> | |
<p>Here are the magic numbers from Lost: <span id="data"></span></p> | |
<svg class="chart" width="120" height="500"> | |
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<script src="http://d3js.org/d3.v4.min.js"></script> | |
<style> .chart rect { fill: steelblue } </style> | |
<html><body> | |
<p>Here are the magic numbers from Lost: <span id="data"></span></p> | |
<svg class="chart"></svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 |
OlderNewer