GithubHelp home page GithubHelp logo

voldemarlegrand / chartjs-revealed Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 9 KB

Plugin provide a simple way to integrate Chart.js charts in reveal.js presentation framework

License: BSD 3-Clause "New" or "Revised" License

JavaScript 100.00%

chartjs-revealed's Introduction

Chart.js plugin for reveal.js presentation framework

Plugin provide a simple way to integrate Chart.js charts in reveal.js presentation framework :

<section>
    <canvas data-chartjs width="400" height="200">
        var data = [
            {
                value: 300,
                color:"#F7464A",
                highlight: "#FF5A5E",
                label: "Red"
            },
            {
                value: 50,
                color: "#46BFBD",
                highlight: "#5AD3D1",
                label: "Green"
            },
            {
                value: 100,
                color: "#FDB45C",
                highlight: "#FFC870",
                label: "Yellow"
            }
        ];
        return this.chart.Doughnut(data);
    </canvas>
</section>

Code inside the <canvas> tag should define a chart using this.chart object and return this chart.

Installation

Plugin source code should be installed inside reveal.js plugin directory. For example, by symlinking the plugin working copy :

git clone https://github.com/VoldemarLeGrand/chartjs-revealed.git
ln -s ../../chartjs-revealed/plugin/chartjs reveal.js/plugin/chartjs

Next and last step is to load plugin as a presentation dependency :

Reveal.initialize({
    dependencies: [
        { src: "plugin/chartjs/chartjs.js", condition: function() { return !!document.querySelector( "[data-chartjs]" ); } },
    ]
});

API

JavaScript code inside <canvas> is executed with this value pointed to chart object with following properties :

  • canvas : corresponding <canvas> element
  • chart : Chart object created for given <canvas>
  • slide : corresponding <section> element
  • def : define function compiled from <canvas> element text content
  • engine : chart created by define function, used to redraw a chart

Configuration

URL of Chart.js library may be specified in the presentation configuration :

Reveal.initialize({
    chartjs: {
        libUrl: "https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js"
    }
});

Known limitations

  • In current version plugin knows nothing about slide fragments

License

Plugin is released under the BSD License. See LICENSE file for details.

chartjs-revealed's People

Contributors

voldemarlegrand avatar

Watchers

 avatar  avatar

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.