Coder Social home page Coder Social logo

metricsgraphics / metrics-graphics Goto Github PK

View Code? Open in Web Editor NEW
7.5K 199.0 476.0 8.32 MB

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

Home Page: http://metricsgraphicsjs.org

JavaScript 3.06% TypeScript 95.02% CSS 1.92%

metrics-graphics's Introduction

MetricsGraphics Logo

BundlePhobia CodeClimate Netlify Status

MetricsGraphics is a library built for visualizing and laying out time-series data. At around 15kB (gzipped), it provides a simple way to produce common types of graphics in a principled and consistent way. The library currently supports line charts, scatterplots and histograms, as well as features like rug plots.

Example

All you need to do is add an entry node to your document:

<div id="chart"></div>

Then, use the id to mount the chart:

import LineChart from 'metrics-graphics'

new LineChart({
  data, // some array of data objects
  width: 600,
  height: 200,
  target: '#chart',
  area: true,
  xAccessor: 'date',
  yAccessor: 'value'
})

That's it!

Sample Screenshot

The raw data for this example can be found here

Documentation

If you want to use MetricsGraphics, you can find the public API here.

If you want to extend MetricsGraphics, you can read up on the components and utilities.

Development Setup

This project uses Yarn Workspaces. Please make sure that Yarn is installed.

# clone and setup
git clone https://github.com/metricsgraphics/metrics-graphics
cd metrics-graphics
yarn install

Run both the development setup of the library and the development setup of the examples

# inside packages/lib
yarn dev

# inside packages/examples
yarn dev

metrics-graphics's People

Contributors

almossawi avatar beardicus avatar benwiley4000 avatar blazkovicz avatar cnwangjie avatar dandehavilland avatar dstaley avatar ezekiel-da avatar frewsxcv avatar garrypolley avatar hamilton avatar himanish-star avatar jens-ox avatar matiassingers avatar mattleff avatar mbeijen avatar mikaelbr avatar mreid-moz avatar pcl avatar pmac avatar renovate[bot] avatar rfk avatar sebholstein avatar shikhar-scs avatar t2k avatar tchanders avatar thomaschampagne avatar tlatorre-uchicago avatar uberi avatar wlach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metrics-graphics's Issues

Remove hard-coded release data, and replace with an args.markers object

At least for a lot of Firefox-related charts, we want version markers. Other projects may need different marker. Currently these are all hard-coded to just be ff versions. Needs to be separate.

args.markers should probably look like [{'date': date obj, 'label':'this is a lable'},...] and so on. If the argument exists, then show the markers. If not, don't.

design x axis to also support non-date ranges

For the first release we focused primarily on date ranges, since most of what we're doing is visualizing time series. We should have additional functionality for non date ranges.

Add option for axis units

It would be nice to be able to infer units, but otherwise, perhaps add a new argument to moz_chart.

add bootstrap section designs to examples

We want to show two different sections: the torso view (three graphs or so above the fold) and the section views (containing finer-grained data, with a briefing section).

Create presentation layouts

We need to have a few different canned presentation types. For instance, we will often be in the position of having a handful of small multiples to present in a section, or a full-screen report-style graph. Having some design ideas in mind for this would be very useful.

Settling on setting ids / classes for different graph elements

With some graphics, when one rolls over a date, we may want similar triggers to fire for other graphs for the same date. Currently id / class naming conventions to achieve this are not being met.

This is especially useful for the crafting of numerous small multiples, where rolling over one point might also cause rollover effects on a number of others.

Furthermore, there is no way to say that one WANTS a set of graphs to be linked in their rollover behavior.

Create a documentation page

This should include how to make basic charts, how things are organized, and how to extend the library such that we'll actually accept pull requests.

Add histogram

We need to have time series bar charts for the situations that call for them.

This should primarily be making a new mainPlot, and figuring out how the rolloverOn/Off changes for this graphic type.

Add quantile chart

This is a time series visualization designed to track quantiles over time. I have the code for this separately in another project, and need to port it over to metrics-graphics.

change axis text size for smaller-width graphs

The x-axis labels and markers could stand to be slightly smaller for smaller-width graphs, for the sake of feeling the clutter.

Currently I'm finding width=150 to be a good candidate for the threshold.

We may also play with the number of ticks as well on the y-axis.

Make repo public?

A few people have asked whether we could make the repo public. I think that it's a good idea, though see what you think.

Make area part of line chart optional

This should be handled in the moz.defaults.all object. By default let's leave the blue area available on single line charts, and off for multiple line charts.

Separate constituent elements of the moz_chart function into the new object-based approach

Currenty moz_chart has a bunch of different somewhat-procedural chunks of code. When we add more chart types, it would make sense to abstract these just one level up so we can more easily reuse code & have things be readable. For instance, we will likely use the same axes for lots of different charts, but the rollover logic & data mapping will be fundamentally different. We'll have these:

var charts = {};
charts.line = {
  init: function(){}, \\ makes scales
  x_axis:function(){}, \\ draws x
  y_axis:function(){}, \\ draws y
  main_plot:function(){}, \\  draws the actual graphed elements
  rollover:function(){},  \\  draws whatever invisible rollover elements
  on:function(){},  \\ handles on rollover
  off:function(){}, \\ handles off rollover
  defaults:function(){} \\ has various defaults from whatever those are

create rollover callbacks

I'm thinking of a callback function that takes the data point being rollover'd, and does something with it according to the user's wishes:

function(d){
      $('div#some_div').html(d);
}

This could be useful in many contexts where someone wants additional rollover effects outside of the default behavior, especially if it is outside of the svg element of interest.

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.