简体   繁体   English

使用morris.js在XPage上绘制图表

[英]Charting on xpages with morris.js

There are many easily implementable and FREE charting components around. 周围有许多易于实现且免费的图表组件。 But running them in xPages is a pain. 但是在xPages中运行它们是很痛苦的。 I've tried morrisjs but raphael.js conflicts with dojo. 我尝试了morrisjs,但是raphael.js与dojo发生冲突。 I'm getting a javascript error 我遇到了JavaScript错误

Uncaught ReferenceError: Raphael is not defined 

Disabling dojo solves this problem but I'm losing all other dojo functionality which sucks. 禁用dojo可解决此问题,但我失去了所有其他糟糕的dojo功能。

I've put this line on beforePageLoad to disable dojo 我已经将这一行放在beforePageLoad上以禁用dojo

facesContext.getRequestParameters().setJsLibrary(0);

How can I overcome this problem? 我该如何克服这个问题?

This might be off topic but I'm ok with other charting solutions which can be implemented on xpages easily and freely. 这可能不在主题之列,但我同意可以轻松,自由地在xpages上实现的其他图表解决方案。

Have you tried to use the charting libraries that are included with Dojo and therefore already included? 您是否尝试过使用Dojo随附的因此已经包含的图表库? I am currently using them with good results. 我目前正在使用它们,效果很好。 I first found a good example at OpenNTF 我首先在OpenNTF找到了一个很好的例子

And here is an excellent tutorial . 这是一个很棒的教程

I also have used the Java charts also from OpenNTF but found the Dojox version to be a bit more flexible and less memory intensive for the Xpage. 我也使用了OpenNTF的Java图表 ,但发现Dojox版本在Xpage上更加灵活,占用的内存更少。

The problem is that Raphael doesn't comply to the shared practices of module loading. 问题在于Raphael不遵守模块加载的共享做法。 The usual hack is to load it as first module. 通常的技巧是将其加载为第一个模块。

The better solution is to use the AMD (that's the loading convention) compatible version of Raphael. 更好的解决方案是使用AMD(这是加载约定)兼容的Raphael版本。

Details are here: https://github.com/DmitryBaranovskiy/raphael/pull/540 详细信息在这里: https : //github.com/DmitryBaranovskiy/raphael/pull/540

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM