|
problem in date and time while zooming |
Posted by Rajesh on Apr-01-2015 19:41 |
|
I am facing one problem. While zooming the trend data, when the date exceed March 31st, time values are shown 'apr' only. This problem is not coming in other months.
|
Re: problem in date and time while zooming |
Posted by Peter Kwan on Apr-02-2015 04:00 |
|
Hi Rajesh,
Sorry for this problem. I confirm it is due to a bug in ChartDrector. It affects the C++,
PHP, Perl, Python and Ruby editions of ChartDirector. The .NET, Java and ColdFusion
editions are not affected.
The issue is because ChartDirector selects the incorrect formatting condition. In the
zooming and scrolling sample code, there is a list of formatting conditions to handle
various cases. It is like (in C++):
// If all ticks are yearly aligned, then we use "yyyy" as the label format.
c->xAxis()->setFormatCondition("align", 360 * 86400);
c->xAxis()->setLabelFormat("{value|yyyy}");
// If all ticks are monthly aligned, then we use "mmm yyyy" in bold font as the first
// label of a year, and "mmm" for other labels.
c->xAxis()->setFormatCondition("align", 30 * 86400);
c->xAxis()->setMultiFormat(Chart::StartOfYearFilter(), "<*font=bold*>{value|mmm
yyyy}", Chart::AllPassFilter(), "{value|mmm}");
..... some more formatting conditions ......
To work around the bug, the yearly and monthly alignment conditions should be applied
only when the view port has more than 2 days. To do this, the code can be modified to
include the condition "if (viewPortEndDate - viewPortStartDate > 2 * 86400)". It is like:
if (viewPortEndDate - viewPortStartDate > 2 * 86400)
{
// If all ticks are yearly aligned, then we use "yyyy" as the label format.
c->xAxis()->setFormatCondition("align", 360 * 86400);
c->xAxis()->setLabelFormat("{value|yyyy}");
// If all ticks are monthly aligned, then we use "mmm yyyy" in bold font as the first
// label of a year, and "mmm" for other labels.
c->xAxis()->setFormatCondition("align", 30 * 86400);
c->xAxis()->setMultiFormat(Chart::StartOfYearFilter(), "<*font=bold*>{value|mmm
yyyy}", Chart::AllPassFilter(), "{value|mmm}");
}
..... some more formatting conditions ......
Please kindly let me know if this can solve the problem.
Regards
Peter Kwan |
Re: problem in date and time while zooming |
Posted by RAJESH on Apr-02-2015 17:26 |
|
Sir,
Thanks for your prompt response. I will try the suggestion given by you. I got a doubt. This problems will be coming when ever we are retriving any monthly bounding dates or only March 31 and Apr 1.
Because I think it is OK in any other month boundaries like Jan 31-Feb 1, sep 30- oct1 etc. |
|