It's a Flex 3 charting bug alright.  This was originally reported about 
9 months ago during the beta cycle on the Flex bugbase and was later 
closed by Adobe with a resolution of Cannot Fix for what I believe to be 
a rather spurious reason, see:

https://bugs.adobe.com/jira/browse/FLEXDMV-963

Contrary to what's reported in the comments on that bug, the problem is 
actually not too difficult to fix provided you have access to the source 
code (e.g. using Flex Builder 3 Pro) and are willing to do a little bit 
of subclassing or monkey-patching to fix the issue.  Read on if you're 
interested.

The basic problem is that the DateTimeAxis class does not correctly 
calculate the total space available for charting when disabledDays 
and/or disabledRanges is enabled.  This is always taken to be the 
difference between computedMaximum and computedMinimum (as seen in the 
transformCache, buildLabelCache and buildMinorTickCache methods).

However, this calculation becomes wrong when there are disabled ranges, 
as it yields a total span that's now too large (not accounting for the 
ranges that have been removed).  The visual consequence of this is that 
the chart now appears to be condensed to the left.

The available space should instead be taken to be the difference between 
computedMaximum and computedMinimum, with the following term also 
subtracted (in the context of the DateTimeAxis class):

   dateRangeUtilities.calculateDisabledRange(computedMinimum,
     computedMaximum);

This additional term accounts for the space that is removed by the 
disabled ranges (or days), and consequently allows the chart's axis and 
elements to correctly take up the full available width.

To make a simple monkey-patch to fix this, you can copy the contents of 
Adobe's DateTimeAxis class into your own class path, doing a search and 
replace on all instances in the file like so (removing quotes and excess 
whitespace for formatting):

Find: "computedMaximum - computedMinimum"

Replace with: "computedMaximum - computedMinimum -
   dateRangeUtilities.calculateDisabledRange(computedMinimum,
   computedMaximum);"

You can also do this as a subclass, but that's somewhat trickier since 
the methods that you'll need to override make references to a number of 
private variables and methods of DateTimeAxis.

As an aside, perhaps someone at Adobe might want to consider evaluating 
this patch for possible inclusion into the Flex 3 Charting codebase.  I 
haven't found any other side effects in testing and my own use of this 
change, and it correctly handles the test case from the JIRA bug listed
at the top of message.

Jim



buithanhtuu wrote:

> I'm using chart of flex 3. When I use Linechart with DateTimeAxis
> tag, in this tag i used property disabledDays = "[6,0]" then weekend
> days did not show on chart, but a lot of white space are show at the
> end of chart. So, the width of line chart is not scale full the width
> of chart.
> 
> I used sample from this link 
> http://livedocs.adobe.com/flex/3/html/help.html?content=charts_displayingdata_04.html
>  
> <http://livedocs.adobe.com/flex/3/html/help.html?content=charts_displayingdata_04.html>
> 
> 
> Could you please help me fix this problem or this is bugs of chart in
>  flex 3 ?

Reply via email to