org.jfree.util.UnitType Java Examples

The following examples show how to use org.jfree.util.UnitType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ThermometerPlot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new thermometer plot, using default attributes where necessary.
 *
 * @param dataset  the data set.
 */
public ThermometerPlot(ValueDataset dataset) {

    super();

    this.padding = new RectangleInsets(UnitType.RELATIVE, 0.05, 0.05, 0.05,
            0.05);
    this.dataset = dataset;
    if (dataset != null) {
        dataset.addChangeListener(this);
    }
    NumberAxis axis = new NumberAxis(null);
    axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    axis.setAxisLineVisible(false);
    axis.setPlot(this);
    axis.addChangeListener(this);
    this.rangeAxis = axis;
    setAxisRange();
}
 
Example #2
Source File: RectangleInsetsTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Serialize an instance, restore it, and check for identity.
 */
public void testSerialization() {
    final RectangleInsets i1 = new RectangleInsets(
        UnitType.ABSOLUTE, 1.0, 2.0, 3.0, 4.0
    );
    RectangleInsets i2 = null;
    try {
        final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        final ObjectOutput out = new ObjectOutputStream(buffer);
        out.writeObject(i1);
        out.close();

        final ObjectInput in = new ObjectInputStream(
            new ByteArrayInputStream(buffer.toByteArray())
        );
        i2 = (RectangleInsets) in.readObject();
        in.close();
    }
    catch (Exception e) {
        System.out.println(e.toString());
    }
    assertTrue(i1.equals(i2)); 
}
 
Example #3
Source File: GenericChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException
{	
	Integer defaultBaseFontSize = (Integer)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.BASEFONT_SIZE);
	
	setChartBackground(jfreeChart);
	setChartTitle(jfreeChart, defaultBaseFontSize);
	setChartSubtitles(jfreeChart, defaultBaseFontSize);
	setChartLegend(jfreeChart, defaultBaseFontSize);
	setChartBorder(jfreeChart);
	
	Boolean isAntiAlias = (Boolean)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.CHART_ANTI_ALIAS);
	if (isAntiAlias != null)
		jfreeChart.setAntiAlias(isAntiAlias);
	
	Double padding = (Double)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.CHART_PADDING);
	UnitType unitType = (UnitType)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.UNIT_TYPE);
	if (padding != null && unitType != null)
	{
		jfreeChart.setPadding(new RectangleInsets(unitType, padding, padding, padding, padding));
	}
	configurePlot(jfreeChart.getPlot(), jrPlot);
}
 
Example #4
Source File: BlockBorderTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Confirm that the equals() method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    BlockBorder b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0,
            4.0), Color.red);
    BlockBorder b2 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0,
            4.0), Color.red);
    assertTrue(b1.equals(b2));
    assertTrue(b2.equals(b2));

    // insets
    b1 = new BlockBorder(new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0,
            3.0, 4.0), Color.red);
    assertFalse(b1.equals(b2));
    b2 = new BlockBorder(new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0,
            3.0, 4.0), Color.red);
    assertTrue(b1.equals(b2));

    // paint
    b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0),
            Color.blue);
    assertFalse(b1.equals(b2));
    b2 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0),
            Color.blue);
    assertTrue(b1.equals(b2));
}
 
Example #5
Source File: ThermometerPlot.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new thermometer plot, using default attributes where necessary.
 *
 * @param dataset  the data set.
 */
public ThermometerPlot(ValueDataset dataset) {

    super();

    this.padding = new RectangleInsets(UnitType.RELATIVE, 0.05, 0.05, 0.05,
            0.05);
    this.dataset = dataset;
    if (dataset != null) {
        dataset.addChangeListener(this);
    }
    NumberAxis axis = new NumberAxis(null);
    axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    axis.setAxisLineVisible(false);
    axis.setPlot(this);
    axis.addChangeListener(this);
    this.rangeAxis = axis;
    setAxisRange();
}
 
Example #6
Source File: BlockBorderTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Confirm that the equals() method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    BlockBorder b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0,
            4.0), Color.red);
    BlockBorder b2 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0,
            4.0), Color.red);
    assertTrue(b1.equals(b2));
    assertTrue(b2.equals(b2));

    // insets
    b1 = new BlockBorder(new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0,
            3.0, 4.0), Color.red);
    assertFalse(b1.equals(b2));
    b2 = new BlockBorder(new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0,
            3.0, 4.0), Color.red);
    assertTrue(b1.equals(b2));

    // paint
    b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0),
            Color.blue);
    assertFalse(b1.equals(b2));
    b2 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0),
            Color.blue);
    assertTrue(b1.equals(b2));
}
 
Example #7
Source File: ThermometerPlot.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new thermometer plot, using default attributes where necessary.
 *
 * @param dataset  the data set.
 */
public ThermometerPlot(ValueDataset dataset) {

    super();

    this.padding = new RectangleInsets(UnitType.RELATIVE, 0.05, 0.05, 0.05,
            0.05);
    this.dataset = dataset;
    if (dataset != null) {
        dataset.addChangeListener(this);
    }
    NumberAxis axis = new NumberAxis(null);
    axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    axis.setAxisLineVisible(false);
    axis.setPlot(this);
    axis.addChangeListener(this);
    this.rangeAxis = axis;
    setAxisRange();
}
 
Example #8
Source File: ThermometerPlot.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a new thermometer plot, using default attributes where necessary.
 *
 * @param dataset  the data set.
 */
public ThermometerPlot(ValueDataset dataset) {

    super();

    this.padding = new RectangleInsets(UnitType.RELATIVE, 0.05, 0.05, 0.05,
            0.05);
    this.dataset = dataset;
    if (dataset != null) {
        dataset.addChangeListener(this);
    }
    NumberAxis axis = new NumberAxis(null);
    axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    axis.setAxisLineVisible(false);
    axis.setPlot(this);
    axis.addChangeListener(this);
    this.rangeAxis = axis;
    setAxisRange();
}
 
Example #9
Source File: BlockBorderTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Confirm that the equals() method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    BlockBorder b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0,
            4.0), Color.red);
    BlockBorder b2 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0,
            4.0), Color.red);
    assertTrue(b1.equals(b2));
    assertTrue(b2.equals(b2));

    // insets
    b1 = new BlockBorder(new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0,
            3.0, 4.0), Color.red);
    assertFalse(b1.equals(b2));
    b2 = new BlockBorder(new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0,
            3.0, 4.0), Color.red);
    assertTrue(b1.equals(b2));

    // paint
    b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0),
            Color.blue);
    assertFalse(b1.equals(b2));
    b2 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0),
            Color.blue);
    assertTrue(b1.equals(b2));
}
 
Example #10
Source File: ThermometerPlot.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new thermometer plot, using default attributes where necessary.
 *
 * @param dataset  the data set.
 */
public ThermometerPlot(ValueDataset dataset) {

    super();

    this.padding = new RectangleInsets(UnitType.RELATIVE, 0.05, 0.05, 0.05, 
            0.05);
    this.dataset = dataset;
    if (dataset != null) {
        dataset.addChangeListener(this);
    }
    NumberAxis axis = new NumberAxis(null);
    axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    axis.setAxisLineVisible(false);

    setRangeAxis(axis);
    setAxisRange();
}
 
Example #11
Source File: ThermometerPlot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new thermometer plot, using default attributes where necessary.
 *
 * @param dataset  the data set.
 */
public ThermometerPlot(ValueDataset dataset) {

    super();

    this.padding = new RectangleInsets(UnitType.RELATIVE, 0.05, 0.05, 0.05,
            0.05);
    this.dataset = dataset;
    if (dataset != null) {
        dataset.addChangeListener(this);
    }
    NumberAxis axis = new NumberAxis(null);
    axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    axis.setAxisLineVisible(false);
    axis.setPlot(this);
    axis.addChangeListener(this);
    this.rangeAxis = axis;
    setAxisRange();
}
 
Example #12
Source File: LineChartBuilder.java    From nmonvisualizer with Apache License 2.0 6 votes vote down vote up
private void formatRenderer(int index) {
    // show filled markers at each data point
    StandardXYItemRenderer renderer = (StandardXYItemRenderer) chart.getXYPlot().getRenderer(index);

    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);

    // if no data for more than 1 granularity's time period, do not draw a connecting line
    renderer.setPlotDiscontinuous(true);
    renderer.setGapThresholdType(UnitType.ABSOLUTE);

    recalculateGapThreshold(index);

    renderer.setBaseToolTipGenerator(tooltipGenerator);

    if (!definition.showDataPoints()) {
        renderer.setAutoPopulateSeriesShape(false);
        renderer.setBaseShape(new java.awt.Rectangle(), false);
    }
}
 
Example #13
Source File: BlockBorderTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Confirm that the equals() method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    BlockBorder b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0,
            4.0), Color.red);
    BlockBorder b2 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0,
            4.0), Color.red);
    assertTrue(b1.equals(b2));
    assertTrue(b2.equals(b2));

    // insets
    b1 = new BlockBorder(new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0,
            3.0, 4.0), Color.red);
    assertFalse(b1.equals(b2));
    b2 = new BlockBorder(new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0,
            3.0, 4.0), Color.red);
    assertTrue(b1.equals(b2));

    // paint
    b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0),
            Color.blue);
    assertFalse(b1.equals(b2));
    b2 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0),
            Color.blue);
    assertTrue(b1.equals(b2));
}
 
Example #14
Source File: BlockBorderTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Confirm that the equals() method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    BlockBorder b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0,
            4.0), Color.red);
    BlockBorder b2 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0,
            4.0), Color.red);
    assertTrue(b1.equals(b2));
    assertTrue(b2.equals(b2));

    // insets
    b1 = new BlockBorder(new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0,
            3.0, 4.0), Color.red);
    assertFalse(b1.equals(b2));
    b2 = new BlockBorder(new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0,
            3.0, 4.0), Color.red);
    assertTrue(b1.equals(b2));

    // paint
    b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0),
            Color.blue);
    assertFalse(b1.equals(b2));
    b2 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0),
            Color.blue);
    assertTrue(b1.equals(b2));
}
 
Example #15
Source File: ThermometerPlot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new thermometer plot, using default attributes where necessary.
 *
 * @param dataset  the data set.
 */
public ThermometerPlot(ValueDataset dataset) {

    super();

    this.padding = new RectangleInsets(UnitType.RELATIVE, 0.05, 0.05, 0.05,
            0.05);
    this.dataset = dataset;
    if (dataset != null) {
        dataset.addChangeListener(this);
    }
    NumberAxis axis = new NumberAxis(null);
    axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    axis.setAxisLineVisible(false);
    axis.setPlot(this);
    axis.addChangeListener(this);
    this.rangeAxis = axis;
    setAxisRange();
}
 
Example #16
Source File: Chart.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private JFreeChart buildDifferenceChart(TimeSeriesCollection dataset, String title) {
  // Creat the chart
  JFreeChart chart = ChartFactory.createTimeSeriesChart(title, "Date", "Price", dataset, true, // legend
      true, // tool tips
      false // URLs
  );
  chart.setBackgroundPaint(Color.white);

  XYPlot plot = chart.getXYPlot();
  plot.setRenderer(new XYDifferenceRenderer(new Color(112, 128, 222), new Color(112, 128, 222), false));
  plot.setBackgroundPaint(Color.white);
  plot.setDomainGridlinePaint(Color.white);
  plot.setRangeGridlinePaint(Color.white);
  plot.setAxisOffset(new RectangleInsets(UnitType.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));

  ValueAxis domainAxis = new DateAxis("Date");
  domainAxis.setLowerMargin(0.0);
  domainAxis.setUpperMargin(0.0);
  plot.setDomainAxis(domainAxis);
  plot.setForegroundAlpha(0.5f);

  return chart;
}
 
Example #17
Source File: Chart.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public Chart(String title, String timeAxis, String valueAxis, TimeSeries data) {
  try {
    // Build the datasets
    dataset.addSeries(data);

    // Create the chart
    JFreeChart chart = ChartFactory.createTimeSeriesChart(title, timeAxis, valueAxis, dataset, true, true, false);

    // Setup the appearance of the chart
    chart.setBackgroundPaint(Color.white);
    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(UnitType.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    // Tell the chart how we would like dates to read
    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("EEE HH"));

    this.add(new ChartPanel(chart));
  } catch (Exception e) {
    e.printStackTrace();
  }
}
 
Example #18
Source File: RectangleInsets.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the bottom margin.
 * 
 * @param height  the height of the base rectangle.
 * 
 * @return The bottom margin (in Java2D units).
 */
public double calculateBottomInset(final double height) {
    double result = this.bottom;
    if (this.unitType == UnitType.RELATIVE) {
        result = (this.bottom * height);
    }
    return result;
}
 
Example #19
Source File: RectangleInsets.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the top margin.
 * 
 * @param height  the height of the base rectangle.
 * 
 * @return The top margin (in Java2D units).
 */
public double calculateTopOutset(final double height) {
    double result = this.top;
    if (this.unitType == UnitType.RELATIVE) {
        result = (height / (1 - this.top - this.bottom)) * this.top;
    }
    return result;
}
 
Example #20
Source File: RectangleInsets.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the top margin.
 * 
 * @param height  the height of the base rectangle.
 * 
 * @return The top margin (in Java2D units).
 */
public double calculateTopInset(final double height) {
    double result = this.top;
    if (this.unitType == UnitType.RELATIVE) {
        result = (this.top * height);
    }
    return result;
}
 
Example #21
Source File: RectangleInsets.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new instance.
 * 
 * @param unitType  absolute or relative units (<code>null</code> not 
 *                  permitted).
 * @param top  the top insets.
 * @param left  the left insets.
 * @param bottom  the bottom insets.
 * @param right  the right insets.
 */
public RectangleInsets(final UnitType unitType,
                       final double top, final double left, 
                       final double bottom, final double right) {
    if (unitType == null) {
        throw new IllegalArgumentException("Null 'unitType' argument.");
    }
    this.unitType = unitType;
    this.top = top;
    this.bottom = bottom;
    this.left = left;
    this.right = right;
}
 
Example #22
Source File: RectangleInsets.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the left margin.
 * 
 * @param width  the width of the base rectangle.
 * 
 * @return The left margin (in Java2D units).
 */
public double calculateLeftInset(final double width) {
    double result = this.left;
    if (this.unitType == UnitType.RELATIVE) {
        result = (this.left * width);
    }
    return result;
}
 
Example #23
Source File: RectangleInsets.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the right margin.
 * 
 * @param width  the width of the base rectangle.
 * 
 * @return The right margin (in Java2D units).
 */
public double calculateRightInset(final double width) {
    double result = this.right;
    if (this.unitType == UnitType.RELATIVE) {
        result = (this.right * width);
    }
    return result;
}
 
Example #24
Source File: RectangleInsets.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the right margin.
 * 
 * @param width  the width of the base rectangle.
 * 
 * @return The right margin (in Java2D units).
 */
public double calculateRightOutset(final double width) {
    double result = this.right;
    if (this.unitType == UnitType.RELATIVE) {
        result = (width / (1 - this.left - this.right)) * this.right;
    }
    return result;
}
 
Example #25
Source File: RectangleInsetsTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Test the equals() method.
 */
public void testEquals() {
    RectangleInsets i1 = new RectangleInsets(
        UnitType.ABSOLUTE, 1.0, 2.0, 3.0, 4.0
    );
    RectangleInsets i2 = new RectangleInsets(
        UnitType.ABSOLUTE, 1.0, 2.0, 3.0, 4.0
    );
    assertTrue(i1.equals(i2));
    assertTrue(i2.equals(i1));
    
    i1 = new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0, 3.0, 4.0);
    assertFalse(i1.equals(i2));
    i2 = new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0, 3.0, 4.0);
    assertTrue(i1.equals(i2));

    i1 = new RectangleInsets(UnitType.RELATIVE, 0.0, 2.0, 3.0, 4.0);
    assertFalse(i1.equals(i2));
    i2 = new RectangleInsets(UnitType.RELATIVE, 0.0, 2.0, 3.0, 4.0);
    assertTrue(i1.equals(i2));
    
    i1 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 3.0, 4.0);
    assertFalse(i1.equals(i2));
    i2 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 3.0, 4.0);
    assertTrue(i1.equals(i2));
    
    i1 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 0.0, 4.0);
    assertFalse(i1.equals(i2));
    i2 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 0.0, 4.0);
    assertTrue(i1.equals(i2));
    
    i1 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 0.0, 0.0);
    assertFalse(i1.equals(i2));
    i2 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 0.0, 0.0);
    assertTrue(i1.equals(i2));
    
}
 
Example #26
Source File: Chart.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private JFreeChart buildChart(TimeSeriesCollection dataset, String title, boolean endPoints) {
  // Create the chart
  JFreeChart chart = ChartFactory.createTimeSeriesChart(title, "Date", "Price", dataset, true, true, false);

  // Display each series in the chart with its point shape in the legend
  chart.getLegend();
  // sl.setDisplaySeriesShapes(true);

  // Setup the appearance of the chart
  chart.setBackgroundPaint(Color.white);
  XYPlot plot = chart.getXYPlot();
  plot.setBackgroundPaint(Color.lightGray);
  plot.setDomainGridlinePaint(Color.white);
  plot.setRangeGridlinePaint(Color.white);
  plot.setAxisOffset(new RectangleInsets(UnitType.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
  plot.setDomainCrosshairVisible(true);
  plot.setRangeCrosshairVisible(true);

  // Display data points or just the lines?
  if (endPoints) {
    XYItemRenderer renderer = plot.getRenderer();
    if (renderer instanceof StandardXYItemRenderer) {
      StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer;
      // rr.setPlotShapes(true);
      rr.setShapesFilled(true);
      rr.setItemLabelsVisible(true);
    }
  }

  // Tell the chart how we would like dates to read
  DateAxis axis = (DateAxis) plot.getDomainAxis();
  axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
  return chart;
}
 
Example #27
Source File: UnitTypeFieldHandler.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object convertUponGet(Object value)
{
	if (value == null)
	{
		return null;
	}
	return ((UnitType)value).toString();
}
 
Example #28
Source File: UnitTypeFieldHandler.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object convertUponSet(Object value)
{
	if (value == null)
	{
		return null;
	}
	return 
		UnitType.RELATIVE.toString().equals(value) 
		? UnitType.RELATIVE 
		: UnitType.ABSOLUTE.toString().equals(value)
		? UnitType.ABSOLUTE : null;
}
 
Example #29
Source File: StandardXYItemRenderer.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the gap threshold type.
 * 
 * @param thresholdType  the type (<code>null</code> not permitted).
 */
public void setGapThresholdType(UnitType thresholdType) {
    if (thresholdType == null) {
        throw new IllegalArgumentException(
                "Null 'thresholdType' argument.");
    }
    this.gapThresholdType = thresholdType;
    notifyListeners(new RendererChangeEvent(this));
}
 
Example #30
Source File: StandardXYItemRenderer.java    From nmonvisualizer with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the gap threshold type and sends a {@link RendererChangeEvent} to
 * all registered listeners.
 *
 * @param thresholdType  the type (<code>null</code> not permitted).
 *
 * @see #getGapThresholdType()
 */
public void setGapThresholdType(UnitType thresholdType) {
    if (thresholdType == null) {
        throw new IllegalArgumentException(
                "Null 'thresholdType' argument.");
    }
    this.gapThresholdType = thresholdType;
    fireChangeEvent();
}