Sunday, April 4, 2010

First look on Mirroring and Charts

Couple of quick updates before i elaborate on mirroring.
  1. Flex 4 and Flash builder 4 are up for grabs. You can download them from here
  2. Advanced Data visualization components (which include ADG, ODG and Charts) are now a part of free open source flex sdk.
There's gonna be a follow up version for flex sdk 4.0, which will include layout mirroring feature. This feature is intended to trivialize repurposing a GUI designed for a LTR language, like English, for a RTL language like Hebrew or Farsi. Following Q&As might help you to understand\ picturize the feature better. I have focussed on its impact on charts.

Q: How can I set the layout for a RTL language?
A: The mirroring API is defined by a new interface called ILayoutDirectionElement. The interface defines the layoutDirection property whose value can be "ltr" or "rtl". By setting the property value to "rtl", at the application (root) level , the layout will be mirrored.

Q: Can i set layoutDirection at component\container level, instead of setting it at application(root) level?
A: Yes. For example, you can set layoutDirection for ColumnChart by using this code

Q: How would a chart look in a RTL layout?
A: Sample image of a line chart with DateTimeAxis whose layoutDirection is set to RTL is shown below

Q: layoutDirection for the Application is ltr , and layoutDirection for chart is set as rtl. Is this a valid scenario? How would the application look at the runtime?
A: Yes. It is a valid scenario. Only the chart will be mirrored and not the application. Hence, the chart will be on the left hand side at the run time. An HLOC chart for the above scenario is shown below
Q: When layoutDirection is set to rtl, what will be the text allignment of the text in the datatip for a chart?
A: Text alignment in the datatip depends on the style "direction". If we want the text inside the datatip to be right aligned, we should set the direction to "rtl" as given below. This is independent of layoutDirection.
Comments\feedback are welcome.