On 02/15/2014 05:43 PM, Clemens Robbenhaar wrote:
On 02/14/2014 04:44 PM, Hamster wrote:
I have a problem getting the D3js example
<http://extensions.xwiki.org/xwiki/bin/view/Extension/D3+Example> to work.
I have a fresh XWiki 5.4 running. I have installed the D3js with the EM. I
then created a new Space called "D3". I created a page called
"D3.Data" and
pasted the data from the example. I then edited the "D3.WebHome" and pasted
the code to display the graph.
But when I click "Save & View", I only get a blank page. F5 (refresh) does
nothing. I then edit the page in the WYSIWYG editor...I can see the graph
being displayed! I can even use the arrow keys left and right to interact
with the graph. But when I hit "Save & View", the graph is NOT being
displayed, but part of the velocity code is. If I edit the page in XWiki
mode, I can see that some velocity code is now being 'escaped' by XWiki.
What am I missing here????
First thing you are missing is that the extension on the page is just a demo for the
impatient to view something before even installing something. It fetched the javascript
stuff from the D3 website directly; no need to install the D3js extension to run it ;)
Then, indeed the WYSIWYG editor does not handle the code snippet gracefully, just opening
the editor and saving without editing breaks the thing, there is just too many
inline <script> and other not-best-practice stuff in it it goes crazy and damages
the thing.
Using the Wiki-editor is highly recommended for this beast ;)
But these are all side notes ....
What is really puzzeling and what I am starting at for an hour without understanding is
that the normal view does not show anything.
All I get is a JavaScript Error "Refercence d3 not defined".
If you look at it in "plain view" it should be ok (same as inside the WYSIWYG
editor frame):
http://localhost:8080/xwiki/bin/view/D3/WebHome?xpage=plain
It seems one of the libraries XWiki loads in its normal layout conflicts with d3 in some
way.
it is actually the "requirejs" that gets upset that soemone tries tio bypass:
http://requirejs.org/docs/errors.html#mismatch
d3 smells the presence of requirejs and tries to register itself by there, making it
inaccessible via the "fast & dirty" approaches to get things running.
However wrapping the code in a "require(['d3'], function(d3) { ...});"
call did not work for me either.
Maybe I should really read the documentation to figure out how this works. :D However not
this weekend, sorry
Clemens
(Installing and using the extension "as
advertized" does not work either, as the "d3:loaded" event is never fired,
btw ..)
Well, that's as far as I got. Only tested with Firefox, however.
Maybe someone else can shed some more light on this.
Clemens
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Clemens Klein-Robbenhaar
Software Development
EsPresto AG
Breite Str. 30-31
10178 Berlin/Germany
Tel: +49.(0)30.90 226.763
Fax: +49.(0)30.90 226.760
robbenhaar(a)espresto.com
HRB 77554 B - Berlin-Charlottenburg
Vorstand: Maya Biersack, Peter Biersack
Vorsitzender des Aufsichtsrats: Dipl.-Wirtsch.-Ing. Winfried Weber
Zertifiziert nach ISO 9001:2008