GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - pinscript/simplechart: A wrapper arund d3.js for simple (at the moment only) line charts.

BranchesTags
Open more actions menu

Latest commit

 

History

30 Commits
30 Commits

Folders and files

NameName
Last commit message
Last commit date
examples
examples
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
simplechart.css
simplechart.css
 
 
simplechart.js
simplechart.js
 
 

Repository files navigation

Simplechart

A wrapper arund d3.js for simple (at the moment only) line charts.

Usage

This is a basic line chart:

Simple line chart

<head>
    <link rel="stylesheet" href="../simplechart.css" />
    <script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
    <script type="text/javascript">
        var data = {
            "2014-01-01": 10,
            "2014-01-02": 12,
            "2014-01-03": 14,
            "2014-01-04": 12,
            "2014-01-05": 10,
            "2014-01-06": 8,
            "2014-01-07": 2,
        };
        
        window.onload = function() {
            SimpleChart.Line("chart", data);
        };
    </script>
</head>
<body>
    <div id="chart" style="width: 1100px; height: 240px;"></div>
</body>

To draw more than one line, pass data as an array of objects.

More examples can be found in the examples directory.

Custom charts

Charts can be customized by providing the following options:

var options = {
    area: bool (default true),
    smooth: bool (default true),
    axis: bool (default true),
    grid: bool (default true),
    dualAxis: bool (default false),
    points: bool (default true),
    pointSize: int (default 4),
    pointClick: function (function invoked when clicking a point, default none),
    dateFormat: string (a d3 compatible date format, default "%Y-%m-%d"),
    pointTitle: function (function providing the title when hovering over a point, default function (date, count) { return date + ": " + count; })
};

Usage:

SimpleChart.Line("chart", data, options);

TODO

  1. Allow types other than datetime on X axis
  2. Animations
  3. Pie charts

About

A wrapper arund d3.js for simple (at the moment only) line charts.

Resources

Readme
MIT license
Activity

Stars

3 stars

Watchers

2 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.