I've added a new page to a sub-site.
Added a content editor web-part.
Then added the following D3 javascipt hello world script:
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="D3byEX 1.1">
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script>
d3.select('body')
.append('h1')
.text('Hello World!');
</script>
</body>
</html>
I also tried this:
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script>
d3.select('body')
.append('h1')
.text('Hello World!');
</script>
The page is blank - why is this and what do I need to do to get Hello World?
progress so far
From here I've downloaded the zip "d3.zip": https://d3js.org/
Then I've unzipped the contents into a vanilla document library here:
http://SPaddress/testingSubSite/D3docLib/
Now I've amended the code in the content editor, and tried each of the following -they all produce a blank page:
<script src="http://SPaddress/testingSubSite/D3docLib/d3.min.js" charset="utf-8"></script>
<script>
d3.select('body')
.append('h1')
.text('Hello World!');
</script>
<script src="http://SPaddress/testingSubSite/D3docLib/d3.v3.min.js" charset="utf-8"></script>
<script>
d3.select('body')
.append('h1')
.text('Hello World!');
</script>
<script src="http://SPaddress/testingSubSite/D3docLib/d3.v4.min.js" charset="utf-8"></script>
<script>
d3.select('body')
.append('h1')
.text('Hello World!');
</script>
html
,head
andbody
tags. Run your code after document ready.https
instead ofhttp
. You needhttps
if you want to use cdn