I'm using AngularJS
and FusionCharts
together in my web application. The upcoming release of AngularJS v1.3.0 will require there to be a <base>
tag in the HTML head, so as to resolve all relative links, regardless of where the app is hosted in the site's directory.
When including the <base>
tag with the latest version of FusionCharts (currently v3.4.0), the 3D charts do not render properly. For example, a 3D pie chart appears and has rotation and clickable slices, as well as tooltips and color on the inside edges of the slices. However, the entire outer color is black.
Excluding the <base>
tag causes the chart to look and behave normally.
Does anyone have any idea how to resolve this? Unfortunately, I don't own the source code, otherwise I'd hack at it myself.
Here's the link to the non-working jsFiddle: http://jsfiddle.net/aaronaudic/59Bmf/207
SOLUTION:
I originally awarded the correct solution to @pankaj, because his solution of simply adding the following line at page load seemed to fix the problem:
document.getElementsByTagName("base")[0].setAttribute("href", window.location.pathname+window.location.search);
However, this only works if the charts are on the initially-loaded page (when user navigates directly to page with the charts); when navigating to the page by way of something like ui-router
, I was still seeing black.
The correct answer is from @Shamasis. Adding the following to the page load will fix the issue application-wide:
eve.on('raphael.new', function () {
this.raphael._url = this.raphael._g.win.location.href.replace(/#.*?$/, '');
});
His original caveat mentioned that the export functions may be hampered from the Cloud, and this may be (I don't export from the cloud). However, exporting locally, as can be observed in this jsFiddle, works perfectly well: http://jsfiddle.net/aaronaudic/Gs6sN/14
My base tag, in the head of the page, is simply:
<base href="/">