plot.addDomainMarker(new Marker(VALUE));

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
fse
Posts: 25
Joined: Thu Mar 27, 2003 9:21 am
Location: cologne, germany
Contact:

plot.addDomainMarker(new Marker(VALUE));

Post by fse » Tue Nov 18, 2003 5:23 pm

hi,

what does this VALUE stand for?
i observed that negative values are not drawn,
but if i set VALUE to 0 the marker isn't drawn at the side of the plot.

aditionally the range of marker values seem to differ from my range to my domain axis

totally confused ...

frank

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 » Tue Nov 18, 2003 6:04 pm

It is the data value - if the value you specify is not within the current axis range, then the marker (usually a line perpendicular to the axis) will not be visible.
David Gilbert
JFreeChart Project Leader

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

fse
Posts: 25
Joined: Thu Mar 27, 2003 9:21 am
Location: cologne, germany
Contact:

hmm not really

Post by fse » Wed Nov 19, 2003 10:43 am

hi david,
david.gilbert wrote:It is the data value - if the value you specify is not within the current axis range, then the marker (usually a line perpendicular to the axis) will not be visible.
well that's what i expected but:
Image
is created with this

Code: Select all

	/**
	 * @see de.bayer.apollo.charts.BubbleChart#setCustomizedDomainAxis()
	 */
	protected void setCustomizedDomainAxis(
		double originalMinimum,
		double originalMaximum,
		double maximalMinimum,
		double minimalMaximum) {
		XYPlot plot = chart.getXYPlot();
		ValueAxis firstAxis = plot.getDomainAxis();
		ValueAxis myAxis = new NumberAxis(getYAxisTitle());
		customizeAxisExtrema(
			originalMinimum,
			originalMaximum,
			maximalMinimum,
			minimalMaximum,
			firstAxis,
			myAxis);

		Marker marker = new Marker(0);
		marker.setLabel("0");
		plot.addRangeMarker(marker);
		marker = new Marker(50);
		marker.setLabel("50");
		plot.addRangeMarker(marker);
		marker = new Marker(100);
		marker.setLabel("100");
		plot.addRangeMarker(marker);

		plot.setSecondaryDomainAxis(2,myAxis);
		plot.setSecondaryDomainAxisLocation(2,AxisLocation.BOTTOM_OR_LEFT);
	}
As you can see I create a second axis, customize both (that is widen the original on and fill the second with project data), and set labeled markers.
But these markers correspond to none of the values on both axis, nor to the original values of the first axis.
All six marker values are within all 4 axis ranges, but i see only 3 markers.
So how can i adjust these markers to values on a axis?

tia frank

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 » Mon Nov 24, 2003 3:35 pm

I can't reproduce this, so something in the code you haven't shown must be triggering the problem. If you can put together a small, self-contained demo application that shows the problem, then attach it to a bug report at SourceForge and I'll investigate.
David Gilbert
JFreeChart Project Leader

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

fse
Posts: 25
Joined: Thu Mar 27, 2003 9:21 am
Location: cologne, germany
Contact:

sorry sf down 4 maintenance i'll try again tomorrow :-)

Post by fse » Mon Nov 24, 2003 5:46 pm

hi david,

sorry sf is down for maintenance
so here is the short sample that doesn't work as expected.
i expect the markers d10 and r10 to be drawn at x=10 respectively y=10. but on my machine they are drawn at x~=3.8 / y~=1.4
ok tomorrow i'll put it in a bug report on sf

Code: Select all

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.Legend;
import org.jfree.chart.Marker;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.Dataset;
import org.jfree.data.MatrixSeries;
import org.jfree.data.MatrixSeriesCollection;
import org.jfree.data.XYDataset;
import org.jfree.data.XYZDataset;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;


/**
 * Oberklasse aller Charts, die Bubble Darstellung verwenden.
 * 
 * @author <a href="fse@maxence.de">Frank Segieth</a>
 * created 02.05.2003
 */
public class BubbleChart{
	public final JFreeChart getJChart()
	{
		if (chart == null)
		{
			setDataset(getBubbleTest());
		}
		return chart;
	}


	/**
	 * Zeigt Testweise das Chart in einem Desktop Window an.
	 */
	protected final void quickView(){
		try
		{
			ApplicationFrame af = new ApplicationFrame(getClass().getName());
	        ChartPanel chartPanel = new ChartPanel(getJChart() );
	        chartPanel.setVerticalZoom( true );
	        chartPanel.setHorizontalZoom( true );
	        af.setContentPane( chartPanel );
	        af.pack(  );
	        af.setSize( 800, 600 );
	        RefineryUtilities.centerFrameOnScreen( af );
	        af.setVisible( true );
		}
		catch (Exception exc)
		{
			exc.printStackTrace();
		}
	}


	public static void main(String param[]){
		new BubbleChart().quickView();
	}

	protected JFreeChart chart;

	public XYDataset getBubbleTest() {
		MatrixSeriesCollection ds = new MatrixSeriesCollection();
		int bubbles[][] = {{3,3,2},{12,8,2},{8,12,2}};
		for (int index = 0;index < bubbles.length;index++)
		{
	        MatrixSeries series =
	            new MatrixSeries( "test", 15,15 );
			series.update(bubbles[index][0],bubbles[index][1],bubbles[index][2]);
			ds.addSeries(series);
		}
		return ds;
	}

	/**
	 * @see de.bayer.apollo.charts.ApolloChart#setDataset(CategoryDataset)
	 */
	public void setDataset(Dataset dataset) {
		chart = ChartFactory.createBubbleChart(
			"grummel","bla","fasel",
			(XYZDataset)dataset,				
			PlotOrientation.HORIZONTAL,
			true,true,false);
		Marker marker = new Marker(10);
		marker.setLabel("D10");
		chart.getXYPlot().addDomainMarker(marker);
		marker = new Marker(10);
		marker.setLabel("R10");
		chart.getXYPlot().addRangeMarker(marker);
		
        // if you comment out the next line
        // Marker "R10" will be set to zero
        chart.getLegend().setAnchor(Legend.EAST);
	}



}
david.gilbert wrote:I can't reproduce this, so something in the code you haven't shown must be triggering the problem. If you can put together a small, self-contained demo application that shows the problem, then attach it to a bug report at SourceForge and I'll investigate.

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 » Mon Nov 24, 2003 6:09 pm

Thanks, that made things easier. I have reproduced the bug on my system using JFreeChart 0.9.13, but it is fixed in 0.9.14. The problem was that the domain and range markers weren't taking the plot orientation into account.
David Gilbert
JFreeChart Project Leader

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

Locked