From 0f1d068b7b61432856c1d8b6d73a38ea57ff77d4 Mon Sep 17 00:00:00 2001 From: Lucas Verney Date: Sat, 19 Apr 2014 18:12:46 +0200 Subject: [PATCH] Create gh-pages branch via GitHub --- index.html | 27 +++++++++++++++------------ params.json | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index fbd624a..094465a 100644 --- a/index.html +++ b/index.html @@ -31,9 +31,9 @@

Timeline.js

-

Timeline.js is a lightweight JS library to plot graphs using SVG. As it uses SVG, you can add event listeners on the plotted graph very easily.

+

Timeline.js is a lightweight JS library to plot graphs using Timeline. As it uses Timeline, you can add event listeners on the plotted graph very easily.

-

I coded it because I couldn't find any basic JS library to do this, without any external dependencies and extra features. Timeline.js is only 13k once minified, and can be reduced under 10k thanks to obfuscation. Better results may be obtained with a little refactor, but that's enough for me. Plus it can be very easily customised to fit your needs.

+

I coded it because I couldn't find any basic JS library to do this, without any external dependencies and extra features. Timeline.js is only 13k once minified, and can be reduced under 10k with obfuscation. Better results may be obtained with a little refactor, but that's enough for me. Plus it can be very easily customised to fit your needs.

Live demos

@@ -46,6 +46,7 @@
  • Line only graph example
  • Graph with legend example
  • Interactivity with points example
  • +
  • Multiple holders example
  • Usage

    @@ -53,40 +54,42 @@

    First, you must include the timeline.js or timeline.min.js script.

    -

    Then, you need to init the SVG drawing, thanks to SVG.init({'id': 'holder', 'height': '100%', 'width': '100%', 'grid': 'both', 'x_axis': true, 'rounded': false, 'x_callback': false});. The arguments are all optional and are:

    +

    Then, you need to init a Timeline object, using something like var tl = new Timeline({'id': 'holder', 'height': '100%', 'width': '100%', 'grid': 'both', 'x_axis': true, 'rounded': false, 'x_callback': false});. The arguments are all optional and are:

    Then, you can add as many graphs as you want, thanks to SVG.addGraph(NAME, COLOR); where COLOR must be a valid CSS color. -And you can add points thanks to SVG.addPoints(GRAPH_NAME, POINTS);. Points is an array of point objects, which are of the type {'x': ABSCISSA, 'y': ORDINATE, 'label': LABEL}. LABEL is the text to display in the infobox when the mouse is over the point. You can use '%x' and '%y' in labels and they will be automatically replaced by the coordinates. You can also use <sup> and <sub> HTML tags. You can add another (optional) element click which must be a ffunction to bind to onclick event on this point.

    +

    Note : One Timeline object corresponds to one holder.

    -

    Note : You don't have to sort the points inside a same list of points in a SVG.addGraph call. They will be sorted for you. But, if you call SVG.addPoints multiple times, you must sort the points yourself between each call. The script won't do it for you and it will result in weird graphs if you don't do it.

    +

    Then, you can add as many graphs as you want, with tl.addGraph(NAME, COLOR); where COLOR must be a valid CSS color. +And you can add points using tl.addPoints(GRAPH_NAME, POINTS);. Points is an array of point objects, which are of the type {'x': ABSCISSA, 'y': ORDINATE, 'label': LABEL}. LABEL is the text to display in the infobox when the mouse is over the point. You can use '%x' and '%y' in labels and they will be automatically replaced by the coordinates. You can also use <sup> and <sub> HTML tags. You can add another (optional) element click which must be a ffunction to bind to onclick event on this point.

    -

    Finally, you can draw the SVG thanks to SVG.draw();.

    +

    Note : You don't have to sort the points inside a same list of points in a tl.addGraph call. They will be sorted for you. But, if you call tl.addPoints multiple times, you must sort the points yourself between each call. The script won't do it for you and it will result in weird graphs if you don't do it.

    + +

    Finally, you can draw the timeline with tl.draw();.

    Other functions

    License

    diff --git a/params.json b/params.json index 275c5fa..0bafdb3 100644 --- a/params.json +++ b/params.json @@ -1 +1 @@ -{"name":"Timeline.js","tagline":"A lightweight javascript library to plot simple graphs.","body":"Timeline.js\r\n===========\r\n\r\n\r\nTimeline.js is a lightweight JS library to plot graphs using SVG. As it uses SVG, you can add event listeners on the plotted graph very easily.\r\n\r\nI coded it because I couldn't find any basic JS library to do this, without any external dependencies and extra features. Timeline.js is only 13k once minified, and can be reduced under 10k thanks to obfuscation. Better results may be obtained with a little refactor, but that's enough for me. Plus it can be very easily customised to fit your needs.\r\n\r\n## Live demos\r\n\r\n* [Single graph example](http://phyks.github.io/timeline.js/examples/index.html)\r\n* [Multi graph example](http://phyks.github.io/timeline.js/examples/index2.html)\r\n* [Rounded graph example](http://phyks.github.io/timeline.js/examples/index3.html)\r\n* [Dashed graph example](http://phyks.github.io/timeline.js/examples/index4.html)\r\n* [Line only graph example](http://phyks.github.io/timeline.js/examples/index5.html)\r\n* [Graph with legend example](http://phyks.github.io/timeline.js/examples/index6.html)\r\n* [Interactivity with points example](http://phyks.github.io/timeline.js/examples/index7.html)\r\n\r\n## Usage\r\n\r\n(See examples for more info. For live examples, see http://phyks.github.io/timeline.js/)\r\n\r\n\r\nFirst, you must include the `timeline.js` or `timeline.min.js` script.\r\n\r\nThen, you need to init the SVG drawing, thanks to `SVG.init({'id': 'holder', 'height': '100%', 'width': '100%', 'grid': 'both', 'x_axis': true, 'rounded': false, 'x_callback': false});`. The arguments are all optional and are:\r\n* `id` : the id of the parent element that will contain the SVG\r\n* `width` / `height` : width and height of the created SVG\r\n* `grid` : none / small / big / both to choose which type of grid you want\r\n* `x_axis` : true / false to show / hide the x axis\r\n* `line` : none / line / dashed to choose line type. You can edit the dasharray by replacing `SVG.dash_style` value\r\n* `fill` : true / false to fill the area below the graph or not\r\n* `rounded` : true / false to use splines to smoothen the graph or not\r\n* `x_callback` : callback function to call to get texts for the x legend. Not yet implemented\r\n\r\nThen, you can add as many graphs as you want, thanks to `SVG.addGraph(NAME, COLOR);` where COLOR must be a valid CSS color.\r\nAnd you can add points thanks to `SVG.addPoints(GRAPH_NAME, POINTS);`. Points is an array of point objects, which are of the type `{'x': ABSCISSA, 'y': ORDINATE, 'label': LABEL}`. LABEL is the text to display in the infobox when the mouse is over the point. You can use '%x' and '%y' in labels and they will be automatically replaced by the coordinates. You can also use `` and `` HTML tags. You can add another (optional) element `click` which must be a ffunction to bind to onclick event on this point.\r\n\r\n_Note_ : You don't have to sort the points inside a same list of points in a SVG.addGraph call. They will be sorted for you. But, if you call SVG.addPoints multiple times, you must sort the points yourself between each call. The script won't do it for you and it will result in weird graphs if you don't do it.\r\n\r\nFinally, you can draw the SVG thanks to `SVG.draw();`.\r\n\r\n## Other functions\r\n\r\n* `SVG.clearGraph(GRAPH);` to delete the data for the graph GRAPH, or for all graphs + the graphs definition if GRAPH is not specified.\r\n* `SVG.hasGraph(GRAPH);` to check if a graph with name GRAPH has already been defined or not.\r\n\r\n## License\r\n\r\n```\r\n* --------------------------------------------------------------------------------\r\n* \"THE NO-ALCOHOL BEER-WARE LICENSE\" (Revision 42):\r\n* Phyks (webmaster@phyks.me) wrote this file. As long as you retain this notice you\r\n* can do whatever you want with this stuff (and you can also do whatever you want\r\n* with this stuff without retaining it, but that's not cool...). If we meet some \r\n* day, and you think this stuff is worth it, you can buy me a beer soda \r\n* in return.\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tPhyks\r\n* ---------------------------------------------------------------------------------\r\n```\r\n\r\n## Known bugs / TODO\r\n\r\nFeel free to contribute !\r\n\r\n* Y axis is not implemented, but could be implemented easily\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} \ No newline at end of file +{"name":"Timeline.js","tagline":"A lightweight javascript library to plot simple graphs.","body":"Timeline.js\r\n===========\r\n\r\n\r\nTimeline.js is a lightweight JS library to plot graphs using Timeline. As it uses Timeline, you can add event listeners on the plotted graph very easily.\r\n\r\nI coded it because I couldn't find any basic JS library to do this, without any external dependencies and extra features. Timeline.js is only 13k once minified, and can be reduced under 10k with obfuscation. Better results may be obtained with a little refactor, but that's enough for me. Plus it can be very easily customised to fit your needs.\r\n\r\n## Live demos\r\n\r\n* [Single graph example](http://phyks.github.io/timeline.js/examples/index.html)\r\n* [Multi graph example](http://phyks.github.io/timeline.js/examples/index2.html)\r\n* [Rounded graph example](http://phyks.github.io/timeline.js/examples/index3.html)\r\n* [Dashed graph example](http://phyks.github.io/timeline.js/examples/index4.html)\r\n* [Line only graph example](http://phyks.github.io/timeline.js/examples/index5.html)\r\n* [Graph with legend example](http://phyks.github.io/timeline.js/examples/index6.html)\r\n* [Interactivity with points example](http://phyks.github.io/timeline.js/examples/index7.html)\r\n* [Multiple holders example](http://phyks.github.io/timeline.js/examples/index8.html)\r\n\r\n## Usage\r\n\r\n(See examples for more info. For live examples, see http://phyks.github.io/timeline.js/)\r\n\r\n\r\nFirst, you must include the `timeline.js` or `timeline.min.js` script.\r\n\r\nThen, you need to init a Timeline object, using something like `var tl = new Timeline({'id': 'holder', 'height': '100%', 'width': '100%', 'grid': 'both', 'x_axis': true, 'rounded': false, 'x_callback': false});`. The arguments are all optional and are:\r\n* `id` : the id of the parent element that will contain the Timeline\r\n* `width` / `height` : width and height of the created Timeline\r\n* `grid` : none / small / big / both to choose which type of grid you want\r\n* `x_axis` : true / false to show / hide the x axis\r\n* `line` : none / line / dashed to choose line type. You can edit the dasharray by replacing `Timeline.dash_style` value\r\n* `fill` : true / false to fill the area below the graph or not\r\n* `rounded` : true / false to use splines to smoothen the graph or not\r\n* `x_callback` : callback function to call to get texts for the x legend. Not yet implemented\r\n\r\n_Note :_ One Timeline object corresponds to one holder.\r\n\r\nThen, you can add as many graphs as you want, with `tl.addGraph(NAME, COLOR);` where COLOR must be a valid CSS color.\r\nAnd you can add points using `tl.addPoints(GRAPH_NAME, POINTS);`. Points is an array of point objects, which are of the type `{'x': ABSCISSA, 'y': ORDINATE, 'label': LABEL}`. LABEL is the text to display in the infobox when the mouse is over the point. You can use '%x' and '%y' in labels and they will be automatically replaced by the coordinates. You can also use `` and `` HTML tags. You can add another (optional) element `click` which must be a ffunction to bind to onclick event on this point.\r\n\r\n_Note_ : You don't have to sort the points inside a same list of points in a tl.addGraph call. They will be sorted for you. But, if you call tl.addPoints multiple times, you must sort the points yourself between each call. The script won't do it for you and it will result in weird graphs if you don't do it.\r\n\r\nFinally, you can draw the timeline with `tl.draw();`.\r\n\r\n## Other functions\r\n\r\n* `tl.clearGraph(GRAPH);` to delete the data for the graph GRAPH, or for all graphs + the graphs definition if GRAPH is not specified.\r\n* `tl.hasGraph(GRAPH);` to check if a graph with name GRAPH has already been defined or not.\r\n\r\n## License\r\n\r\n```\r\n* --------------------------------------------------------------------------------\r\n* \"THE NO-ALCOHOL BEER-WARE LICENSE\" (Revision 42):\r\n* Phyks (webmaster@phyks.me) wrote this file. As long as you retain this notice you\r\n* can do whatever you want with this stuff (and you can also do whatever you want\r\n* with this stuff without retaining it, but that's not cool...). If we meet some \r\n* day, and you think this stuff is worth it, you can buy me a beer soda \r\n* in return.\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tPhyks\r\n* ---------------------------------------------------------------------------------\r\n```\r\n\r\n## Known bugs / TODO\r\n\r\nFeel free to contribute !\r\n\r\n* Y axis is not implemented, but could be implemented easily\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} \ No newline at end of file