From 8157f4f360d99faab2f617ab544072080eccda18 Mon Sep 17 00:00:00 2001 From: Lucas Verney Date: Mon, 7 Apr 2014 22:30:48 +0200 Subject: [PATCH] Create gh-pages branch via GitHub --- index.html | 89 ++++++++++++++++++++++++++++++++++++++--------------- params.json | 2 +- 2 files changed, 65 insertions(+), 26 deletions(-) diff --git a/index.html b/index.html index 8c69ec4..4ce3826 100644 --- a/index.html +++ b/index.html @@ -28,37 +28,76 @@
-

-Welcome to GitHub Pages.

+

+Timeline.js

-

This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:

+

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.

-
$ cd your_repo_root/repo_name
-$ git fetch origin
-$ git checkout gh-pages
+

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.

+ +

+Usage

+ +

(See examples for more info. For live examples, see http://phyks.github.io/timeline.js/)

+ +

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:

+ +
    +
  • +id : the id of the parent element that will contain the SVG
  • +
  • +width / height : width and height of the created SVG
  • +
  • +grid : none / small / big / both to choose which type of grid you want
  • +
  • +x_axis : true / false to show / hide the x axis
  • +
  • +rounded : true / false to use splines to smoothen the graph or not
  • +
  • +x_callback : callback function to call to get texts for the x legend. Not yet implemented.
  • +

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 : 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.

+ +

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

+ +

+Other functions

+ +
    +
  • +SVG.clearGraph(GRAPH); to delete the data for the graph GRAPH, or for all graphs if GRAPH is not specified.
  • +
  • +SVG.hasGraph(GRAPH); to check if a graph with name GRAPH has already been defined or not.
  • +

+License

+ +
* --------------------------------------------------------------------------------
+* "THE NO-ALCOHOL BEER-WARE LICENSE" (Revision 42):
+* Phyks (webmaster@phyks.me) wrote this file. As long as you retain this notice you
+* can do whatever you want with this stuff (and you can also do whatever you want
+* with this stuff without retaining it, but that's not cool...). If we meet some 
+* day, and you think this stuff is worth it, you can buy me a <del>beer</del> soda 
+* in return.
+*                                                                       Phyks
+* ---------------------------------------------------------------------------------
 
-

If you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.

+

+Known bugs / TODO

-

-Designer Templates

+

Feel free to contribute !

-

We've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.

- -

-Rather Drive Stick?

- -

If you prefer to not use the automatic generator, push a branch named gh-pages to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.

- -

-Authors and Contributors

- -

You can @mention a GitHub username to generate a link to their profile. The resulting <a> element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.

- -

-Support or Contact

- -

Having trouble with Pages? Check out the documentation at http://help.github.com/pages or contact support@github.com and we’ll help you sort it out.

+
    +
  • Legend on X axis is not implemented
  • +
  • Y axis is not implemented, but could be implemented easily
  • +
  • Over effect is a bit overkill right now
  • +
  • You must add your points sorted, as the script won't sort them for you and it may result in very weird graphs
  • +
  • Onclick events not working when there are multiple graphs.
  • +

The last three points are easy to implement by refactoring the way the raw points are stored and using a single array for all the graphs.