具有多个系列的 Flex 条形图标签功能?
我有一个 Flex 条形图,其中包含两个集群格式的数据系列。 该系列称为“RequiredFunding”和“ApprovedFunding”,因此它们绘制在彼此旁边。 我遇到的问题是尝试格式化资金轴上的标签函数。 我显示了数千美元,需要使用美元符号和逗号进行格式化(我已经有此功能)。
当我尝试将标签函数应用于水平轴时,我返回 MoneyFormatter.format(labelValue),这是我的应用程序范围内的货币格式化程序,但这不起作用,因为 dataProvider 中有两种不同的金额...有 labelValue.RequiredFunding 和 labelValue.ApprovedFunding。
希望我正确地解释了这一点...有人有什么想法吗?
非常感谢,
-马特
编辑:我担心我没有解释得足够清楚! 不用担心。 基本上,我想将当前显示为 8000、16000、24000 和 32000 的底轴格式化为 $8,000、$16,000、$24,000 和 $32,000。 但问题是,该轴不会偏离所需资金金额或批准资金金额...它会自动适应较大的值...或者以某种方式将两个分组系列视为单独的系列...我是不确定。 例如,如果我将其设置为返回 MoneyFormatter.format(RequiredFunding),它将正确格式化...但它只会放置 requiredFunding 金额的标签(例如 $14,543、$2,543、$31,230),并且不会绘制任何条形图系列。 我希望这能解决问题。 如果有必要,我可以上传一些屏幕截图。
I have a Flex bar chart with two data series in a clustered format. The series are called RequiredFunding and ApprovedFunding, so they're plotted next to each other. The problem I am having is trying to format the label function on the Funding axis. I have several thousands of dollars being displayed and it needs to be formatted with dollar signs and commas (I have this functionality already).
When I try to apply a label function to the horizontal axis, I return MoneyFormatter.format(labelValue), which is my app-wide money formatter, but this doesn't work because there are two different money amounts in the dataProvider... there is labelValue.RequiredFunding and labelValue.ApprovedFunding.
Hopefully I explaned this correctly... does anyone have any ideas?
Much appreciated,
-Matt
EDIT: I was afraid I didn't explain this clearly enough! No worries. Basically, I want to format my bottom axis which currently says 8000, 16000, 24000, and 32000 to say $8,000, $16,000, $24,000, and $32,000. But the problem is, that axis isn't going off the RequiredFunding amount or the ApprovedFunding amount... it's automatically accomodating for whichever is the larger value... or somehow treating the two grouped series as individual series... I'm not certain. If I set it to return MoneyFormatter.format(RequiredFunding), for example, it will format it correctly... but it will only put the label for the RequiredFunding amounts (like $14,543, $2,543, $31,230) and won't plot either bar series. I hope this clears it up. If necessary I could upload some screen caps.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有这个并且它正在工作:
moneyFormat 函数:
我使用了我自己的一些测试数据,所以不要介意奇怪的 yFields。 我希望这有帮助
I have this and it is working:
moneyFormat function:
I used some test data that I had myself so don't mind the strange yFields. I hope this helps
我不太确定你想要什么。 您可以在使用 labelValue.RequiredFunding 后调用 MoneyFormatter.format() ,然后在 labelValue.ApprovedFunding 后调用 MoneyFormatter.format() 吗? 可能是我没搞清楚
I'm not really sure what you want. You can just call the MoneyFormatter.format() after eachother with labelValue.RequiredFunding and after that labelValue.ApprovedFunding or not? Probably I don't get it right