项目作者: burz

项目描述 :
A JS graph class for non-uniform time data
高级语言: JavaScript
项目地址: git://github.com/burz/TimeGraph.git
创建时间: 2015-04-09T21:33:04Z
项目社区:https://github.com/burz/TimeGraph

开源协议:MIT License

下载


TimeGraph

A JS graph class for non-uniform time data

TimeGraph is used for data like the following:

  1. var data = [
  2. {"name":"Series 1","created_at":"2015-03-30T06:06:48.363Z","data":[
  3. {"created_at":"2015-03-30T06:06:48.439Z","value":1500}
  4. ]},
  5. {"name":"Series 2","created_at":"2015-03-29T21:37:00.846Z","data":[
  6. {"created_at":"2015-03-30T03:57:04.024Z","value":73042},
  7. {"created_at":"2015-03-30T01:05:20.670Z","value":73042},
  8. {"created_at":"2015-03-29T21:42:39.941Z","value":73042},
  9. {"created_at":"2015-03-29T21:37:00.858Z","value":1500}
  10. ]},
  11. {"name":"Series 3","created_at":"2015-04-02T17:42:42.759Z","data":[
  12. {"created_at":"2015-04-02T17:42:42.812Z","value":1500}
  13. ]}
  14. ];

Suppose that we have an HTML div element with id graph_canvas, then we can render
a graph with the following javascript commands:

  1. var margin = { top: 10, bottom: 40, left: 65, right: 20 };
  2. var width = 700;
  3. var height = 400;
  4. var graph = new TimeGraph(margin, width, height, '#graph_canvas');
  5. graph.loadGraph(data);

Once a data set has been loaded it is also possible to reload another data set:

  1. graph.reloadGraph(other_data);

Note that d3 and jquery.tipsy are required.