GithubHelp home page GithubHelp logo

philogb / jit Goto Github PK

View Code? Open in Web Editor NEW
1.5K 1.5K 299.0 8.87 MB

The JavaScript InfoVis Toolkit provides tools for creating Interactive Data Visualizations for the Web

Home Page: http://thejit.org

License: Other

CSS 0.78% JavaScript 88.45% Python 10.76%

jit's People

Contributors

aganezov avatar alesdotio avatar beizhang avatar bmesuere avatar bor0 avatar btford avatar chalker avatar clementdenis avatar diofeher avatar evankroske avatar grandse avatar helibobs avatar hwrod avatar kurtpreston avatar pflouret avatar philogb avatar ralphbean avatar ralphsmith80 avatar samcrang avatar saneth avatar scottyeadon avatar shex avatar shinaisan avatar sly1024 avatar stavarotti avatar tqc avatar wojtekzozlak avatar yaron-gilboa 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

jit's Issues

RGraph Tooltip

i want tooltip
because too many node
but tooltip not work in RGraph

Treemap: avoid creating boxes too small to see

For some data sets a lot of time can be spent processing boxes that are too small to see.

This can be fixed by adding the following 'precondition' check to createBox

// if box too small to be worth drawing then return empty string
if (coord.width * coord.height < 1) return "";

Better usage of given space

I created a graph using a Spacetree. I want to show the whole graph, set up maximum level to 100. Fine, but the spacetree is - as it seems to me - expanding to the outer regions and the inner space keeps empty. I have an example here:
http://einradfahren.de/index.php?module=mod_trixionary&action=graph
On the right grey box under "Graph Einstellungen" click on the "Vollbild" button to see the issue. I give that graph a height of 3200px and still the last items at the bottom are invisible because they go out of bounds, where there is actually enough space to use.

Even though the graph is plotted the way, the data is provided. Actually, in the first level (after root), there is the node called "Rückwärts fahren" which has no adjacencies and could therefore moved to the "outside" of the nodes and the more frequented nodes could show up in the middle. Maybe this would help this issue, if I would draw that graph with pen and paper I would do so.

Thanks

Problems with browsermode IE8

Hi,

In browsermode IE8 the native canvas support check falsely becomes true:
In order for this to work I had to change the check from:
nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'),
to:
nativeCanvasSupport = (typeof(G_vmlCanvasManager) == 'undefined') && (typeOfCanvas == 'object' || typeOfCanvas == 'function'),

This had to be done in the init file and in the jit.Canvas.js from:
supportsCanvas = (canvasType == 'object' || canvasType == 'function');
to:
supportsCanvas = (typeof(G_vmlCanvasManager) == 'undefined') && (canvasType == 'object' || canvasType == 'function');

Thank you for all your work hope this can help to solve 1 browser incompatibility issue :)

br. Kim

Events on multiple widgets on the same page break

When I show multiple visualizations of the same type on the same page (within the same DOM) (e.g., 2 differently configured hypertrees, 3 differently configured treemaps, etc.) It seems that the event handling and therefore some labeling occurs only on the first encounter widget in the DOM. For instance, if I hover over one treemap it changes the colors of the first treemap in the page. Another example is that with 2 hypertrees, the labels of the second tree show up on the presentation of the first tree.

Refreshing treemaps keeps old tooltips over

I have a treemap wich is updated dynamically according to user
selection in two combo boxes above the treemap, one for the color
category and the other for the area. When the selection is changed in
the combo boxes, the treemap is rebuilt via AJAX with new JSON data,
calling: tm = new TM.Squarified(...) and tm.loadJSON(json).
The problem with the tooltips is that, if the user moves the mouse
above the treemap quickly after changing the selection and before the
treemap gets updated, the old tooltip gets frozen over the treemap and
a new one is created to follow the mouse events.
This problem doesn't occur with old versions of JIT that used mootools
to render the tooltips.
Searching in the code, I found that a tooltip is always created and
appended to the document body if instructed by config.Tips.allow in
line 7405 of jit.js.
It seems that the tooltip does not get destroyed at the end of the
life-cicle of the Treemap object. The best approach would be somehow
destroy the tooltip appropriately, but I could came only with a quick
fix for that:
Line 7405 of jit.js
Original:
if(this.config.Tips.allow && document.body ) {
var tip = document.createElement('div');
tip.id = '_tooltip';
tip.className = 'tip';
var style = tip.style;
style.position = 'absolute';
style.display = 'none';
style.zIndex = 13000;
document.body.appendChild(tip);
this.tip = tip;
}

Modified:
var exists = document.getElementById('_tooltip');
if ( exists )
this.tip = exists;
else if(this.config.Tips.allow && document.body ) {
var tip = document.createElement('div');
tip.id = '_tooltip';
tip.className = 'tip';
var style = tip.style;
style.position = 'absolute';
style.display = 'none';
style.zIndex = 13000;
document.body.appendChild(tip);
this.tip = tip;
}

This approach reuses the existent tooltip if it already exists.

Treemap changes order of children elements in the tree

The treemap changes the order of the children elements in the tree.
This is really a minor issue but should be considered to be fixed because it is not replicable from outside what the treemap object does.
One of my implementations relied on the order of those children elements, so this behavior was really a mess. I had the clone the whole tree over and over again. And I don't think this is necessary.

Orientation by Subtree

At the moment, there is a global orientation property for a Spacetree. I would like to add a Subtree in another orientation. If the orientation gets changed dynamically, the subtrees with their own orientation change accordingly.

Edges with Graph data are hidden

Hey,

when I feed my Spacetree with Graph data and a node contains various adjacencies, "only one edge" is shown (the first one provided to the graph) even if both dependent nodes are availables. See here:
http://einradfahren.de/index.php?module=mod_trixionary&action=graph
Click "Hopping" and you see "Unispin". Click "Seat in-front Hopping" and "Unispin" is visible. Click then "Unispin" and it is connected to both. If applicable, the edges should be visible every time. If you click the "Vollbild" button, this connection is shown properly. But this graph contains more example that are not shown (some of them):

  • Einbein > Spin 1ft (where Spin 1ft is also related to Spin (Kurve Fahren > Spin), which is actually the more accurate connection, but totally hidden)
  • Einbein > Gliding > Stand Up Gliding (where Stand Up Gliding is also dependent on Stand Up Wheel Walk (Wheel Walk > 1ft Wheel Walk > Stand Up Wheel Walk) and is also the more accurate connection)
  • Einbein > Gliding (where Gliding is also dependent on 1ft Wheel Walk (see example above))

JSON data is in issue #22

which you may take into consideration, when aligning nodes :)

hypertree bug/inconclusive error message

Hi,

I am using jit, in particular the hypertree component, I make the graph and if I push in the .adjacencies array of a node a node id which is a javascript String object then I get

An invalid or illegal string was specified" code: "12
[Break on this error] ctx.arc(pos.x, pos.y, radius, 0, Math.PI * 2, true); 

I consider this to be inconclusive as an error message.
If instead , I push in the .adjacencies array of a node .valueOf() that String object, IOW the primitive string the problem is fixed.
Maybe you can include this quick fix in the error message.

Thanks

Graph layout with several types of edges

I'm working with a graph whit different kind of nodes and several types of edges between them.
I would like to display at the same time several types of edges, I would also like to distinguish those types using color or another graphical property.
I wonder what is the best layout to use? Does the layout algorithms of Tulip accept several relationships?
In the tool is there an option that allows me to configure the display according to the type of edge or to the type of node? I mean, in a circle display, it is possible to first put all the nodes of a type and later the nodes of another one?

Thanks in advance for your help.

Tayotas

AreaChart filter failing when called a second time

Hi,

I'm just getting started on infovis (which is very cool), looking at the AreaChart. I ran into a couple of issues with filtering. I'm calling the filter method like so

areaChart.filter.apply(areaChart, selectedItems);

to provide an array of labels to filter on. The first call works fine, but subsequent calls with different selectedItems have no effect. I have verified that the busy flag is false prior to each call to filter().

If I call restore() between each filter application then I can get it to work, but this presents some difficulties, because I need to wait for the restore() animation to complete before I can successfully call filter(), due to the busy flag.

Perhaps I'm missing something though - should I be able to make multiple calls to filter() with varying label names? If not, perhaps there is a way to chain a call to restore() followed by a call to filter()?

For my use case I have six labels, first filter on a single label, and then add a second label to the filter - so the second call to filter() contains the first item and a new item - e.g.

filter1 = ['label A']

filter2 = ['label A', 'label B']

Cheers,

Colin

Spacetree: Extra connection line and overlap nodes

Using current trunk (as of June 10, 2010) with the following test json data for spacetree example1.js, there will be some nodes overlapped with each other and when you click the Intranet node, there will be one extra connection line that connects to nothing.

{
"id": "Applications",
"name": "Applications",
"data": {},
"children": [
{
"id": "PIS",
"name": "PIS",
"data": {},
"children": [
{
"id": "EasiMaps",
"name": "EasiMaps",
"data": {},
"children": []
}
]
},
{
"id": "Communications",
"name": "Communications",
"data": {},
"children": [
{
"id": "Email",
"name": "Email",
"data": {},
"children": [
{
"id": "Exchange",
"name": "Exchange",
"data": {},
"children": [
{
"id": "Outlook",
"name": "Outlook",
"data": {},
"children": []
}
]
}
]
},
{
"id": "Voice",
"name": "Voice",
"data": {},
"children": [
{
"id": "Call Manager",
"name": "Call Manager",
"data": {},
"children": []
}
]
}
]
},
{
"id": "DM",
"name": "DM",
"data": {},
"children": [
{
"id": "Office",
"name": "Office",
"data": {},
"children": [
{
"id": "Word",
"name": "Word",
"data": {},
"children": []
},
{
"id": "Excel",
"name": "Excel",
"data": {},
"children": []
},
{
"id": "Access",
"name": "Access",
"data": {},
"children": []
},
{
"id": "PowerPoint",
"name": "PowerPoint",
"data": {},
"children": []
},
{
"id": "Outlook",
"name": "Outlook",
"data": {},
"children": []
}
]
}
]
},
{
"id": "Finance",
"name": "Finance",
"data": {},
"children": [
{
"id": "HR Database",
"name": "HR Database",
"data": {},
"children": []
}
]
},
{
"id": "Active Directory",
"name": "Active Directory",
"data": {},
"children": [
{
"id": "CdSync",
"name": "CdSync",
"data": {},
"children": [
{
"id": "HR Database",
"name": "HR Database",
"data": {},
"children": []
},
{
"id": "TokenExchange Database",
"name": "TokenExchange Database",
"data": {},
"children": []
}
]
}
]
},
{
"id": "Intranet",
"name": "Intranet",
"data": {},
"children": [
{
"id": "SharePoint",
"name": "SharePoint",
"data": {},
"children": [
{
"id": "People Search",
"name": "People Search",
"data": {},
"children": [
{
"id": "HR Database",
"name": "HR Database",
"data": {},
"children": []
}
]
},
{
"id": "My HR",
"name": "My HR",
"data": {},
"children": [
{
"id": "HR Database",
"name": "HR Database",
"data": {},
"children": []
}
]
},
{
"id": "Active Directory",
"name": "Active Directory",
"data": {},
"children": []
}
]
},
{
"id": "DOG",
"name": "DOG",
"data": {},
"children": [
{
"id": "Animal Database",
"name": "Animal Database",
"data": {},
"children": []
}
]
}
]
},
{
"id": "Highway",
"name": "Highway",
"data": {},
"children": []
},
{
"id": "Calc",
"name": "Calc",
"data": {},
"children": [
{
"id": "Highway",
"name": "Highway",
"data": {},
"children": []
}
]
}
]
}

Center node of sunburst is hidden if the next level has only one child

Reproduction:

  • Create a Sunburst visualization
  • Create a top-level node, set its type to 'none'
  • Give it one child node

The top-level node will be obscured by the child node (instead of an empty 'hole'). As soon as you add another child node adjacent to the first the top-level node becomes visible again (there is a hole in the center of the sunburst).

Graph Export (SVG?)

I would like to have an ability to export the graph. Images or SVG would be really sweet.

Spacetree: Make treeFitsInCanvas check optional

In getRightLevelToShow a check is done to make sure the resulting tree fits in the canvas; if it does not the level is decreased until the resulting tree does fit.

I think this check should be optional--I should be able to control the number of levels displayed regardless of if they fit in the canvas (because the user is free to drag/zoom around).

Bi-Directional Spacetree Request

Hey, Would be really great if the spacetree could have children in more than direction. I know this is possible with Hypertree etc but the direction is decided for you. What I would like is the ability to add a child to the left or the right and then carry on from there.

Labels not cleared when data updated

After creating a graph and a tree, I need to be able to change the underlying json data after some user interaction.

You see an example of this here:
http://connectome.ch/app/webroot/cwiki-vis/
Change the species.

The problem is, that the old labels are not removed.
The function RGraph.canvas.clear() removes the nodes and connections, but not the labels.

Thanks for this great toolkit!

"canvas is not defined"

I was playing around with ST and Canvas nodes. Though created Events with the Events property.
Dependend on the value of Label.type and Evens.enabled I get errors in firebug.

My events property:
Events: {
enabled: true/false,
onMouseEnter: function ()
onMouseLeave: function ()
onClick: function (node)
}

Events.enabled = false Label.type = "Native" => none
Events.enabled = true Label.type = "Native" => a lot, through mousemove
Events.enabled = true Label.type = "HTML" => when clicking
Events.enabled = false Label.type = "HTML" => none

I use version 2.0.0a

TreeMap tooltips misaligned in IE

doc.body.scrollTop isn't available in IE6+ when doctype is XHTML 1.0 Transitional

there is fix:
initializeElements: function() {
...
if(tipsAllow) {
//Add mousemove event handler
$addEvent(elem1, 'mousemove', function(e, win){
var tip = that.tip;
//get mouse position
win = win || window;
e = e || win.event;
var doc = win.document;
// @em added doc.documentElement for IE scrollTop availability
// doc = doc.html || doc.body;
doc = doc.documentElement || doc.html || doc.body;
var page = {
x: e.pageX || e.clientX + doc.scrollLeft,
y: e.pageY || e.clientY + doc.scrollTop
};

Bugfix in $jit.ST.Plot (for multitree)

In the jit-2.0.0b.js (uncompressed version) it is line 9262, Class $jit.ST.Plot: Change line from:

return !root || orns.indexOf(elem.getData('orn')) > -1;

to:

return !root || orns.indexOf(node.getData('orn')) > -1;

to make it work again :)

Build.py generated jit.js with incorrect syntax

The current master branch as of Jun 11 2010:
line 7503 & 9809 & 13103 shouldn't have the comma: type: 'Circles',
line 11262 shouldn't have the extra comma too
line 13702 has extra comment end token "*/"

This nightly build seems totally broken in IE6

Spacetree: Getboundingbox

I've read that you got a getboundingbox method somewhere in your archives which allows determining the size of the rendered tree. I'd love to see this within the next release as i am devin' a visualization of a very large and dynamic dataset which defintely needs scrolling.

Zooming: Edges and Nodes don't rescale

When zooming, edges stay as they are. When zooming out a gap between a node and the edges appears. This gap is static and does not rescale with zooming, either in or out.

The other thing is the Node box. Even if the font-size is growing or shrinking, the box stays at the same size. I'd expected this to rescale properly. Maybe css-zoom helps here (for font-size as well): http://www.css3.com/css-zoom/

Canvas class memory leak/increase

Pages which create a Canvas instance (new Canvas()) can be seen to have an increase in memory (at least in FF/Mac) which is proportional to the size of the created Canvas.

I first observed this when working with the Spacetree. The behavior can be seen on the example page but is small (~2MB) because of the size of the Canvas. Altering the example to use a 1000px X 1000px canvas will show a more dramatic (~25-50 MB) increase.

Seeking to isolate the cause and symptoms, I created these 3 pages:

Styling Options for Canvas Nodes and Labels

Some options I wish to see on Nodes:

  • border (width and color)
  • padding
  • new Shape: Rectangle with rounded corners (or Rectangle) with border-radius option

Labels:

  • An option to let the text stay within the width of the node. FillText already offers this option as last parameter. Width would be = nodeWidth - border-width - padding (autoWidth can't be active for this option)

Nodes of a Spacetree leaving canvas' bounds

This only applies to nodes that running out of bounds on either the right side or at the bottom. Here is a simple example why:
Canvas height: 600px
Top Position of node: 585px;
offsetHeight of node: 24px;
=> 585 + 24 > 600
Even though this node is still visible. To me it seems, nodes are only checked for their top/left position (which is fine for top and left border) but for top and right this check needs additional offsetWidth resp. offsetHeight to be added and checked based on that calculations result.

Change/extend zoom (direction/public api)

I was kinda confused, when I mousewheeled down and my graph gets smaller. Somehow I expected a zoom-in. So I switched over to google maps and yep, that's where my habituation comes from. I don't know of other services right now, that have zoom implemented to check, but I'd think gmaps is the most and well known zoom service and most people are habituated with that direction of zoom, so it's a good reason to change it.

Anyway, is there some kind of public API, where I can set the zoom from outside? Like graph.zoom(value) ? Is there a chance to get the zoom value like graph.getZoom() or just via the MouseWheel event? What about boundaries, min and max zoom. With that one could build a slider around the graph.

Treemap: patch to fix gaps between boxes

This patch isn't a complete fix, but it does greatly improve the behaviour.

The boxes get packed at integer pixel boundaries, so the random gaps are minimized and now tend to accumulate naturally at the top/right of the containing boxes.

===================================================================
--- jit.js  (revision 785)
+++ jit.js  (working copy)
@@ -8564,9 +8564,9 @@
    layoutV: function(ch, w, coord) {
        var totalArea = 0; 
        $each(ch, function(elem) { totalArea += elem._area; });
-       var width = totalArea / w, top =  0; 
+       var width = Math.round(totalArea / w), top = 0; 
        for(var i=0; i<ch.length; i++) {
-           var h = ch[i]._area / width;
+           var h = Math.round(ch[i]._area / width);
            ch[i].coord = {
                'height': h,
                'width': width,
@@ -8590,14 +8590,14 @@
    layoutH: function(ch, w, coord) {
        var totalArea = 0; 
        $each(ch, function(elem) { totalArea += elem._area; });
-       var height = totalArea / w,
+       var height = Math.round(totalArea / w),
        top = coord.height - height, 
        left = 0;

        for(var i=0; i<ch.length; i++) {
            ch[i].coord = {
                'height': height,
-               'width': ch[i]._area / height,
+               'width': Math.round(ch[i]._area / height),
                'top': top,
                'left': coord.left + left
            };

Labels unaffected by Node-align

With this snippet of configuration, nodes are aligned centric and labels are placed over it accordingly. Well if you change the node-align to left or right, the labels still stay centric and overlap the nodes. This happens with a Spacetree.

Node: {
    overridable: true,
    type: 'rectangle',
    autoWidth: true,
    autoHeight: true,
    color: '#ccc',
    align: 'center'
},
Label: {
    overridable: true,
    type: 'Native',
    color: '#000',
    size: 12
}

Spacetree: Some 'ellipse' nodes are not shown in IE

If node type is 'rectangle', it's OK, but change to 'ellipse', some nodes disappeared.
It's easy to repeat: in current 2.0a version, open Jit-2.0.0a\Jit\Examples\Spacetree\example4.html in IE, you would see.

Unable to align - LEFT the tree using Spacetree

When align set to "left" something strange happens it is alligned something like ( right-bottom ) but definitely not left.
By left I expect that the root node is alligned on the left side of the black screen. I was unable to align it by any other alignment except center which is default.
I would apreciate any help with this. My final task is to represent LAN network topology using SpaceTree.

onMouseEnter does not work

the onMouseEnter event is never fired in my Chrome 7.0.517.41 on Linux with the following code:

var sb = new $jit.Sunburst({
  injectInto: 'visuals-spread-vis',
  levelDistance: 80,

  Node: {
    overridable: true,
    type: 'gradient-multipie'
  },

  NodeStyles: {
    enable: true,
    type: 'Native',
    stylesHover: {
      'color': '#fff'
    }
  },

  Events: {
    enable: true,
    onMouseEnter: function(node) {
      console.log("BLA");
    }
  },
});

Also tested this in Firefox 3.6.12 with no success.

Spacetree: Zooming broken (or breaks the visualization on zoom event)

Even with very simple settings zooming breaks the visualisation.

var opts = {'injectInto': this.panel.id, 'Navigation': {'enable': true,'zooming': 10 }};

Hmmm where is my attach file button?? Anyways, its very straight forward to reproduce so I shouldn't need to attach an item.

Thanks

Guido Tapia

Zoom ability

I wish to have zoom controls, like in Google Maps. This is enabled by a settings property; setting zoom to true. The graph stays in the given rectangle. When zooming, either nodesize and/or levelsShown is manipulated.
Zoom controls could be simple +/- and additionally a scrollbar. Provide max and min values for width and height to the user, so they are able to build their own controls around the graph.

jit-1.1.3-238-gea8e451 totally broken in IE 6/8

Check out the latest version as of Jun 17 2010, run Python 2.6.5: > python make.dos.py examples

Then in the generated Examples directory run any example?.html, it works in Firefox and Chrome, but broken in IE 6/8.

For someone who is interested, make.dos.py is a copy of make.py except that some system commands were replaced with those of windows, contents as following:

include libraries

from os import system, walk
from shutil import copy
import sys, re

from tests import tests_model
from serve import render
from build import Build

YC = 'yuicompressor-2.4.2.jar'
EXCLUDES = ['Source/Extras',
'Source/Layouts',
'Source/Options/Options.js'
'Source/Core/Fx.js',
'Source/Graph/Graph.Geom.js']

def main():
if 'docs' in sys.argv: make_docs()
if 'examples' in sys.argv: make_examples()
if 'examples-fancy' in sys.argv: make_examples(fancy=True)
if 'build' in sys.argv: make_build()
if 'build-fancy' in sys.argv: make_build(fancy=True)

def make_docs():
system("perl "
+ "NaturalDocs-1.4/NaturalDocs -r "
+ " -i Source/"
+ " -xi " + " -xi ".join(EXCLUDES)
+ " -o HTML Docs/"
+ " -p NaturalDocs-1.4"
+ " -img NaturalDocs-1.4/img"
+ " -s docstyle")

def make_examples(fancy=False):

clean examples folder

system("md Examples")

copy css base files

system('xcopy Tests\\css Examples\\css /e/i/y')

iterate over the examples

for viz, tests in tests_model.items():

create example folder

    system('md Examples\\' + viz)
    count = 1
    for i, model in enumerate(tests):
        if 'Example' in model and model['Example']:
            make_example(viz, model, i, count, fancy)
            count += 1

copy some extra files

if fancy:
    system('xcopy Extras\\sh Examples\\ /e/i/y')
    system('copy Extras\\code.css Examples\\css\\code.css')

def make_example(viz, ex, i, count, fancy):

name = viz
stri = str(i + 1)
model = ex
title = model['Title']
extras = model['Extras'][:]
example = 'example' + str(count)
strdir = 'Examples/' + viz + '/'

insert the example js file

fcommon = open('Tests/js/common.js', 'r')
ftest = open('Tests/' + viz + '/test' + stri + '.js', 'r')
fout = open(strdir + example + '.js', 'w')
fout.write('\n\n'.join([fcommon.read(), ftest.read().replace('/Tests/css', '../css')]))
fcommon.close()
ftest.close()
fout.close()

render the html file

includes = {
    'left':  getattr(render['TestCases'], viz + '/' + 'left')(model, viz, 1, 1),
    'right': getattr(render['TestCases'], viz + '/' + 'test' + stri)(model),
}

fhtml = open(strdir + example + '.html', 'w')
html = render['TestCases'].baseexamples(name, title, extras, example, '', includes, fancy).__body__
fhtml.write(html)
fhtml.close()

create syntax highlighted code page

if fancy:
    begin, end, res = re.compile("[\s]*//init ([a-zA-Z0-9]+)[\s]*"), re.compile('[\s]*//end[\s]*'), []
    ftest = open('Tests/' + viz + '/test' + stri + '.js', 'r')
    for l in ftest:
        if begin.match(l):
            name, lines = begin.match(l).group(1), []
            for blockline in ftest:
                if end.match(blockline): break
                lines.append(blockline)

            res.append({
                'name': name,
                'code': ''.join(lines)
            })

    fcode = open(strdir + example + '.code.html', 'w')
    html = render['TestCases'].basecode(name, title, res, example).__body__
    fcode.write(html)
    fcode.close()

def make_build(fancy=False):
system('del /q Jit*')
print "Building Examples..."
make_examples(fancy)
system('xcopy Examples Jit /e/y')
print "Done. Building Extras..."
system('md Jit\Extras && copy /y Extras\excanvas.js Jit/Extras\excanvas.js')
print "Done. Building Library..."
lib = Build().build()
license = open('LICENSE', 'r').read()
f = open('Jit/jit.js', 'w')
f.write(license)
f.write(lib)
f.close()
print "Done. Compressing Library..."
f = open('Jit/jit-yc.js', 'w')
f.write(license)
f.close()
system('java -jar Extras/' + YC + ' Jit/jit.js >> Jit/jit-yc.js')
print "Done. Zipping..."
system('del Jit.zip')
system('C:\utils\7-Zip\7z.exe a Jit.zip Jit/')
print "Done, I guess."
if name == "main": main()

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.