Giter Site home page Giter Site logo

candytalking's Introduction

CandyTalking

Just A Minimal Charts script

Version 1.1

Draws blocks, stacked blocks, dots, lines and Bezier curves from a json structure whose name matches a canvas id. Type of graph is given by the class name: "blocks", "stacked", "dots", "lines" or "bezier", or any combination of them (like "dots+lines"). All sizes, fonts, etc. are based on the dimensions of the canvas.

Run automatically by default when the page is loaded. Executable on demand by renaming it and explicitly calling it from elsewhere, which allows dynamic resizing of the canvas according to the viewport, or avoiding conflicts with other onload() handlers.

<!DOCTYPE html>
<html>
<head>
<title>Some Candy Talking</title>
<script src="https://raw.githubusercontent.com/jzu/candytalking/v1.1/candytalking.js">
</script>
</head>
<body>
<script>
   var curves = {
         "title": "Bezier + Dots",
         "colors": [ "black", "red", "orange" ],
         "data": [
                   [ "Qty/Day", "01/08", "02/08", "03/08", "04/08" ],
                   [ "Var 1", 1, 2, 3, 4 ],
                   [ "Var 2", -10, 5, 1, 5 ]
                 ]
       };
   var histogram = {
         "title": "Histogram",
         "colors": [ "black", "cyan", "green" ],
         "data": [
                   [ "Qty/Day", "01/08", "02/08", "03/08", "04/08" ],
                   [ "Var 1", 1, 2, 3, 4 ],
                   [ "Var 2", -10, 5, 1, 5 ]
                 ]
       };
</script>
<canvas id="curves" class="bezier+dots" width="600" height="500">
 Canvas not supported - please use a real browser
</canvas>
<canvas id="histogram" class="blocks" width="800" height="600">
 Canvas not supported - please use a real browser
</canvas>
</body>
</html>

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.