Combining XYPlot and TimeSeries elements in JFreeChart

廉价感情. 提交于 2020-01-20 08:45:06

问题


I am interested in making a sort of hybrid between an XY Chart and Time Series in JFreeChart, where the x-axis is some SimpleDateFormat element (say, "yyyy-MM-dd HH:mm:ss.SSS"), with a respective start and end in the domain that is in this format, and the y-axis are levels, say LOW, MEDIUM, and HIGH. For each specific date/time, I would like to plot one of these three levels. How might I go about doing this?


回答1:


You'll need to combine several elements to get the desired effect:

  • Start with ChartFactory.createXYBarChart(), as shown below and here.

  • Use a DateAxis for the domain axis, as shown here.

  • Use setDateFormatOverride() on the domain axis to apply your SimpleDateFormat.

  • Use a SymbolAxis for the range axis to replace integer values with your symbols, as shown here and here.



来源:https://stackoverflow.com/questions/45018974/combining-xyplot-and-timeseries-elements-in-jfreechart

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