Giter Club home page Giter Club logo

reveal.js-diagram-plugin's Introduction

reveal.js-diagram-plugin

See live demo here

Installation

Install as first Reveal.js plugin - d3js

Download revealjs-diagram.js and revealjs-diagram.css into the plugin folder of your reveal.js presentation ((i.e. plugin/diagram).

Adding a diagram to your presentation

To add a diagram to your presentation you need to include a D3 visualization in your slide:

<section>
    <div class="fig-container"
        data-fig-id="fig-collision-detection"
        data-file="diagram.html"></div>
</section>

For more information refer to the d3js plugin

Defining the diagram

In the file diagram.html:

<!DOCTYPE html>
<meta charset="utf-8">
<head>
  <link rel="stylesheet" href="plugin/diagram/revealjs-diagram.css">
</head>
<body>
  <script src="https://d3js.org/d3.v3.min.js"></script>
  <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
  <script src="plugin/diagram/revealjs-diagram.js"></script>
  <script>

    var treeData = {
      name: 'A',
      x0: window.diagram.height / 2,
      y0: 0,
      children: []
    };

    var _transitions = [
      window.diagram.addItem('B', 'A', treeData),
    ];

    var _inverse_transitions = [
      window.diagram.removeItem('B', treeData),
    ];

    // register the diagram
    window.diagram.register('intro', function() {
      window.diagram.init(treeData);
    });
  </script>
</body>

APIs

window.diagram.addItem(newNode, parentNode, treeData): Add a newNode to an existing parentNode

window.diagram.removeItem(node, treeData): Remove a node element

window.diagram.addLink(sourceNode, targetNode, treeData): Add a link between two existing nodes

window.diagram.removeLink(sourceNode, targetNode, treeData): Remove a link between two existing nodes

window.diagram.register(name, callback): Register a diagram, tipically the callback will invoke window.diagram.init

window.diagram.init(treeData): Initialize the rendering of a diagram

reveal.js-diagram-plugin's People

Contributors

teone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

reveal.js-diagram-plugin's Issues

pdf export

Hi,

Your plugin looks great but it seems that it is unable to export to pdf correctly am I right ?

Thanks

Best regards!

Is this still working?

Hi, basically I wanted to know if this is still working with the new versions of reveal etc. I got d3js running and the demo working but I have not managed to get this diagram plugin running, and I have tried quite some time now. Could it be that it is outdated or something?

Error in README.md file

Hello,

Nice work. When we want to call the diagram in the working reveal slides html, the readme file should be:

<section class="fig-container"
     data-fig-id="fig-diagram1"
     data-file="diagram1.html">
</section>

Could this be updated, so to be consistent for new users?

Thank you

Blocked a frame with origin "null" from accessing a cross-origin frame

There is an issue trying to use the example.

Uncaught DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame.
    at HTMLIFrameElement.iframe.onload (/javascript-development/reveal.js/node_modules/reveal.js-d3js/d3js.js:38:42)

I have read this post: https://stackoverflow.com/questions/25098021/securityerror-blocked-a-frame-with-origin-from-accessing-a-cross-origin-frame

and this:

https://stackoverflow.com/questions/3102819/disable-same-origin-policy-in-chrome
In order to run the program.
However I think it could be a potential security bug.

What do you suggest to fix them without change the browser behavior?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.