GithubHelp home page GithubHelp logo

shotishu / metrics-graphics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from metricsgraphics/metrics-graphics

0.0 2.0 0.0 3.05 MB

A library optimized for concise, principled data graphics and layouts.

Home Page: http://metricsgraphicsjs.org

License: Mozilla Public License 2.0

CSS 5.55% JavaScript 94.01% Python 0.44%

metrics-graphics's Introduction

Build Status Code Climate

MetricsGraphics.js is a library optimized for visualizing and laying out time-series data. At under 60KB (minified), it provides a simple way to produce common types of graphics in a principled and consistent way. The library currently supports line charts, scatterplots, histograms, bar charts and data tables, as well as features like rug plots and basic linear regression.

A sample set of examples may be found on the examples page. The example below demonstrates how easy it is to produce a graphic. Our graphics function provides a robust layer of indirection, allowing one to more efficiently build, say, a dashboard of interactive graphics, each of which may be pulling data from a different data source. For the complete list of options, and for download instructions, take a look at the sections below.

MG.data_graphic({
    title: 'Downloads',
    description: 'This graphics shows Firefox GA downloads for the past six months.',
    data: downloads_data, \\ an array of objects, such as [{value:100,date:...},...]
    width: 600,
    height: 250,
    target: '#downloads', \\ the html element that the graphic is inserted in
    x_accessor: 'date',  \\ the key that accesses the x value
    y_accessor: 'value' \\ the key that accesses the y value
})

The API is simple. All that's needed to create a graphic is to specify a few default parameters and then, if desired, override one or more of the optional parameters on offer. We don't maintain state. In order to update a graphic, one would call MG.data_graphic on the same target element.

The library is data-source agnostic. While it provides a number of convenience functions and options that allow for graphics to better handle things like missing observations, it doesn't care where the data comes from.

Though originally envisioned for Mozilla Metrics dashboard projects, we are making this repository public for other to use, knowing full well that we are far from having this project in good-enough shape. Take a look at the issues to see the milestones and other upcoming work on this repository. We are currently using semantic versioning.

http://metricsgraphicsjs.org

Important changes in v2.0

  1. The library is now namespaced. data_graphic is now MG.data_graphic, convert_dates is now MG.convert.date, clone is now MG.clone, button_layout is now MG.button_layout and data_table is now MG.data_table. We added a new convenience function called MG.convert.number.
  2. The rollover_callback option has been renamed mouseover and expanded in order to make it more consistent with other libraries. We now have three callback functions available: mouseover, mouseout and mousemove.
  3. CSS rules have been prefixed and in some cases updated for consistency. active_datapoint for instance is now mg-active-datapoint.

Quick-start guide

  1. Download the latest release.
  2. Follow the examples here and here to see how graphics are laid out and built. The examples use json data from examples/data, though you may easily pull data from elsewhere.

Dependencies

The library depends on D3 and jQuery.

Contributing

If you would like to help extend MetricsGraphics.js or fix bugs, please fork the library and install Node.js. Then, from the project's root directory install gulp:

install gulp

Then, install the library's dependencies:

npm install

To build the library from source, type:

gulp build:js

To run tests, type:

gulp test

To run the development server (accessible at http://localhost:4300):

gulp serve

Resources

Download package

The download package includes everything that you see on metricsgraphicsjs.org. In order to use the library in your own project, the only files that you'll need are the ones under dist. Remember to load the set of third-party libraries that are there in the examples pages. If your project uses Bootstrap, make sure you load MetricsGraphics.js after it.

Frequently asked question

What does MetricsGraphics.js do that library x doesn't do?

If library x works for you, you should keep using it. We're not aiming to be competitive with libraries that already exist. We're aiming to make a library that meets our needs. We also happen to think that the world needs a principled data presentation library, and that many of our needs are the same as other folks'.

License

The MetricsGraphics.js code is shared under the terms of the Mozilla Public License v2.0. See the LICENSE file at the root of the repository. The current logo is courtesy of Font Awesome.

metrics-graphics's People

Contributors

almossawi avatar hamilton avatar dandehavilland avatar tlatorre-uchicago avatar matiassingers avatar mikaelbr avatar blazkovicz avatar mreid-moz avatar garrypolley avatar rfk avatar sebholstein avatar t2k avatar mattleff avatar nampnq avatar umtrey avatar

Watchers

James Cloos avatar shotishu 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.