block by fil bd34bc50c53608fc1ab6f3472e065769

Hello Lea (MAVO and D3 interaction)

Full Screen

Testing interaction between MAVO and D3.

index.html

<!DOCTYPE html>
<head>
  <meta charset="utf-8">
  <script src="https://d3js.org/d3.v4.min.js"></script>


	<link rel='stylesheet' href='https://mavo.io/demos/style.css'>
  <link rel='stylesheet' href='style.css'>
  <script src="https://dev.mavo.io/dist/mavo.js"></script>
  <link rel="stylesheet" href="https://dev.mavo.io/dist/mavo.css">

  <style>
    body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
    h3 { border-top: 3px brown solid }
    
  </style>
</head>

<body>

  <h3>1. Mavo app</h3>
  
<div mv-app="elementStorage" mv-storage="#data">
  Edit me: 
	<span property="firstName">David</span>
	<span property="lastName">Karger</span>
</div>
  
  <h3>2. Mavo HTML data storage</h3>
  
  <pre id="data">{
	"firstName": "Lea",
	"lastName": "Verou"
}</pre>
  
  
  <h3>3. d3 reading the storage</h3>
  
  <p>placeholder</p>

  <script>

    d3.interval(function(e) {
      d3.select('p').text(
        'Hello ' + JSON.parse(d3.select("#data").text()).firstName
      );
    })
    
  </script>
</body>