I'm developing a charting application and I'm using jFreeChart. I'm using a LineChart and a CategoryDataset.
我正在开发一个图表应用程序,我正在使用jFreeChart。我正在使用LineChart和CategoryDataset。
I need to display a LineChart where in the Y axis (RangeAxis) there will be displayed number values and on the X axis (CategoryAxis) there will be displayed dates (yyyy/MM/dd hh:mm:ss) although in String format.
我需要显示一个LineChart,其中在Y轴(RangeAxis)中将显示数字值,在X轴(CategoryAxis)上将显示日期(yyyy / MM / dd hh:mm:ss),尽管是String格式。
My question is if there is a way to display only certain dates on the CategoryAxis (X axis) althoug keeping all the pair (yyyy/MM/dd hh:mm:ss, Y value) in the series.
我的问题是,是否有一种方法只能在CategoryAxis(X轴)上显示某些日期,同时保留系列中的所有对(yyyy / MM / dd hh:mm:ss,Y值)。
Example: the X axis only showing the days (yyyy/MM/dd) of my dataset but on mouseover in the series, the tooltip would stil display the pair (yyyy/MM/dd hh:mm:ss, Y value).
示例:X轴仅显示我的数据集的天数(yyyy / MM / dd),但在系列中的鼠标悬停时,工具提示将显示该对(yyyy / MM / dd hh:mm:ss,Y值)。
In other words, my CategoryAxis would contain only a subset of points of my series although my series would still contain all the values.
换句话说,虽然我的系列仍然包含所有值,但我的CategoryAxis只包含我系列中的一部分点。
So far I'm limited to the restriction of for each (yyyy/MM/dd hh:mm:ss, Y value) pair displayed I need to have a correspondence (yyyy/MM/dd hh:mm:ss) on my X axis, which makes it unreadable as it is full of points and labels.
到目前为止,我仅限于显示每个(yyyy / MM / dd hh:mm:ss,Y值)对的限制我需要在我的X上有一个对应关系(yyyy / MM / dd hh:mm:ss)轴,这使得它不可读,因为它充满了点和标签。
Don't know if I made myself clear and specific on my question, thanks in advance.
不知道我是否在提问时明确提出自己的问题。
1 个解决方案
#1
0
Since you have dates on your x axis, I think you should use a DateAxis
instead of your CategoryAxis
, and use an XYPlot
.
由于x轴上有日期,我认为你应该使用DateAxis而不是CategoryAxis,并使用XYPlot。
As seen in the answer to a similar question, you can use DateAxis#setTickUnit(DateTickUnit unit)
to set the unit type to DateTickUnitType.DAY
.
如在类似问题的答案中所见,您可以使用DateAxis #setTickUnit(DateTickUnit unit)将单位类型设置为DateTickUnitType.DAY。
#1
0
Since you have dates on your x axis, I think you should use a DateAxis
instead of your CategoryAxis
, and use an XYPlot
.
由于x轴上有日期,我认为你应该使用DateAxis而不是CategoryAxis,并使用XYPlot。
As seen in the answer to a similar question, you can use DateAxis#setTickUnit(DateTickUnit unit)
to set the unit type to DateTickUnitType.DAY
.
如在类似问题的答案中所见,您可以使用DateAxis #setTickUnit(DateTickUnit unit)将单位类型设置为DateTickUnitType.DAY。