ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  WebChartViewer.renderHTML() callBackURL does not contain all parameters in Request
Posted by ethen_jean on Apr-20-2015 18:38
Attachments:
Environment:jsp/servlet
I draw a XYLineChart  by using WebChartViewer.renderHTML() method,the chart supports
zoomIn and zoomOut function,but the hidden field "chartid_callBackURL" does not invovle
all the parameters in my form,when my form only have one parameter or two,it works
well,but with more it does not work.I dont know why.Please help me!

URL1 works well
URL1:
/mpa/trendChart/getChart?pageId=388b8afd-179e-4fdc-ab43-
670125078d10&vars=&restrictions%5B0%5D.column=stripno&restrictions%5B0%5D.type=
1&restrictions%5B0%5D.value=00530700100

URL does not work
URL2:
/mpa/trendChart/getChart?pageId=388b8afd-179e-4fdc-ab43-
670125078d10&vars=&restrictions%5B0%5D.column=datetime&restrictions%5B0%5D.type
=9&restrictions%5B0%5D.value=20140905000000&restrictions%5B1%5D.column=datetim
e&restrictions%5B1%5D.type=7&restrictions%5B1%5D.value=201509010000020
1.png
2.png

  Re: WebChartViewer.renderHTML() callBackURL does not contain all parameters in Request
Posted by Peter Kwan on Apr-21-2015 01:39
Hi ethen_jean,

When you use zooming and scrolling, the request to the server is a special AJAX request,
not a normal GET or POST request. ChartDirector is not designed to include any of the
FORM fields in the AJAX request. So if the text in your FORM field is changed by the user,
it would not be reflected in the AJAX request.

However, when constructing the chartid_callBackURL, which is the URL used for AJAX
request, ChartDirector would include a few query parameters from the original HTTP
request. This is to ensure compatibility with some systems which uses these query
parameters for page routing.

For AJAX requests, to pass extra parameters to the server, please use custom attributes
instead. The "Zooming and Scrolling with Track Line (Web)" sample code demonstrates
how to do this. Note that in this sample code, there are 3 checkboxes on the left side to
select the data series. The state of these boxes are copied to custom attributes in the
"PreUpdate" event and pass to the server. In this server, viewer.getCustomAttr is used
to retrieve their values.

http://www.advsofteng.com/doc/cdjava.htm#zoomscrolltrackweb.htm

For your case, you may modify the code by copying the FORM field values to custom
attributes in the "PreUpdate" event, and access them on the server side using
viewer.getCustomAttr, just like in the sample code.

Hope this can help.

Regards
Peter Kwan

  Re: WebChartViewer.renderHTML() callBackURL does not contain all parameters in Request
Posted by ethen_jean on Apr-21-2015 09:35
Thanks for your reply!

"However, when constructing the chartid_callBackURL, which is the URL used for AJAX
request, ChartDirector would include a few query parameters from the original HTTP
request. This is to ensure compatibility with some systems which uses these query
parameters for page routing."

Besides,as refered from your words,i also want to know how many and which query
parameters are included in the callBackURL, and how to control this.Can i custom the
callBackURL in my own way?

Thanks a lot!

  Re: WebChartViewer.renderHTML() callBackURL does not contain all parameters in Request
Posted by Peter Kwan on Apr-22-2015 01:36
Hi ethen_jean,

ChartDirector will only keep at most 256 bytes of the query parameters in the callback_URL,
as it should be long enough for the purpose of routing pages. There is no API in
ChartDirector to control the limit. For additional parameters, you may consider to store any
parameters you need in custom attributes (WebChartViewer.setCustomAttr).

Regards
Peter Kwan

  Re: WebChartViewer.renderHTML() callBackURL does not contain all parameters in Request
Posted by ethen_jean on Apr-22-2015 03:57
Thanks a lot!

If there is a limit in callBackURL,as you said,how can i control the callback when i click the
zoomIn button and trig the zoomIn event?or other event on the chart?

  Re: WebChartViewer.renderHTML() callBackURL does not contain all parameters in Request
Posted by Peter Kwan on Apr-23-2015 01:13
Hi ethen_jean,

Do you mean you want to POST the field from the browser to the server? Unlikely, the AJAX
request is not a normal GET or POST request, and cannot include such fields.

You would need to use custom attributes to pass parameters that can be changed by the
user as mentioned in my previous message for AJAX request. The callBackURL is just a copy
of the URL when the chart is first created from a non-AJAX request, so that ChartDirector
knows how to communicate back to the server for subsequent AJAX request.

Regards
Peter Kwan