Open source JSXGraphs - better than GeoGebra and AsciiSVG?

Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -
Number of replies: 44

How on earth have we missed JSXGraph?

See http://jsxgraph.uni-bayreuth.de/wp/documentation/ and http://jsxgraph.uni-bayreuth.de/wiki/index.php/Category:Examples 

I will test the scripts with moodle as soon as possible (today) and report back - my first impression is very positive...

Average of ratings: -
In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -
These are amazing graphs!

They require javascript (use jQuery) and LatexMathML with single dollars can't be used (conflict with dollar signs in jQueries) but TexFilter can be used, AsciiMathML can be used and if delimiter of LatexMathML is changed everything works perfect.

Because JSXGraphs are using script tags only teachers can paste working code unless we create a new filter or activity to let students to add the same graphs.

It is of course also possible to use attachments, iframes etc if allowed...

I tested some of those graphs quickly with standard theme meta.php and css/javascript links and one more good thing is that the graphs and widgets are also themable with selection of jQuery custom cs files that can be created with ThemeRoller. (Sliders, borders etc)

And they are pure vector graphs - also for IE - wink



"JSXGraph is a cross-browser library for interactive geometry, function plotting, charting, and data visualization in a web browser. It is implemented completely in JavaScript and uses SVG and VML.
JSXGraph is easy to embed and has a small footprint: less then 100 KByte if embedded in a web page. No plug-ins are required! JSXGraph uses the JavaScript libraries/frameworks Prototype or jQuery.
JSXGraph is developed at the Lehrstuhl für Mathematik und ihre Didaktik, University of Bayreuth, Germany."

Attachment graph.gif
In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
Lol - I have run into lots of stuff, too little time and catalogs of such apps are outdated by several years; didn't know about Euclid til I tripped over it.

Re footprint size, claim is a bit bogus as they mean size of file locally, but size of all js files is larger than latest asciimath ;). See discussion on wp usage....

also, I think there may be js issues in that I have run into problems implementing jsxgraph in mediawiki with graph appearing and then the plot disappearing in FF3.5 and chrome (using chrome console graph would remain visible as script hung on error - see jsxgraph pages at EdTech.alaskapolicy.net)

have yet to push jsxgraph as far as comparison with java sketchpad, geogebra, CaR, etc
In reply to Marc Grober

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

The error is probably caused by your AsciimathML script and you need to set

var translateLaTeX = false;

so that $ delimiter of LatexMathML does not conflict with jQuery $...

I think the best way to avoid these conflicts is to create an external activity and push graphs through this activity embedded to iframe or object tag ... with filter.

On the other hand it might be better to use other delimiter than single dollar in LatexMathML because jQuery can be used for so many other things and such conflicts should never exist...

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

But there is also a IE8 bug in that script and IE8 needs to be in compatibility mode...or the page must force compatibility mode for IE8...or...

Otherwise as a proof of concept I disabled translateLaTeX from my test mediawiki and added one notation with double @:s instead of single dollars:

http://korpelainen.net/mediawiki/index.php/JSXGraph

I think I will use a similar structure for moodle and the idea of using http://jsxgraph.uni-bayreuth.de/wiki/index.php/Displaying_GEONExT_constructions with http://geonext.uni-bayreuth.de/index.php?id=2453 is very similar as adding or creating offline Geogebra files.

We need just that new activity or filter for moodle to add either graphs or graph files like in multimedia filter.

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -
Marc,

I added to my mediawiki MonoBook template right after head tag

<head>

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

to force IE8 to use compatibility mode and behave like other browsers (until developers of JSXGraph find the correct way to do things with IE8 - some attribute is possibly missing and IE8 does not like it...)
In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
I initially placed the js and css in skin before I saw the mediawiki extension. The concatenation on $IP for outputURI would not work, so I just hard coded source; did u run into that at all?

If we parse jquery first it should not be an issue unless they are mixed in mediawiki. I am going to fiddle with that a bit more, but short term order of js as set via theme in moodle may just be best solution... Though obviously fraught with future complexities.

But, we need to address using this with quiz.js as we know that can be problematic.

For general moodle purposes the js and css files will gave to included locally so changes in js don't result in failure of graphs. Also concerns as with asciimathml but perhaps less so about transparency between code from Arthur et al and code employed in moodle and possibility they may get out of sync or otherwise prove to be an issue (we still have people downloading dragmath from sourceforge and wondering why it doesn't work....)

we could change dollars to double dollars, assuming that users would do Tex or asciimath, but not both, but that is a dubious premise-lol. Double @s run afoul of alg filter users. We could make it a bit more complex and use backtickdollarsign, but the whole idea was for asciimath to handle Tex expressions transparently, so I would argue for dbldollars (via var so as to protect legacy usage) and impose choice (or move forward on more complex mechanism discussed earlier)

Of course we could just give up and move completely to tags as in etc or even two layer tags as in root{x}{n}sqrt[x]{n} for the purpose of implementing a single math filter which spawned parsers as requested.
In reply to Marc Grober

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

I did exactly the same and placed the script and css tags to MonoBook.php (skin) but also created the extension file. I thought that extension file was necessary for parsing those <jsxgraph...> tags but tried to avoid using twice the script tags and in addition to this prototype.js and jQuery js file can parse the same tags so one of them is enough.

It is also possible to use (with some extra attributes like alt, title, class, width, height) tags like

math/ ... /math
graph/ ... /graph

or

amath/ ... /amath
bmath/ ... /bmath
mathtran/ ... /mathtran
mimetex/ ... /mimetex

or

asvg/ ... /asvg
gcharts/ ... /gcharts
jsxgraph/ ... /jsxgraph

or Mathtran method <img alt="tex:x^2+y^2=1" /> without src attribute and let mathTran use tex and other types of maths could be recognized from alt tag (other than tex) and changed to either graphs or other tags (images or other embedded code)

and so on in filters instead of $, ` or @ characters that seem to be used for different purposes in different scripts and applications, editor does not like < or > and wiki does not like [ or ]

I could write a common graph filter for all graph types (current and future graphs) or I could modify TeX filter to common math filter that parses all possible tags that exist - exept algebra filter that can parse those double @:s with perl also in the future. It's easy to change my AM.js double @:s to some characters... smile

I am planning to use jQuery in many places in the future (in themes and widgets) so single dollars can be a major problem if separate latexmathml script parses the "running code" of jQueries.

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
Aha! That is why your install worked. I think the theme entries are actually invoking while the extension entries are not.... as when I used only the extension it looked like there was a syntax issue with the concatenation in the JSXGraph.php file that prepended the URI for the sources.

Now that I think about it of course the order of the invocation vis-a-vis asciimath won't matter.

This is quite a pain ;=}

And the more I think about it the more I think that tokens for asciimath may be something to raise in the asciimath googlegroup as if we start fiddling we lose the universal nature of the tool. Unless Jquery is altered (not likely) than any app employing $ tokens presents an issue....

So.... what to do...

I think the overall best bet would be to have a universal math "filter" that would avoid having to run the various js on the page directly, with the filter passing anything inside specific meta-tags to the appropriate tool to parse and display. But that is an architectural matter that will have lots of people squealing, no matter the benefits, as well as impact legacy materials.

Second option is to replace $ with something else (like € - lol) though a character that would likely never be used would be most appropriate, perhaps the broken bar, ¦ (Alt+0166 and above the backslash on most qwerty keyboards), for the latexmathml operations of asciimath - easily entered and unlikely to be a matter for further problems.

In reply to Marc Grober

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

This is a nice and fresh article about future plans - http://www.svgopen.org/2009/papers/14-Interactive_SVG_with_JSXGraph/#d4e77

Note 1: Support for reading GeoGebra files directly is under development in cooperation with the GeoGebra developer team... the code should look like this but it did not seem to work yet.

<div id="box" class="jxgbox" style="width:500px; height:500px;"></div>
<script type="text/javascript">
  var b2 = JXG.JSXGraph.loadBoardFromFile('box', 'myfile.ggb', 'Geogebra');
</script>

And the best part of jsxgraphs is that it supports all major browsers without any extra plugins.

Note 2: the same document tells: "To ease the integration of JSXGraph into other web applications we provide some plugins for a couple of them. Those are the blogging software Wordpress[15], the basis software for Wikipedia called MediaWiki[16], and the course management system Moodle[17]. The plugin for the latter one ist still experimental. " - I wonder where we could get it, should we ask from University of Bayreuth Department of Mathematics?

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
I have already struck up conversation w/ Arthur and asked him to participate here. I found no info on moodle integration on their site, but it is extensive - I did review the mw and wp pieces though.

I also posed question about tokens vs tags to David L who as I expected suggested we go tags- see your email for correspondence.

Big problem in a sense is virtual distance from development of such technology to deployment in readily available format.
In reply to Marc Grober

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

I tried last night the experimental filter that is found from jsxgraph sourceforge svn https://jsxgraph.svn.sourceforge.net/svnroot/jsxgraph/branches/0.80_bianca/plugins/

It's not yet fully functional and needs to be further developed - but it's a good start.

David's suggestion about using spans like <span class="AM">...</span> is a good option. It also allows using filter(s) outside editor and javascript in editor plugins (TinyMCE) directly for selecting, changing and editing maths and graphs - like using img tags (Mathtran style).

If we want to use both dollar tokens and jQuery we probably need to separate them and use jQuery only in widgets - for example in external embedded documents - or avoid using single dollars in pages that use jQuery. For graphs this is OK, for maths all extra tags cause trouble if people can somehow add other tags inside given tags and break for example spans like this...therefore a single img tag with several classes could be a neat option. Maybe something universal like

<img class="AM" title="math or graph code" [alt="tags for blind"] /> (without src attribute and if alt tag is not given alt tag could be parsed from title)

that could be parsed both with filters or javascripts to actual images,MathML,SVG,VML,scripts etc.

For example

<span class="AM">`alpha+beta`</span> could as well be
<img class="AM" title="alpha+beta" /> or if we need optional alt tag for screen readers it could be
<img class="AM" title="alpha+beta" alt="alpha plus beta" />

which is of course much longer than simple `alpha+beta` but gives some extra benefits and if tags can be normally given with editor plugins users would see the actual result immediately. Still no existing old tags are broken

or

<span class="JSXG">graph code here</span>
or
<img class="JSXG" title="graph code here" />
or
<img class="JSXG" title="graph code here" alt="description of graph for blind" />

File tags like

<jsxgraph height="200" width="400" board="board1" box="jxgbox" filename="myFile.gxt" /> could be given with

<img class="JSXG" title="file:myFile.gxt height:200 width:400 board:board1 box:jxgbox" /> or
<img class="JSXG" title="f:myFile.gxt h:200 w:400 board:board1 box:jxgbox" /> or ...

Class allows any future math/graph types. Extra tags like width or height could be given either in style attribute or graph/math tags but creating this kind of universal graph&math filter requires quite a lot of work... smile ... so for a while I will let each script and filter do what they want to do and just test the editor plugins next...

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

One note I forgot to mention is the capability to use for example asciimathml inside jsxgraphs.

It is possible right now but one major problem is that graph code is loaded only once and if graph itself is changed with sliders etc asciimathml code does not follow because no script refresh code is ran - it could be possible to combine javascript functions that render asciimath or tex tags to functions of jsxgraph scripts to make sure that graphs refresh/render also the asciimathml/tex etc code or it is possible to leave mathematical notations outside the actual graphs and use css ("layers" and positioning) like we did with asciisvg and asciimathml.

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -
Images (mathematical notations) work very well inside jsxgraphs. For example

<link href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" rel="stylesheet" type="text/css" />
<script src="http://jsxgraph.uni-bayreuth.de/distrib/prototype.js" type="text/javascript"></script>
<script src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js" type="text/javascript"></script>
<div class="jxgbox" id="jxgbox" style="width: 500px; height: 500px;"></div>
<script type="text/javascript">// <![CDATA[
var p1, p2, c, li,
board = JXG.JSXGraph.initBoard('jxgbox', {originX: 150, originY: 300, unitX: 25, unitY: 25});
var A = '(0,0)';
var B = '<img src="http://chart.apis.google.com/chart?cht=tx&chco=000000&chf=bg,s,FFFFFF00&chl=(%5Csqrt%7B2%7D+%2C%5Csqrt%7B2%7D+)" />';
p1 = board.createElement('point', [0, 0], {style:5,name:A,fillColor:'blue', shadow:true});
p2 = board.createElement('point', [1.4, 1.4], {style:5,name:B,fillColor:'blue', shadow:true});

c = board.createElement('circle',[A,B], {shadow:true});
li = board.createElement('line',[A,B], {shadow:true});
// ]]></script>

shows point A with google chart api tex and point B as pure text (tex filter or asciimathml can be used as well)

REALLY NICE to get all these combined!
Attachment example.gif
In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -
Attached that previous example as html file if you want to test it in iframe etc. (if you need to keep dollars in mediawiki...)
In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

One way to help parsing in filter could be also separating class of jsxgraph script tags and file tags - for example

<img class="JSXGF" title="myFile.gxt,200,400,board1,jxgbox" />

so that tags like

<img class="JSXG" title="graph code here" />

could parse script code directly from title attribute and class JSXGF could use different rules. With given default settings adding gxt graphs could look this simple:

<img class="JSXGF" title="myFile.gxt" />

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Alfred Wassermann -
thank you for using JSXGraph!
Meanwhile we succeded in removing all dependencies from jQuery and prototype. So, our next release (maybe next week) will run without any additional libraries. This also means a size reduction of about 25 percent (if the web server uses compression).
Alfred



Average of ratings:Useful (1)
In reply to Alfred Wassermann

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

Nice to see you here, Alfred!

I sent you just an email - is it possible to test that plugin you have developed for moodle - if it's experimental we (Marc and I) are perfect testers... wink

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Alfred Wassermann -
Here is our jsxgraph-moodle plugin. It is not very well tested. Further, some of the attributes (like codebase) have to be removed because of security issues.
Alfred
In reply to Alfred Wassermann

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Alfred Wassermann -
You are so fast! Now I saw, that you already have detected our Moodle plugins. By the way, I just renamed the folder from moodle to jsxgraphmoodle.
Our project is hosted by sourceforge: http://sourceforge.net/projects/jsxgraph/

In the above discussion GeoGebra import has been mentioned. We are working - together with Markus Hohenwarter from GeoGebra - on the support of GeoGebra files. But this feature still needs a lot of work. Since GeoGebra has a huge user base we have to be careful with promoting such a tool as long as it is not mature. That means, in the current JSXGraph release GeoGebra is not yet included.

At the moment, JSXGraph is able to import GEONExT files (see http://geonext.de) and the evolving European Intergeo file format i2geo (see http://i2geo.net).
GeoGebra will support i2geo, too. Of course, only a subset of the available elements of GeoGebra or GEONExT will be available in i2geo. But you can expect that Euclidean geometry will be supported quite well.

We are aware of the problem of the IE8 in standard mode with XHTML files:
http://jsxgraph.uni-bayreuth.de/wp/2009/03/20/jsxgraph-and-ie8/
Meanwhile, we also know how to solve it. Hopefully, one of the next releases will resolve this issue. (By the way, also google maps falls back to the compatibility mode of the IE8).

As I said, in the next release 0.78 (next week) of JSXGraph the dependency from jQuery and/or prototype.js has been completely removed. That means, the $-sign is not used in JSXGraph any more.

Alfred


In reply to Alfred Wassermann

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

Thank You, Alfred!

JSXGraphs are in my opinion the best available open source tool for adding quality vector graphs to web pages. You have a great team and have done a super good job with these scripts. I believe we can help you in integration of code to moodle, additional plugins and testing. At least I am eager to use a lot of my time and energy for these excellent tools.

Please keep us informed about your future plans and changes in code.

Regards,

Mauno

In reply to Alfred Wassermann

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
Mauno's like the proverbial kid in the candy store, lol, and not only fast but gracious

The update that resolves the token issue will mean that I can roll it out in moodle 1.9, though my predilection is to do it by theme, though I will gave to look at plugin (do we need to add the plugin to moodle database and if so shall I go ahead with that and set you-Alfred-up as maintainer?)

But, as SEE becomes more sophisticated (lol) we still need long term solution. Paulo Soares in asciimath group has argued against spans. I think his proposal represents a practical approach to what I was arguing, but potentially prsents more issues in trying to address multiple browsers transparently.

Re assignment, need array of primitives student can select which are then fed like XML cgi appp I wrote for java sketchpad, creating page on fly with parameters or creating and uploading gxt file. Be fun to have java based constructor like dragmath to build constructs....
In reply to Alfred Wassermann

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
So there is already the geonext java application http://geonext.uni-bayreuth.de/index.php?id=2453 (there was one mention of inserting applet into Moodle here: http://moodle.org/mod/forum/discuss.php?d=83000) which can be used to create geonext constructions. And we have now the JSXGraph for displaying same without having to invoke applet. We also have access to hundreds of existing geonext files (such as those available via JEM http://www.jem-thematic.net/en/search/node/Geonext and those offered as examples in the jsxgraph wiki) for use both as examplars and as instructional tools. We can embed the applet in an assignment and have a student save the construction and then upload and we can can create demonstrative expository materials and implement appropriate drill by integrating those resources with existing Moodle lesson and quiz.

Mmmmmmmm

So, I guess what I need to do next would be to create a modest Moodle lesson that pops up the applet as a work space and presents various questions employing JSXGraph ..... lol

Question back to you, Mauno, is whether we should add the applet to the editor dragmath style as I was pondering earlier.... I think the integration would be very similar..... the big diff being on insert the integration would have to write the jsxgraph tags and the either a file name or file attributes, and first/easiest shot would be attributes as that would not require and Moodle hassles vis-a-vis saving and referencing the file (I suppose I need to double check and make sure that the applet will write file attriubutes as well as save the file...... mmmm .... the applet does not appear on first blush to offer that..... perhaps that is something that our friends at bayreuth could help with??)


In reply to Marc Grober

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -
I was also testing (for a short time) yesterday that online version of Geonext and it probably does not save at all but the idea of using the applet online is good - if it's possible.

For teachers it is almost the same to create material offline as online but for schools an online version might be better (no need to install extra software to PC:s)
In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
I placed the app as we might present it from dragmath and the app as the teacher might present it in your plugindemo Moodle. The applet as the teacher might use it is redundant now to jsxgraph. But the constructor is not. I have mailed the folks at Beyreuth about having applet dump string.... but in fact the gxt file content is the string, so at worst we export to a tmp file, dump the contents to the editor and delete the tmp file... kind of hoaky, but we will see what Alfred et al say..... of course the student can save the file as gxt locally, close the constructor and then upload the file.... which is a good way to have students practice taking care of their own stuff, but not consistent with what we do with dragmath and less convenient.

So, what do you think about adding a geonext icon in the now exploding tinyMCE toolbar to invoke geonext just like we invoke dragmath, with the integration providing the tags etc and accepting the geonext string from the applet?

This is very exciting....
In reply to Marc Grober

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

We will have a new row of icons in that "advanced maths editor" in moodle 2.0 - big grin

If we use a common administration (either with filter settings or if Petr finds a nice way to add custom editor settings) users will be able to choose which tools they want to use and we can offer 20 different optional tools if we want.

In reply to Alfred Wassermann

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Ramon Eixarch -
Hi everybody,

as the usual readers may know I am part of Maths for More, company responsible for WIRIS math tools (www.wiris.com/moodle/ )

I would like to remark to importance of InterGEO project just mentioned by Alfred. It is a project where different Dynamic Geometry projects are cooperating to allow an easy file exchange between Dynamic Geomatry software packages:
  • Cabri
  • Cinderella
  • GeoGebra
  • GEONExT
  • Geoplane/Geospace
  • TracenPoche
  • WIRIS

InterGEO is a EU funded project ( eContentPlus ).

Ramon
In reply to Ramon Eixarch

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

Thank you for the link, Ramon,

they are all great projects and cooperation between open source and commercial projects is always a good thing - and it's really good to see a large team of universities solving the same task... bringing maths and graphs alive, easy-to-use and available in our world wide web.

In reply to Alfred Wassermann

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

Setting back

var translateLaTeX = true;

in Asciimathml files seems to work ok with version 0.80 files

Thank You Alfred!

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
Alfred,
have not seen notice re 0.78. R u going to release 0.78 or look at going straight to 0.80?
In reply to Marc Grober

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Alfred Wassermann -
the JSXGraph version numbers are slightly misleading: In the sourceforge subversion server we are developing now in the 0.80 branch. That means we are working towards the release 0.80 and we have nearly reached 0.78 by now. At the moment we are testing a version called 0.78.1 in our wiki. This number could be interpreted as 0.78 release candidate 1. We just want to resolve one more problem then 0.78 will be released.

In reply to Alfred Wassermann

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -
Can't wait to see it...big grin

I made quite heavy cleaning of "double and triple code" in my AM.js and current "work version" is in http://korpelainen.net/js/AM.js

It is doing all the same things (with some bug fixes) as previous script but is about 1/3 lighter than before. More changes will come during the next week...particularly to plugins.


In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

"It is doing all the same things (with some bug fixes) as previous script..."

Well not quite - different fallback renderers use different syntax and in this case I used several hours to figure out that google chart Api fails to render classic asciimathml matrices like `((1,2),(3,4))`using the same code that MathTex successfully renders - so the smartest thing to do is to use different files for different renderers and not even try to put all that code to one file...

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

I started to split previous code to smaller "subscripts" and should modify next the input/output variables for each subscript.

AsciiMathML and AsciiSVG are separated to different scripts (like they originally were) and I will probably split all IE stuff to different scripts soon too.

Attached an input/output example about the reason for different scripts:

1) \left(\begin{array}{ccc} 1 & 2\\3 & 4\end{array}\right) (Google Chart API png image)
2) \left(\matrix{1&2\cr3&4}\right) (MathTran png image)
3) $\left(\begin{array}{cc} 1 & 2\\3 & 4\end{array}\right)$ (LatexMathML / MathML)
4) GeM\left(\begin{array}{cc}1&2\\3&4\end{array}\right)GeM (Forced fallback to TeX Live with cgi MathTex)
5) $$ \left(\begin{array}{cc}1&2\\3&4\end{array}\right) $$ (Same code and doubledollars / TeX filter with MiKTeX and on the left side here in moodle.org with TeTeX)
6) `((1,2),(3,4))` (AsciiMathML / MathML)
7) Plugin graph (AsciiSVG plugin)
8) Script Graph (JSXGraph)
...

Attachment comparison.gif
In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
As devils advocate- is it worth breaking up lib if we are not going to be able to use jsxgraph without including JavaScript tag (as opposed to tags parsed by AM)?
In reply to Marc Grober

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

Well...in most cases you won't need both AsciiMathML and AsciiSVg - you will need either maths or graphs. If you want to use only asciimath with JSXGraphs you may not want to load AsciiSVG - or you may want to use 2 different versions of AsciiSVG (old style and plugin style) with different variables but want to use only TeX with TeX filter...

It is possible to collect all options to one mega script or split scripts to smaller tasks and move some tasks for example to php scripts. If we want to use configurable settings it is easier to use php for settings and remove most variables from javascript:

AM1.php - settings for AM
AM1.js - javascript functions for AM
AS1.php - settings for AS
AS1.js - javascript functions for AS

If we want we can split AM1.js to 2 smaller scripts - MathML and fallback parts - and load only MathML script for FF and fallback script without MathML parts for other browsers.

If we want we can split AsciiSVG to 2 smaller scripts - fallback parts for IE only and SVG parts of other browsers.

Then we can use browser detection and set IE directly to load only settings and IE functions without 100 tests if (isIE) {...} ... or if (ASnoSVG) {...} and do the same for FF and other browsers which means probably 3 scripts:

IE.php (all fallback & png or VML)
FF.php (MathML & SVG)
Webkit.php (fallback & SVG)

What do you mean, Marc, by "...if we are not going to be able to use jsxgraph without including JavaScript tag..." ?

I suppose we might be able to use GeoNext applets for addings tags, we might be able to use filters to replace applet strings with graphs, we might be able to create a filter for addings jsxgraph (script) tags, we might be able to create an editor plugin for adding jsxgraphs just like in AsciiSVG plugin...?

Or we might be able to combine best features of AsciiSVG and JSXGraphs and some math renderer (Google Chart API?) together with Dragmath to one simple plugin or two simple plugins that output graphs and maths as vector graphics and MathML/fallback images that are editable and visible in editor, more accessible for screen readers and have the most common functions for school use - but not all the features of different renderers.

Or we might be able to select default renderer from administration menu ($CFG->... given by math filter settings ) and let script select different input and output values according to this setting - or we might be able to do the same with some classes or class names without tokens and delimiters or with tags like

math/ AM ...tags here... /math
graph/ JSX ...tags here... /graph

( or why not as well math/ JSX ...tags here... /math for graphs too if we had just one mega filter for all kinds of maths and graphs - no more worries about dollars etc ... but dollars, backticks and other old stuff could still be used like before)

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

If we think about original javascripts by Peter and David and other environments (CMS) it may be good to keep all features in one javascript. I think we can use both splitted scripts and a collection script.

We might also be able to create some new activity (module or blocks) to use maths without script tags, theme meta tags etc - it has been the direct route for testing things but we have most likely not yet tested all possible features of moodle. My main interest is in moodle 2.0... but to be honest we may need some more people interested in testing things, giving feedback and writing that code.

I am above all a teacher - not a developer - so any people working in universities and funded projects are wellcome to help. And yet - even if nobody else had any use for these scripts - it has been really nice - a pleasure and privilege - to study things, think up ideas and work with you, Marc, to produce something that might be useful for schools and other math teachers and students (from all levels of education)  smile

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
Mauno
sent you a couple of extensive email about two tag option. Let me know if you did not get those.
Marc
In reply to Marc Grober

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -
I will check my email - and reply as usual... wink
In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
Great! Just quit saying nice stuff about me in the forums; people will get the wrong impression ;=}

Sent email because I thought issues addressed were still a bit convoluted for forum (we make terrible messes of threads.....)

I am baby sitting marinara sauce (been cooking for several hours so we are at critical stage for converting sugars) but will peek at iPhone from time to time. LoL
In reply to Marc Grober

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -

I have been cooking apple jam recently... check your gmail, Marc...

Of course we will continue with this but my capablity to create new code means that stable version of plugins might be out after 10 years - without help from people like Alfred, Matthias and particularly you and your feedback. wink

In reply to Mauno Korpelainen

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
Northern Latitudes .......
We are on same page. Proposed solution in your inbox.
Alfred? Matthias? Are you hearing us?
In reply to Alfred Wassermann

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Marc Grober -
LoL,

Welcome indeed Alfred! The thing you will hate most about the forum is the time lag if u wait for mail-drives me batty ;)

My biggest concern is trying to make everything play nice together especially where technology is maintained by 3rd party as with dragmath and arguably asciimatml. In an environment like moodle we have to make sure new developments don't break legacy uses on thousands of systems.

I have colleagues bugging me for options and have just explained to one what could be done with even mediawiki jsxgraph and quiz extensions and he is already barely able to contain himself.

But we need to be able to offer a range of tools so that instructors learning curve doesn't dissuade instructor from use. Integration of jsxgraph with moodle GB tied activity would be quite an addition to moodle.

Resolving token/tag issues is critical hurdle.

In reply to Marc Grober

Re: Open source JSXGraphs - better than GeoGebra and AsciiSVG?

by Mauno Korpelainen -
All in all it may look like a total mess for somebody who sees these discussions for the first time but right now I feel that we are very close to universal solution for displaying both maths and graphs that are cross browser compatible and do not require any extra browser plugins. In addition to local LaTeX and AsciiMathML Google chart api and mathtran support rather large set of tex commands as MathML fallback and if we manage to create a combination (package) that has an advanced editor (TinyMCE) in moodle 2.0 together with optional plugins for adding these notations and graphs in a simple way, if we manage to create one global or several separate filters for parsing tags and allowing us to add maths also to such input fields that do not use editor, if we add alt tags for blind people to make maths more accessible and if all these tools can be used on any moodle sites at the same time... what else do we need... big grin

Can we fix it - Yes we can!!!

( did not embed this anyway... big grin )

Now we need either a nice activity or editor plugin for adding these jsxgraphs - but we have good prototypes ready...