问题描述
我有兴趣在JFreeChart中的XY图表和时间序列之间进行某种混合,其中x轴是一些SimpleDateFormat元素(例如,"yyyy-MM-dd HH:mm:ss.SSS"),在此格式的域中具有各自的起点和终点,并且y轴是级别,例如LOW,MEDIUM和HIGH.对于每个特定的日期/时间,我想绘制这三个级别之一.我该怎么做呢?
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?
推荐答案
您需要组合多个元素以获得所需的效果:
You'll need to combine several elements to get the desired effect:
-
以
ChartFactory.createXYBarChart()
,如下所示,并此处.
使用 作为域轴,如此处所示.
Use a DateAxis
for the domain axis, as shown here.
在域轴上使用setDateFormatOverride()
来应用您的SimpleDateFormat
.
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.
这篇关于在JFreeChart中结合XYPlot和TimeSeries元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!