kurtomerfaruk / wicked-charts

Automatically exported from code.google.com/p/wicked-charts
0 stars 0 forks source link

Feature request - ability to send up Javascript values with LiveUpdatingSeries Ajax updates #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I need to be able to chart the progress of a Javascript widget on my page and 
need to synchronise the chart updates with this. Could you perhaps add some 
feature which hooks into the Wicket 6 JS way of doing things to facilitate this 
? Thanks for your consideration !

Original issue reported on code.google.com by richards...@gmail.com on 18 Jan 2013 at 11:33

GoogleCodeExporter commented 9 years ago
Hi,

I would love to include the feature you are requesting, but I dont' completely 
understand what you are trying to do. Could you provide a more detailed 
description of your use case?

Thanks for your ideas,
Tom

Original comment by tom.homb...@gmail.com on 18 Jan 2013 at 9:41

GoogleCodeExporter commented 9 years ago
No problem, Tom. What I am doing is running an embedded YouTube player on the 
same page as a LiveSeries chart and displaying some time based data (voting) in 
the chart (I have a database of votes per second of the YT video). 

To display the right data in the chart, I need the update() function of the 
series to be aware of various Javascript variables set by the player via the 
regular YT API (eg player.getCurrentTime(), player.getPlayerState() etc) to be 
able to sync the chart properly. 

I have been trying, unsuccessfully (it seems to screw up other Ajax features of 
my page in JQueryUI-Wicket), to use AjaxTimerBehaviour to send this up every 
second but it is twice the Ajax load to do this and anyway it won't result in 
exact synchronisation of the chart. What I need is some ability to pass up 
parameters in a URL to LiveSeries.update() and to be able to set those params 
from a JS variable.

Hope this makes sense - what do you think, any chance ?

Cheers

Richard

Original comment by richards...@gmail.com on 19 Jan 2013 at 7:31

GoogleCodeExporter commented 9 years ago
I believe I have found a satisfying solution to your problem.

I have added two snapshot files in the downloads tab that contain the solution:
wicked-charts-wicket6-1.4.2-SNAPSHOT.jar
wicked-charts-highcharts-1.4.2-SNAPSHOT.jar

Please use the snapshot version to try out if it works for you. I will include 
the solution in the 1.4.2 release.

Original comment by tom.homb...@gmail.com on 19 Jan 2013 at 11:51

GoogleCodeExporter commented 9 years ago
Forgot to mention where to find the changes: the LiveDataSeries has a new 
method addJavaScriptParameter() in which you can specify any Javascript 
expressions you want to transmit to the server-side update() method.

Original comment by tom.homb...@gmail.com on 19 Jan 2013 at 11:53

GoogleCodeExporter commented 9 years ago
Wow, that was prompt, I will try it today if I get a chance. Thanks v much

Original comment by richards...@gmail.com on 19 Jan 2013 at 2:01

GoogleCodeExporter commented 9 years ago
Well, now unfortunately my code blows up with the stack trace below (my chart 
is somewhere inside a WebMarkupContainer called "notifier" but it worked with 
your 1.3 release - any reason this should have blown up, you think ?

Thanks for the API update - so I can retrieve params from the new 
JavaScriptParameters arg to update(0 but I'm not so clear as to how I make the 
chart object/options to pass that up ?

Stack trace: 

Last cause: null
WicketMessage: Error attaching this container for rendering: 
[WebMarkupContainer [Component id = notifier]]

Stacktrace

Root cause:

java.lang.NullPointerException
     at com.googlecode.wickedcharts.highcharts.options.processing.IdGeneratorProcessor.processOptions(IdGeneratorProcessor.java:38)
     at com.googlecode.wickedcharts.wicket6.highcharts.features.interaction.InteractionProcessor.processOptions(InteractionProcessor.java:50)
     at com.googlecode.wickedcharts.wicket6.highcharts.features.basic.ChartBehavior.onConfigure(ChartBehavior.java:119)
     at org.apache.wicket.Component.configure(Component.java:1033)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:913)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.markup.html.form.Form.onBeforeRender(Form.java:1732)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:136)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.Page.onBeforeRender(Page.java:802)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.Component.internalPrepareForRender(Component.java:2204)
     at org.apache.wicket.Page.internalPrepareForRender(Page.java:247)
     at org.apache.wicket.Component.render(Component.java:2289)
     at org.apache.wicket.Page.renderPage(Page.java:1021)
     at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:116)
     at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:244)
     at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)
     at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:830)
     at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
     at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:253)
     at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210)
     at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:281)
     at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
     at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:245)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
     at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
     at java.lang.Thread.run(Unknown Source)

Complete stack:

org.apache.wicket.WicketRuntimeException: Error attaching this container for 
rendering: [WebMarkupContainer [Component id = notifier]]
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1692)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.markup.html.form.Form.onBeforeRender(Form.java:1732)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1680)
     at org.apache.wicket.Component.onBeforeRender(Component.java:3830)
     at org.apache.wicket.Component.internalBeforeRender(Component.java:922)
     at org.apache.wicket.Component.beforeRender(Component.java:990)
     at org.apache.wic

Original comment by richards...@gmail.com on 19 Jan 2013 at 2:34

GoogleCodeExporter commented 9 years ago
Hi Tom

Seems that your 1.4.2 release is less tolerant that 1.3.1 of charts being given 
options objects without a series being added first. Doesn't matter - when I did 
this, it worked fine and I get the Javascript values I wanted so brilliant, 
thanks very much indeed

Cheers

Richard

Original comment by richards...@gmail.com on 19 Jan 2013 at 3:19

GoogleCodeExporter commented 9 years ago
Ah, yes that explains the exception. I will open a separate issue to handle 
late adding of series.

Good to hear that it works out for you. 1.4.2 will be released within the next 
2 weeks or so...don't forget to switch from your snapshot version to the 
release then:).

Regards,
Tom

Original comment by tom.homb...@gmail.com on 19 Jan 2013 at 5:32

GoogleCodeExporter commented 9 years ago
Milestone-1.4.2

Original comment by tom.homb...@gmail.com on 24 Jan 2013 at 9:06

GoogleCodeExporter commented 9 years ago

Original comment by tom.homb...@gmail.com on 24 Jan 2013 at 9:06

GoogleCodeExporter commented 9 years ago
Included in today's 1.4.2 release

Original comment by tom.homb...@gmail.com on 27 Jan 2013 at 2:24