jFreeChart: How to map String values to axis?

倾然丶 夕夏残阳落幕 提交于 2019-12-13 15:33:10

问题


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)


回答1:


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).



来源:https://stackoverflow.com/questions/22597446/jfreechart-how-to-map-string-values-to-axis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!