Showing all datatips and Printing – Flex Column Chart
May 29, 2007
Note: For showing all datatips in Flex 3, the showAllDataTips property could be set to true, the following method could be used if you are using Flex 2.0.1.
This is a sample to show all datatips in a column chart and to print the same. Flex Charting APIs do provide some methods, which could be overridden to accomplish this.
I have overriden findDataPoints in ColumnChart, and extended ColumnSeries, to use certain protected properties like renderData. However, there are some hacks in the MyColumnSeries code to get some things like dataTipFunction, which will be used to display the text. Also, on mouseout the datatips vanish, but one could add an event listener to this and avoid this.
The print functionaility uses the PrintJob class and avoids using FlexPrintJob. FlexPrintJob uses an object which has to be of type UIComponent, but the datatips are children of the systemManager and hence will not work if FlexPrintJob is used. I have used the defaults for PrintJob, it could be changed to suit your needs.
This sample targets only the column chart, however could be extended to whatever chart or series one wants.
I have put the following files in a pdf (don’t know how to circumvent these extensions for uploading)
Here is the pdf, Code for column.mxml, MyColumnChart.mxml, MyColumnSeries.mxml
Do leave back a comment, if you find this useful.