Flex ColumnChart label is getting truncated (example included)
I can't seem to figure out why, but the label on my ColumnSeries always seems to get truncated regardless of how wide the column is. I've tried setting the labelSizeLimit to an arbitrarily large number, but that doesn't seem to help
Any ideas as to whats going on?
Here is some sample code:
<?xml version="1.0" encoding="utf-8"?><mx:Application name="BarChart_barWidthRatio_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
private function labelFunc(v1:Object, v2:Object):String {
return 'asdfasasds';
}
]]>
</mx:Script>
<mx:ArrayCollection id="arrColl">
<mx:source>
<mx:Array>
<mx:Object name="R Winn" obp=".353" slg=".445" avg=".300" />
<mx:Object name="P Feliz" obp=".290" slg=".418" avg=".253" />
<mx:Object name="O Vizquel" obp=".305" slg=".316" avg=".246开发者_JAVA技巧" />
<mx:Object name="B Molina" obp=".298" slg=".433" avg=".276" />
<mx:Object name="R Durham" obp=".295" slg=".343" avg=".218" />
</mx:Array>
</mx:source>
</mx:ArrayCollection>
<mx:ApplicationControlBar dock="true">
<mx:Form>
<mx:FormItem label="barWidthRatio:">
<mx:HSlider id="slider"
minimum="0.0"
maximum="1.0"
value="0.6"
liveDragging="true"
tickInterval="0.1" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:ColumnChart id="barChart"
showDataTips="true"
dataProvider="{arrColl}"
width="100%"
height="100%">
<mx:horizontalAxis>
<mx:CategoryAxis
dataProvider="{arrColl}"
categoryField="name"
/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis minimum="0" maximum="1"/>
</mx:verticalAxis>
<mx:series>
<mx:ColumnSeries id="barSeries"
yField="avg"
xField="name"
displayName="name"
labelFunction="{labelFunc}"
labelPosition="outside"
labelAlign="center"
labelSizeLimit="900"
labelRotation="45"
columnWidthRatio="{slider.value}" />
</mx:series>
</mx:ColumnChart>
If you show the labels inside, then it will work.
labelPosition="inside"
If you want labelPosition="outside"
, then you need to extend and override label drawing.
========= information below is only FYI, has no relation with the problem/solution ========== labelAlign="center"
This is valid when
labelPosition="inside"
And, labelSizeLimit
is actually font size threshold. This should not be that high.
精彩评论