Hi,
Can anybody post a code snippet for adding an IntervalMarker
for a CategoryPlot to the domain just like the one for the
Difference Chart Demo 2
All I found in the forums where examples for the range.
I was able to add an Interval marker for the range but I don't know how
to add one for the domain.
Thanks
CategoryPlot IntervalMarker
-
- Posts: 844
- Joined: Fri Oct 13, 2006 9:29 pm
- Location: Sunnyvale, CA
Re: CategoryPlot IntervalMarker
An IntervalMarker cannot be added to a CategoryPlot along the domain. To accomplish what you are looking for, use addDomainMarker() which takes a CategoryMarker. There are three varieties of addDomainMarker(), so use the one that suites your needs best.jfreeuser2006 wrote:Can anybody post a code snippet for adding an IntervalMarker for a CategoryPlot to the domain just like the one for the
Difference Chart Demo 2
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
-
- Posts: 59
- Joined: Mon Nov 20, 2006 1:00 pm
-
- Posts: 844
- Joined: Fri Oct 13, 2006 9:29 pm
- Location: Sunnyvale, CA
If you want more than one category shaded, you will have to create a CategoryMarker per category you wish to shade. There is no IntervalMarker equivalent for a CategoryPlot since categories to not provide obvious start and end values. If the categories were sorted by natural ordering then it would be possible to specify a start and end value, but there is no means to guarantee this in current api. If you can ensure a natural ordering, you could create the CategoryIntervalMarker class yourself. Even if you cannot, you could hack something together to make it do as you wish.jfreeuser2006 wrote:How is it done using the Category Marker?
What my chart needs is for a certain region shaded. How can I do this
in the domain axis? How can I do this using a CategoryPlot
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
-
- Posts: 59
- Joined: Mon Nov 20, 2006 1:00 pm
Thanks for the reply Richard.
This is what i have come up so far.
I didn't start overriding the CategoryMarker yet.
What I did was just instantiate 3 markers. As you can see
There is white space in between the markers.

I''ve ordered my data. I'll just have to work on a hack
Many thanks :-)
This is what i have come up so far.
I didn't start overriding the CategoryMarker yet.
What I did was just instantiate 3 markers. As you can see
There is white space in between the markers.

RichardWest wrote:.... If you can ensure a natural ordering, you could create the CategoryIntervalMarker class yourself. Even if you cannot, you could hack something together to make it do as you wish.
I''ve ordered my data. I'll just have to work on a hack
Many thanks :-)
Last edited by jfreeuser2006 on Thu Apr 26, 2007 7:28 am, edited 2 times in total.
-
- Posts: 844
- Joined: Fri Oct 13, 2006 9:29 pm
- Location: Sunnyvale, CA
One thought: If you are using dates/times, could you use a XYPlot with a DateAxis for the domain axis? If you did, you can create and add an IntervalMarker with the start and end values being the dates you wish to highlight. These dates will have to be converted to longs using the getTime() method from java.util.Date, but that is not an issue.
I know in the forum there has been a lot of talk about not being able to segment the DateAxis (for example, into weekdays) without having gaps. While I have never used this class, it seems the SegmentedTimeline class would solve that problem. I noticed your dates are not at regular intervals, but as long as you do not use a TimeTableXYDataset you should not have to worry about breaks in the line if multiple series do not share a common set of domain values.
The TimeSeries and TimeSeriesCollection classes should allow you to add data dynamically if you wish (hard to keep people and posts in synch sometimes).
I know in the forum there has been a lot of talk about not being able to segment the DateAxis (for example, into weekdays) without having gaps. While I have never used this class, it seems the SegmentedTimeline class would solve that problem. I noticed your dates are not at regular intervals, but as long as you do not use a TimeTableXYDataset you should not have to worry about breaks in the line if multiple series do not share a common set of domain values.
The TimeSeries and TimeSeriesCollection classes should allow you to add data dynamically if you wish (hard to keep people and posts in synch sometimes).
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
-
- Posts: 59
- Joined: Mon Nov 20, 2006 1:00 pm
I haven't explored the XYPlot extensively, one reason being that my
dates don't have regular intervals. So i turned to the CategoryPlot
instead as this has suit the needs of my chart and how the data is plotted in the chart.
I would have to do further testing. Thanks for the tips Richard. Greatly appreciate it.
dates don't have regular intervals. So i turned to the CategoryPlot
instead as this has suit the needs of my chart and how the data is plotted in the chart.
I would have to do further testing. Thanks for the tips Richard. Greatly appreciate it.