jFreeChart:如何将String值映射到axis? [英] jFreeChart: How to map String values to axis?

查看:44
本文介绍了jFreeChart:如何将String值映射到axis?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用TimeSeriesChart绘制以Hz为单位的频率.到目前为止,一切都很好.但是我需要添加第二个Y(值)轴来表示音乐音调.我需要用字符串值(C#9,A4等)表示刻度,因此我确定应该使用SymbolAxis.问题是我需要将字符串刻度值映射到确切的数字值,例如: A4-> 440,A#4-> 466.164,B4-> 493.883,C5-> 523.251 .....因此它既不是线性的也不是对数的.我怎样才能做到这一点?谢谢.

I am plotting frequency in Hz, using the TimeSeriesChart. So far so good. But I need to add a second Y (value) axis that would represent musical tones. I need the ticks to be represented by String values (C#9,A4 and so on), so I figured out I should use SymbolAxis. The problem is I need to map the string tick values to exact number values, such as: A4->440, A#4->466.164, B4->493.883, C5 ->523.251..... So it won't be linear nor logarithmic. How can I do that? Thanks.

(v1.0.17)

推荐答案

我回答了 refreshTicks()方法仅返回特定值的刻度标签(以及您需要的任何标签).

I answered this question in the JFreeChart forum already, you could achieve this by subclassing the NumberAxis class and overriding the refreshTicks() method to return tick labels for specific values only (and with whatever label you require).

这篇关于jFreeChart:如何将String值映射到axis?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆