canDropLabels 可以在 DateTimeAxis 中使用吗?
我有一个使用 DateTimeAxis 轴的图表组件。我想在显示标签时使用我的逻辑,因为当显示超过一年的数据时,它只渲染几年(我也想显示几个月,因为有足够的空间来这样做)。
我尝试设置 canDropLabels="false",但它没有效果:
<mx:horizontalAxis>
<mx:DateTimeAxis id="xaxis" parseFunction="parseDate" />
</mx:horizontalAxis>
<mx:horizontalAxisRenderers>
<mx:AxisRenderer axis="{xaxis}" canDropLabels="false"/>
</mx:horizontalAxisRenderers>
但是如果我将轴从 DateTimeAxis 更改为 CategoryAxis,设置 canDropLabels 可以解决问题(所有标签都被渲染):
<mx:horizontalAxis>
<mx:CategoryAxis id="xaxis" categoryField="date"/>
</mx:horizontalAxis>
<mx:horizontalAxisRenderers>
<mx:AxisRenderer axis="{xaxis}" canDropLabels="true"/>
</mx:horizontalAxisRenderers>
我应该做什么才能强制显示所有标签(实际上,使用 labelFunction 定义的函数将确定要渲染哪些标签)使用 DateTimeAxis 时?
提前致谢。
I have a chart component which uses DateTimeAxis axis. I want to use my logic when showing labels, because when showing more then one year worth of data, it's rendering only years (I want to show months as well, cause there's more then enough space to do so).
I've tried setting canDropLabels="false", but it has no effect:
<mx:horizontalAxis>
<mx:DateTimeAxis id="xaxis" parseFunction="parseDate" />
</mx:horizontalAxis>
<mx:horizontalAxisRenderers>
<mx:AxisRenderer axis="{xaxis}" canDropLabels="false"/>
</mx:horizontalAxisRenderers>
But if I change axis from DateTimeAxis to CategoryAxis, setting canDropLabels does the trick (all labels are rendered):
<mx:horizontalAxis>
<mx:CategoryAxis id="xaxis" categoryField="date"/>
</mx:horizontalAxis>
<mx:horizontalAxisRenderers>
<mx:AxisRenderer axis="{xaxis}" canDropLabels="true"/>
</mx:horizontalAxisRenderers>
What should I do in order to force showing all labels (actually, function defined with labelFunction will determine what labels to render) when using DateTimeAxis?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在设计的功能上也遇到了类似的问题,我只用一个拥有类 LinearAxis 的属性解决了这个问题;该属性是“间隔”。
I had a similar problem with functionality I'm designing, and I solved it just with one property that owns class
LinearAxis
; this property is "interval".