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

Message ListMessage List     Post MessagePost Message

  In realtime chart if url is too long ,the auto refresh is error
Posted by wishma on Nov-28-2011 11:39
The firsr url is
"http://127.0.0.1:8000/realtime/RealtimeXYChart.jsp?device=40282181338c696801338c8956f20004&kpi=kp1^kp5^kp6&instance=1^2^4^5^6^7^8^9^11^13^14^15^20^23^24^26^27^28&begintime=2011-11-2 11:11 00:00:01&endtime=2011-11-2 11:11 23:59:59&caption=&x=600&y=270&col=2&chartbgColor=f4f4f4&titlebgColor=ECECEC&titlefontColor=000000&legendColor=000000&curvalueColor=FFCCCC&pabgColor=FFFFFF&paaltBgColor=FFFFFF&pahGridColor=CCCCCC&pavGridColor=CCCCCC&xaxisColor=000000&xlabelColor=000000&yaxisColor=000000&ylabelColor=000000&tFontColor=000000&tfirstRow=EEEEEE&tcolor=F4F4F4&tedgeColor=000000"

the background code is
-----------
WebChartViewer viewer = new WebChartViewer(request, "ChartImageR_"+paraimg);

HttpServletRequest viewerRequest = viewer.getRequest();
String chartQuery = m.makeSession(viewerRequest, viewer.getId());
String imageMap = m.getHTMLImageMap("", "", "title='[{dataSetName}] {x|hh:nn:ss}: {value|5}'");

// Set the chart URL, image map to the viewer
viewer.setImageUrl("getchart.jsp?" + chartQuery);
viewer.setImageMap(imageMap);
viewer.setChartMetrics(m.getChartMetrics());

if (viewer.isPartialUpdateRequest()) {
viewer.partialUpdateChart(response);
}
else {
response.getWriter().write(viewer.renderHTML(response));
}
--------------------------------------

but In the pagecode like this
<input type='hidden' id='ChartImageR_kp1^kp5^kp6_1^2^4^5^6^7^8^9^11^13^14^15^20^23^24^26^27^28__JsChartViewerState' name='ChartImageR_kp1^kp5^kp6_1^2^4^5^6^7^8^9^11^13^14^15^20^23^24^26^27^28__JsChartViewerState' value='0*01*02*12093*2509' /><input type='hidden' id='ChartImageR_kp1^kp5^kp6_1^2^4^5^6^7^8^9^11^13^14^15^20^23^24^26^27^28__callBackURL' name='ChartImageR_kp1^kp5^kp6_1^2^4^5^6^7^8^9^11^13^14^15^20^23^24^26^27^28__callBackURL' value='/realtime/RealtimeXYChart.jsp?device=40282181338c696801338c8956f20004&kpi=kp1^kp5^kp6&instance=1^2^4^5^6^7^8^9^11^13^14^15^20^23^24^26^27^28&begintime=2011-11-2%2011:11%2000:00:01&endtime=2011-11-2%2011:11%2023:59:59&caption=&x=600&y=270&col=2&chartbgColor=f4f4f4&titlebgColor=ECECEC&ti20&cdLoopBack=1' /><map id='map_ChartImageR_kp1^kp5^kp6_1^2^4^5^6^7^8^9^11^13^14^15^20^23^24^26^27^28_' name='map_ChartImageR_kp1^kp5^kp6_1^2^4^5^6^7^8^9^11^13^14^15^20^23^24^26^27^28_'>
In this page the url parameters is error ,so is Why ????

  Re: In realtime chart if url is too long ,the auto refresh is error
Posted by Peter Kwan on Nov-29-2011 02:12
Hi wishma,

In your code, you are using "partialUpdate" (AJAX chart update). In this type of update, ChartDirector may need to use query parameters to pass data to the server.

In practice, servers and browsers only support query parameters with a certain maximum length. The maximum length is different for different servers and browsers, and is not standardized. If there are too much data to pass to the server and there is a risk of exceeding the length limit, ChartDirector may need to trim the query parameters.

So in summary, query parameters should not be used in partialUpdate. Instead, please use custom attributes (see WebChartViewer.getCustomAttr and WebChartViewer.setCustomAttr), which are specifically designed for partialUpdate.

if (!viewer.isPartialUpdateRequest()) {
    //Not partialUpdate - therefore is the initial request - copy from query parameters to custom attributes
    String[] knownAttributes = {"titlebgColor", "curvalueColor", ....};
    for (int i = 0; i < knownAttributes.length; ++i)
         viewer.setCustomAttr(knownAttributes[i], request.getParameter(knownAttributes[i]));
}

Then in your actual code, instead of using request.getParameter("xxx"), please use viewer.getCustomAttr("xxx")

Hope this can help.

Regards
Peter Kwan