[flexcoders] Re: How to remove space at the end of line chart when using disabledDays = [6,0]!
I've been using Flex to plot some financial charts, using the mx:DateTimeAxis as my horizontal axis to show the date and time of the plot. When plotting annual info, I'm able to use the disableDays feature to remove Saturday and Sunday from the plot. While this feature has its own set of problems (performance, incorrectly shrinking the plot's width) I've been able to work around those glitches to my satisfaction. I also been rendering intra-day financial charts, and sometimes multi-day intra-day charts. In other words, I'll be displaying stock data from 9:30am Monday through 4:00pm Wednesday, using minutes as the unit of measure for my horizontal DateTimeAxis. My problem is that I'd like to hide the periods of the day in which there is no trading activity when displaying a multi-day-intrady plot. So in my example of rendering an intra-day plot of Monday-Wednesday, I'd like to remove all of the overnight periods between Monday-Tuesday and Tuesday-Wednesday. If it was an annual plot, I could use disableDays and provide an array of the day values that the Flex chart component should remove, but is there a way to do this when the unit of measure for the horizontal DateTimeAxis is minutes instead of days? Thanks!
[flexcoders] Re: How to remove space at the end of line chart when using disabledDays = [6,0]!
I figured out the specifics of 'monkeypatching' and your patch works great. --- In flexcoders@yahoogroups.com, Craig [EMAIL PROTECTED] wrote: Hey Jim, I am ready to start in on this monkeypatch for disabled days white space... but don't know where or how to copy and paste the datetimeaxis class. Can you help me out? Also, what other specifics should I know? Should I call name it DateTimeAxis? I assume the program will not want two classes with the same name... I've taught myself AS and MXML and do custom mxml components but have not done a lot of custom classes. Any direction would be appreciated. Craig --- In flexcoders@yahoogroups.com, Jim Cheng lists@ wrote: 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 ?
[flexcoders] Re: How to remove space at the end of line chart when using disabledDays = [6,0]!
Hey Jim, I am ready to start in on this monkeypatch for disabled days white space... but don't know where or how to copy and paste the datetimeaxis class. Can you help me out? Also, what other specifics should I know? Should I call name it DateTimeAxis? I assume the program will not want two classes with the same name... I've taught myself AS and MXML and do custom mxml components but have not done a lot of custom classes. Any direction would be appreciated. Craig --- In flexcoders@yahoogroups.com, Jim Cheng [EMAIL PROTECTED] wrote: 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 ?
[flexcoders] Re: How to remove space at the end of line chart when using disabledDays = [6,0]!
Jim buithanhtuu, Thank you for posting this issue and 'workaround'. This bug was re- entered by Matt Chotin on March 27th, probably as a result of his reading this entry, it previously had been unresolved, let's hope this bug is fixed, it is a serious problem with Charting Applications, I also have a huge project on this... I have given up trying to find an answer and appreciate this workaround below. I have not upgraded to 3.0 because of this issue and will now purchase Pro 3.0 to see if I can accomplish this... if there is anything else anyone knows to get around this issue with 2.0 please let me know... I have signed up to the Adobe Bug Report ... https://bugs.adobe.com/jira/browse/SDK-15081 Let's hope this one does not get closed out as unresolved like the others!! Craig --- In flexcoders@yahoogroups.com, Jim Cheng [EMAIL PROTECTED] wrote: 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 ?