Flex mx:axisrenderer 如何防止标签缩放
我有一个折线图,有时包含多个数据点。我已经解决了如何使用自定义标签函数和数据函数来防止水平轴显示太多标签。我的问题是强制 AxisRenderer 不要缩小我的标签。
我正在使用 labelRotation 属性,因此 canDropLabels 和 canStagger 属性不是一个选项。
预先感谢您的回复。
I have a line chart that sometimes contains a number of data points. I have solved how to prevent the horizontal axis from displaying too many labels using custom label functions and data functions. My problem is forcing the AxisRenderer not to scale down my labels.
I'm using the labelRotation property so the canDropLabels and canStagger properties are not an option.
Thanks in advance for any replies.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试使用装订线,装订线设置用于轴标签(如果您愿意,可以尝试阅读AxisRenderer的代码,看看它如何使用装订线和其他参数来缩放(如果需要文本)。
您可以按样式设置装订线像这样(这对我有用):
Try use gutter, gutter set are for the axis labels (if you want u can try to read the code of the AxisRenderer, and see how it use the gutter and other parameters to scale if need the text.
You can set the gutter by style like this (this work for me):
我相信这可以通过编辑 labelRenderer 属性来完成。查看此页面上的第二个示例(格式图表),它们定义一个自定义组件用作标签。你可以做类似的事情来保持你想要的任何外观。
I believe this can be done by editing the labelRenderer property. Take a look at the second example on this page (Formatting charts), they define a custom component to use as the label. You can do something like that to maintain whatever look you want.
我遇到了同样的问题。就我而言(对于我正在绘制的数据),只需将
canDropLabels
设置为true
(在 ActionScript 或 MXML 中,如下所示)会导致分配的边距变宽(我我猜测)到图表中的标签文本,这样我就从来没有看到文本呈现小于下面fontSize
设置的大小。尝试一下,它可能就是您所需要的。供参考:http://blog.flexexamples .com/2007/10/16/dropping-labels-in-a-flex-chart/
I ran into the same issue. In my case (for the data that I'm plotting), simply setting
canDropLabels
totrue
(either in ActionScript or MXML as below) resulted in widening the margins allocated (I'm guessing) to the label text in the chart such that I never saw the text render smaller than set byfontSize
below. Try it, it may be all you need.For reference: http://blog.flexexamples.com/2007/10/16/dropping-labels-in-a-flex-chart/