Gantt CategoryPlot and CategoryMarker

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
moonblade
Posts: 21
Joined: Mon Sep 18, 2006 9:41 am

Gantt CategoryPlot and CategoryMarker

Post by moonblade » Thu Mar 08, 2007 12:46 pm

According to what i read in the jfree chart developer guide, Markers are added to the plot using the addDomainMarker() methods in the CategoryPlot class.

But how if i want to add the marker to the RangeAxis of a gantt chart (the range axis is in date timemillis ..) ? Is it possible to use addRangeMarker() instead of addDomainMarker() in the CategoryPlot ? I've tried the following code, with no error, and also no intended result with the marker, the marker just doesnt show up. Here's an excerpt of my code :

Code: Select all

        chart = createChart(dataset);
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
        Day day = new Day(1, 4, 2001);
        CategoryMarker marker = new CategoryMarker(new Long(day.getFirstMillisecond()), Color.blue, 
                new BasicStroke(1.0f));
        marker.setDrawAsLine(true);
        marker.setLabel("Marker Label");
        marker.setLabelFont(new Font("Dialog", Font.PLAIN, 11));
        marker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
        marker.setLabelOffset(new RectangleInsets(2, 5, 2, 5));
        plot.addRangeMarker(marker, Layer.BACKGROUND);
Please give me hints ... :)

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu Mar 08, 2007 5:19 pm

The CategoryMarker is intended for the domain axis (CategoryAxis) only. For the range axis, use a ValueMarker or RangeMarker.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked