Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't generate chart inside ajax tabs #4

Open
ghost opened this issue Jul 18, 2012 · 5 comments
Open

Can't generate chart inside ajax tabs #4

ghost opened this issue Jul 18, 2012 · 5 comments

Comments

@ghost
Copy link

ghost commented Jul 18, 2012

Hi Manu, I've placed my chart in a component that is loaded within the Tapestry-jQuery tab component, "Ajax Configuration". I can't seem to get it to generate my chart when loading the component with the tab, I need to actually refresh the page to get the basicComponent function to fire. Is there a way to get this to fire when the ajax tab loads rather than forcing a page refresh?

@ghost ghost assigned EmmanuelDemey Jul 18, 2012
@EmmanuelDemey
Copy link
Contributor

Hi,

DO you set the JSON parameter in JavaSCript like in your previous issue ? I think the problem come from this initialization. It is done when the page is rendering (when the container of your future chart is not yet in the DOM).

So when you change the tab, highcharts send an error (Communication with the server failed: Highcharts error #13: www.highcharts.com/errors/13 IT is the same ?), because it do not have the JSON parameter.

You can maybe create your own HighCharts component, and add a JavaScript file (with your configuration), and execute it before the highcharts script, by using the INitializationPriority.EARLY attribute of the addInitalizerCall method.

@ghost
Copy link
Author

ghost commented Jul 18, 2012

Hi Manu, I'm not sure I follow what your saying. Yes, the code in my previous post is the code I'm using in this task. I'm building my json object in @AfterRender which the script does make it's way to the dom.

javascript.addInitializerCall(InitializationPriority.EARLY, "basicComponent", obj);

I wasn't seeing any highchart errors, but I will look for that this evening.

Not quite sure what you mean by building my own HighCharts component? Are you referring to me building my own as opposed to me using yours?

@EmmanuelDemey
Copy link
Contributor

In fact, the solution is setting the JSONObject in JavaSCript before the
initialization of the component.

2012/7/18 George Christman <
[email protected]

Hi Manu, I'm not sure I follow what your saying. Yes, the code in my
previous post is the code I'm using in this task. I'm building my json
object in @AfterRender which the script does make it's way to the dom.

javascript.addInitializerCall(InitializationPriority.EARLY,
"basicComponent", obj);

I wasn't seeing any highchart errors, but I will look for that this
evening.

Not quite sure what you mean by building my own HighCharts component? Are
you referring to me building my own as opposed to me using yours?


Reply to this email directly or view it on GitHub:
#4 (comment)

Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
[email protected]
http://emmanueldemey.fr/

Twitter : @EmmanuelDemey

@fcolopezlagunas
Copy link

Hi, I am having the same issue. So how could this be fixed? I have my chart inside a zone which is updated when a user has selected the things to view on the graph, so at that time the IF statement enclosing the graph is now true, and decides to show the graph, however I am having that error in AFTER RENDER failure reading parameter options.
So I dont fully understand what do you mean with setting the JSONObject in JS before the initialization.
BTW, the charts are dynamically created by returning the JSON object with title, series, etc all defined there.

Thanks in advance.

@EmmanuelDemey
Copy link
Contributor

Hi,

Sorry for the delay, I had a lot of work on other projects.

Here a sample with an actionLink, refreshinga zone with a chart :

<t:ActionLink t:zone="zone">Zone/t:ActionLink
<t:zone t:id="zone">

/t:zone

@InjectComponent private Zone zone;
@Inject private AjaxResponseRenderer arr;
public void onAction(){
arr.addRender(zone).addCallback(new JavaScriptCallback() {
public void run(JavaScriptSupport javascriptSupport) {
javascriptSupport.addInitializerCall(InitializationPriority.EARLY,
"basicComponent", new JSONObject());
}
});
}

You have to be careful of the jQuery selector, when a zone is refreshed,
all the clientID is suffixed with a random value.In my basicComponent
function, I use a selector like this :

function basicComponent(spec){
$("div[id^='abstracthighcharts']").data('highcharts', {});
}

2013/1/6 fcolopezlagunas [email protected]

Hi, I am having the same issue. So how could this be fixed? I have my
chart inside a zone which is updated when a user has selected the things to
view on the graph, so at that time the IF statement enclosing the graph is
now true, and decides to show the graph, however I am having that error in
AFTER RENDER failure reading parameter options.
So I dont fully understand what do you mean with setting the JSONObject in
JS before the initialization.
BTW, the charts are dynamically created by returning the JSON object with
title, series, etc all defined there.

Thanks in advance.


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-11925329.

Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
[email protected]
http://emmanueldemey.fr/

Twitter : @EmmanuelDemey

@ghost ghost unassigned EmmanuelDemey Jan 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants