|
zooming not functioning properly in some cases |
Posted by at on Jun-08-2015 18:07 |
|
Hi Peter, the source below is an ajax url from the partialUpdate method of chartdirector, can you tell me what's
wrong with it since it's just returning same chart as the original one? i.e. it's not returning the zoom-in state of the
chart(taken from firebug and I removed the controller and method from it, we are using codeigniter).
&cdLoopBack=1&cdPartialUpdate=bar_histogram_78342a5e4e3b02ce6536968b1d0b0b66_sd&cdCacheDefeat=1
433757403098&bar_histogram_78342a5e4e3b02ce6536968b1d0b0b66_sd_JsChartViewerState=0*54%1E1*57%
1E2*458%1E3*200%1E4*0.05502570559950706%1E5*0.9486506264686585%1E6*0.027838427947598252%1
E7*0.048125%1E8*2%1E9**%23000000%1E10*3%1E11*2%1E12*2%1E13*2%1E14*0.5%1E15*0.01%1E16*
1%1E17*0.01%1E18*1%1E19*5%1E23*1%1E24**chart_title**Test%20%23%201819%20%3A%3A%20TX_P
LL_PD_f4/%20%28deg%29%3C*br*%3ETest%20Limits%5B0%2C1.6000%5D%1Flegend**QLQ9610-
D0%2CQLQ9611-F3%2CQLQ9612-A3%2CQLQ9613-C6%2CQLQ9614-F1%2CQLQ9615-A1%2CQLQ9616-
C4%1FmaxX**49%1FmaxX2**2.338%1FmaxY**250%1Fmax_orig**49%1FminX**0%1FminX2**0.7561%1F
minY**0%1Fmin_orig**0%1Fprev_colors**0054a6%2Cce2903%2C3fa535%2Ca91d9e%2Cbb941c%2C2092d8
%2Ceb660d%1Fx_axis_label**deg%1Fy_axis_label**Count%1FInitial_VP_Left*0%1FInitial_VP_Top*0%1FIni
tial_VP_Width*1%1FInitial_VP_Height*1%1Fds_label**invalid%1Fmax_x2_scale**0.92912748007962%1Fma
x_x_scale**5.3595970187125%1Fmax_y_scale**24.0625%1Fmd5_dsklist**8171551788326b7ca9bca6e817f58c
6b%1Fmin_x2_scale**0.84105226173901%1Fmin_x_scale**2.6314310798478%1Fmin_y_scale**0%1E25*1
Thanks. |
Re: zooming not functioning properly in some cases |
Posted by Peter Kwan on Jun-08-2015 23:48 |
|
Hi at,
In a web application, the browser sends a request to the server to obtain the zoom-in
chart. It is up to the server code to decide what to send back to the browser. In our
sample code, the code will send back the requested zoom-in chart to the browser, unless
the zoom-in limit is exceeded. Note that in a web application, the server makes the final
decision. It can send back anything it likes regardless of what the user has requested. It
is up to the code running on the server side.
For your case, there are two possibilities:
(a) The browser is not sending the zoom-in request to the server.
or
(b) The browser sends the correct zoom-in request to the server, but the server code
decides not to send the zoom-in chart to the browser.
According to the URL, the request is for a chart that is slightly zoom-in in the horizontal
direction (around 1.05x zoom in), but highly zoom-in in the vertical direction (around 20x
zoom in).
To troubleshoot the issue, you may display the viewport information in the chart title.
Usually, in Zooming code, the problem should begin execution with:
# Create the WebChartViewer object
$viewer = new WebChartViewer("chart1");
if ($viewer->isPartialUpdateRequest()) {
# Is a partial update request. Draw the chart and perform a partial response.
drawChart($viewer);
print($viewer->partialUpdateChart());
exit();
}
Make sure the above is the first few lines that get executed. (Lines before that should
only be function definitions.) This first thing your program should do is to distinguish a
partialUpdate from a normal request. This ensure that no other code can affect the
viewport or the query parameters.
You can then modify the code to:
if ($viewer->isPartialUpdateRequest()) {
# Is a partial update request. Draw the chart and perform a partial response.
$title = "" . $viewer->getViewPortLeft() . "," . $viewer->getViewPortWidth() . ", " . $viewer->getViewPortLeft() . ", " . $viewer->getViewPortLeft() . "(" time() . ")";
drawChart($viewer, $title);
print($viewer->partialUpdateChart());
exit();
}
else
$title = "Not a partial update (" . time() . ")";
.... include the $title in the chart ....
Then in the charting code, please use:
$c->addTitle($title);
Now you should see the viewport configuration and the timestamp in the chart title.
When you zoom in, you can check if the viewport is updated correctly and the timestamp
has changed. The timestamp should always change even if the viewport is not updated.
If the timestamp does not change, it means the server has not sent a new chart back.
The the viewport change but the chart does not change as expect, there is some issue
on the server side code, that it for some reasons decides not to send the zoom-in chart
back, even it knows the viewport has changed.
Regards
Peter Kwan |
Re: zooming not functioning properly in some cases |
Posted by at on Jun-09-2015 12:28 |
|
Hi Peter, the viewports and the timestamp did change so the server is returning an updated chart. Any more idea
how to proceed with the debugging? |
Re: zooming not functioning properly in some cases |
Posted by Peter Kwan on Jun-10-2015 02:39 |
|
Hi at,
If the viewport is correct, then you would need to examine the server charting code to
see why it is not returning the expected chart. The server should create a chart that
matches the viewport configuration.
For example, in the original "XY Zooming and Scrolling" sample code, the initial chart is
assumed to be the "full chart" (so no setFullRange code is necessary), and then the
following code is used to set the x and y axes scale according to the viewport.
$viewer->syncLinearAxisWithViewPort("x", $c->xAxis);
$viewer->syncLinearAxisWithViewPort("y", $c->yAxis);
In the original "Zooming and Scrolling with Track Line" sample code, the initial chart is not
the "full range", so setFullRange is necessary to tell ChartDirector what is the full range,
and the x-axis (horiznotal axis for that chart) scale is sychronized to the viewport width:
$viewer->syncDateAxisWithViewPort("x", $c->xAxis);
For your case, you can verify why the axis is not synchronized with the viewport. For
example, do you have another line of code that sets the axis scale as well (such as
setLinearScale or setLabels)? If this is the case, when ChartDirector synchronize the axis
scale, the charting code may change it back and so the axis may not be synchronized as
expected. Other possibility is that the "full range" is changed for some reason. To
determine the full range, you can get the value for the viewport position 0 and 1 (using
getValueAtViewPort). This should represent the full range. Then you can display it on the
chart so that you can see it (eg. by using them as the x-axis title), etc..
Regards
Peter Kwan |
Re: zooming not functioning properly in some cases |
Posted by at on Jun-10-2015 16:33 |
|
Hi Peter, I already found the issue. I called layoutAxes somewhere in the middle. Thanks for the great support. |
|