Code Monkey home page Code Monkey logo

simple-chart's Introduction

simple-chart

Simple chart written with JavaScript and you even don't need to add any css files. I didn't use any CDN links or JavaScript libraries, so you don't have to add any files or links execpt what you download from here.

just download and use.

How to use

Doanload the files and put chart.js or chart.min.js and data.json(which will be your personal API) in your project folder. Add this following script to your file:

<script type="text/javascript" src="chart.min.js"></script>

Then just add these HTML tags to your HTML file:

<div class="container">
    <div class="chart">
        <div class="label-x"></div>
        <div class="label-y"></div>
    </div>
    <div class="info">
        <h2>-</h2>
        <p>-</p>
        <pre>-</pre>
    </div>
</div>

Notice that you can ADD new classes to the elements but you can't change the main classes.

JSON file

The json file which the information read from that called data.json that has some contents for example.

The structure of json file is like this:

{
  "labels": {
    "x": "Horizontal axis content",
    "y": "Vertical axis content"
  },
  "activeColor": "Active column color",
  "items": [
    {
      "title": "Title of each content",
      "description": "...",
      "color": "Color of the column",
      "value": "A number (with intiger type NOT string)"
    }
  ]
}

Note that you can just change the content of API not the names of each list. You can't change the names like items, activeColor, ..etc

demo

I put a folder called demo in the files you download to specify how to use the files there.

Your HTML file should looks like this:

chart

You can change the content by using arrow keys(right and left) and also hover the column that you want to see its contents.

Avoid error

You may see an error or white screen while opening the files normally in the browser.

Use this syntax for this purpose:

python -m http.server

You can also use apps like Wampserver or Xampp to run mentioned file.

Author

Atena Dadkhah

simple-chart's People

Contributors

atenadadkhah avatar

Stargazers

 avatar

Watchers

 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.