package test.graph; import java.awt.Color; import java.awt.Graphics2D; import java.util.LinkedHashMap; import java.util.Map; import java.util.logging.Level; import org.das2.datum.Units; import org.das2.graph.DasAxis; import org.das2.graph.Renderer; import org.das2.qds.QDataSet; /** * Demonstration of defining a new Renderer. This can be compiled into the * application and then added to the DasPlot. * * This example Renderer takes a Rank 2 ds[n,4]. Each record is the x and y * positions, then the radius, then the color. * * @author jbf */ public class MyRenderer extends Renderer { @Override public void render(Graphics2D g, DasAxis xAxis, DasAxis yAxis ) { if ( ds==null || ds.rank()!=2 || ds.length(0)!=4 ) { getParent().postMessage( this, "dataset not ready or appropriate", Level.INFO, null, null ); return; } QDataSet bds= (QDataSet) ds.property(QDataSet.BUNDLE_1); Units xunits= (Units) bds.property(QDataSet.UNITS,0); Units yunits= (Units) bds.property(QDataSet.UNITS,1); for ( int i=0; i controls= new LinkedHashMap(); if ( scale!=1.0 ) { controls.put( "scale", String.valueOf(scale) ); } return Renderer.formatControl(controls); } }