DataTips in Flex charting are a poorly documented and little-understood feature.
There are three parts:
- the DataTip, by default a box with text inside
- the DataTipTarget, by default a bulls-eye circle over the series' point
- the Callout, the line from dataTipTarget to the DataTip box
How are these three elements created/drawn and how can they be customized?
See also my answer on how to properly customize the rendering of the DataTipTargets and the Callout lines.
It turns out that the
dataTipRendererstyle from theChartBaseclass defaults toDataTip.DataTipis anIDataRendererand therefore can act as a renderer. However, the methodDataTip.updateDisplayList(w,h)does not draw the circle at the data point. It draws a rectangle with HTML-able text inside.So what, then, draws the elusive bulls-eyes?
Now I did some digging, some Very Deep digging, and I have found the answers. I will document them here for others.
My SDK version is 4.1.0.
The code that renders the circle data point upon hover, which is the default, is not a renderer as we thought, but in fact a function within the
mx.charts.chartClasses.ChartBaseclass, line 3873:There's a similar function
positionAllDataTips()in the same class.There is a simple boolean style on
ChartBase,showDataTipTargets, that when set to false will disable the drawing of the circle on the line when hovering.The datatip targets are rendered within the
positionDataTips()function ofChartBase(starting at line 4204).Once I figured out that
showDataTipTargetsis related to this, I was able to answer another question. There you can find a detailed explanation of how to customize theDataTipTargetThe
ChartBaseboolean property,showDataTips, toggles the rendering of datatip BOXES only. They are rendered using the styledataTipRenderer, and the text of the datatip box is created using propertydataTipFunction.To summarize, DataTips on charts can be understood as the following:
ChartBase.getStyle("showDataTipTargets"):Booleanwill toggle the visibility of the default circle that is rendered upon hovering over a point.ChartBase.positionDataTips()functionChartBase.showDataTips:Booleanwill toggle the visibility of DataTips and DataTipTargets for the entire chartChartBase.getStyle("dataTipRenderer"):Classwill handle the graphical rendering of the DataTip box only.dataTipRendererwill use the string returned byChartBase.dataTipFunction:Functionto display the data.dataTipRenderershould handle the graphics/drawing of a DataTipdataTipFunctionshould handle the formatting of the text of the data for a given pointChartBase.getStyle(“dataTipCalloutStroke”):IStroke.