Examples of JRThermometerPlot


Examples of net.sf.jasperreports.charts.JRThermometerPlot

   * limitations.  They always have a maximum of three ranges, and the colors of those
   * ranges seems to be fixed.
   */
  protected JFreeChart createThermometerChart() throws JRException
  {
    JRThermometerPlot jrPlot = (JRThermometerPlot)getPlot();

    // Create the plot that will hold the thermometer.
    ThermometerPlot chartPlot = new ThermometerPlot((ValueDataset)getDataset());

    Range range = convertRange(jrPlot.getDataRange());

    // Set the boundary of the thermomoter
    chartPlot.setLowerBound(range.getLowerBound());
    chartPlot.setUpperBound(range.getUpperBound());

    // Units can only be Fahrenheit, Celsius or none, so turn off for now.
    chartPlot.setUnits(ThermometerPlot.UNITS_NONE);

    // Set the color of the mercury.  Only used when the value is outside of
    // any defined ranges.
    Color color = jrPlot.getMercuryColor();
    if (color != null)
    {
      chartPlot.setMercuryPaint(color);
      chartPlot.setUseSubrangePaint(false);
    }

    // Set the formatting of the value display
    JRValueDisplay display = jrPlot.getValueDisplay();
    if (display != null)
    {
      if (display.getColor() != null)
      {
        chartPlot.setValuePaint(display.getColor());
      }
      if (display.getMask() != null)
      {
        chartPlot.setValueFormat(new DecimalFormat(display.getMask()));
      }
      if (display.getFont() != null)
      {
        chartPlot.setValueFont(JRFontUtil.getAwtFont(display.getFont(), getLocale()));
      }
    }

    // Set the location of where the value is displayed
    switch (jrPlot.getValueLocationValue())
    {
      case NONE:
       chartPlot.setValueLocation(ThermometerPlot.NONE);
       break;
      case LEFT:
       chartPlot.setValueLocation(ThermometerPlot.LEFT);
       break;
      case RIGHT:
       chartPlot.setValueLocation(ThermometerPlot.RIGHT);
       break;
      case BULB:
      default:
       chartPlot.setValueLocation(ThermometerPlot.BULB);
       break;
    }

    // Define the three ranges
    range = convertRange(jrPlot.getLowRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(2, range.getLowerBound(), range.getUpperBound());
    }

    range = convertRange(jrPlot.getMediumRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(1, range.getLowerBound(), range.getUpperBound());
    }

    range = convertRange(jrPlot.getHighRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(0, range.getLowerBound(), range.getUpperBound());
    }

View Full Code Here

Examples of net.sf.jasperreports.charts.JRThermometerPlot

   * @param evaluation current expression evaluation phase
   * @throws JRException
   */
  protected JFreeChart createThermometerChart() throws JRException
  {
    JRThermometerPlot jrPlot = (JRThermometerPlot)getPlot();

    // Create the plot that will hold the thermometer.
    ThermometerPlot chartPlot = new ThermometerPlot((ValueDataset)getDataset());

    Range range = convertRange(jrPlot.getDataRange());

    // Set the boundary of the thermomoter
    chartPlot.setLowerBound(range.getLowerBound());
    chartPlot.setUpperBound(range.getUpperBound());

    // Units can only be Fahrenheit, Celsius or none, so turn off for now.
    chartPlot.setUnits(ThermometerPlot.UNITS_NONE);

    // Set the color of the mercury.  Only used when the value is outside of
    // any defined ranges.
    Color color = jrPlot.getMercuryColor();
    if (color != null)
    {
      chartPlot.setMercuryPaint(color);
      chartPlot.setUseSubrangePaint(false);
    }

    // Set the formatting of the value display
    JRValueDisplay display = jrPlot.getValueDisplay();
    if (display != null)
    {
      if (display.getColor() != null)
      {
        chartPlot.setValuePaint(display.getColor());
      }
      if (display.getMask() != null)
      {
        chartPlot.setValueFormat(new DecimalFormat(display.getMask()));
      }
      if (display.getFont() != null)
      {
//        chartPlot.setValueFont(JRFontUtil.getAwtFont(display.getFont()));
      }
    }

    // Set the location of where the value is displayed
    ValueLocationEnum valueLocation = jrPlot.getValueLocationValue();
    switch (valueLocation)
    {
      case NONE:
       chartPlot.setValueLocation(ThermometerPlot.NONE);
       break;
      case LEFT:
       chartPlot.setValueLocation(ThermometerPlot.LEFT);
       break;
      case RIGHT:
       chartPlot.setValueLocation(ThermometerPlot.RIGHT);
       break;
      case BULB:
      default:
       chartPlot.setValueLocation(ThermometerPlot.BULB);
       break;
    }

    // Define the three ranges
    range = convertRange(jrPlot.getLowRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(2, range.getLowerBound(), range.getUpperBound());
    }

    range = convertRange(jrPlot.getMediumRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(1, range.getLowerBound(), range.getUpperBound());
    }

    range = convertRange(jrPlot.getHighRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(0, range.getLowerBound(), range.getUpperBound());
    }

View Full Code Here

Examples of net.sf.jasperreports.charts.JRThermometerPlot

  /**
   *
   */
  protected JFreeChart createThermometerChart() throws JRException
  {
    JRThermometerPlot jrPlot = (JRThermometerPlot)getPlot();

    // Create the plot that will hold the thermometer.
    ThermometerPlot chartPlot = new ThermometerPlot((ValueDataset)getDataset());
    // Build a chart around this plot
    JFreeChart jfreeChart = new JFreeChart(chartPlot);

    // Set the generic options
    configureChart(jfreeChart, getPlot());
    jfreeChart.setBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
    jfreeChart.setBorderVisible(false);

    Range range = convertRange(jrPlot.getDataRange());

    if(range != null)
    {
      // Set the boundary of the thermomoter
      chartPlot.setLowerBound(range.getLowerBound());
      chartPlot.setUpperBound(range.getUpperBound());
    }
    chartPlot.setGap(0);

    // Units can only be Fahrenheit, Celsius or none, so turn off for now.
    chartPlot.setUnits(ThermometerPlot.UNITS_NONE);

    // Set the color of the mercury.  Only used when the value is outside of
    // any defined ranges.
    List seriesPaints = (List)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS);
   
    Paint paint = jrPlot.getMercuryColor();
    if(paint != null)
    {
      chartPlot.setUseSubrangePaint(false);
    }
    else
    {
      //it has no effect, but is kept for backward compatibility reasons
      paint = (Paint)seriesPaints.get(0);
    }
   
    chartPlot.setMercuryPaint(paint);

    chartPlot.setThermometerPaint(THERMOMETER_COLOR);
    chartPlot.setThermometerStroke(new BasicStroke(2f));
    chartPlot.setOutlineVisible(false);
    chartPlot.setValueFont(chartPlot.getValueFont().deriveFont(Font.BOLD));

    // Set the formatting of the value display
    JRValueDisplay display = jrPlot.getValueDisplay();
    if (display != null)
    {
      if (display.getColor() != null)
      {
        chartPlot.setValuePaint(display.getColor());
      }
      if (display.getMask() != null)
      {
        chartPlot.setValueFormat(new DecimalFormat(display.getMask()));
      }
      if (display.getFont() != null)
      {
//        chartPlot.setValueFont(JRFontUtil.getAwtFont(display.getFont()).deriveFont(Font.BOLD));
      }
    }

    // Set the location of where the value is displayed
    // Set the location of where the value is displayed
    ValueLocationEnum valueLocation = jrPlot.getValueLocationValue();
    switch (valueLocation)
    {
      case NONE:
       chartPlot.setValueLocation(ThermometerPlot.NONE);
       break;
      case LEFT:
       chartPlot.setValueLocation(ThermometerPlot.LEFT);
       break;
      case RIGHT:
       chartPlot.setValueLocation(ThermometerPlot.RIGHT);
       break;
      case BULB:
      default:
       chartPlot.setValueLocation(ThermometerPlot.BULB);
       break;
    }

    // Define the three ranges
    range = convertRange(jrPlot.getLowRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(2, range.getLowerBound(), range.getUpperBound());
    }

    range = convertRange(jrPlot.getMediumRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(1, range.getLowerBound(), range.getUpperBound());
    }

    range = convertRange(jrPlot.getHighRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(0, range.getLowerBound(), range.getUpperBound());
    }

View Full Code Here

Examples of net.sf.jasperreports.charts.JRThermometerPlot

   * @param evaluation current expression evaluation phase
   * @throws JRException
   */
  protected JFreeChart createThermometerChart() throws JRException
  {
    JRThermometerPlot jrPlot = (JRThermometerPlot)getPlot();

    // Create the plot that will hold the thermometer.
    ThermometerPlot chartPlot = new ThermometerPlot((ValueDataset)getDataset());

    Range range = convertRange(jrPlot.getDataRange());

    // Set the boundary of the thermomoter
    chartPlot.setLowerBound(range.getLowerBound());
    chartPlot.setUpperBound(range.getUpperBound());

    // Units can only be Fahrenheit, Celsius or none, so turn off for now.
    chartPlot.setUnits(ThermometerPlot.UNITS_NONE);

    // Set the color of the mercury.  Only used when the value is outside of
    // any defined ranges.
    Color color = jrPlot.getMercuryColor();
    if (color != null)
    {
      chartPlot.setMercuryPaint(color);
      chartPlot.setUseSubrangePaint(false);
    }

    // Set the formatting of the value display
    JRValueDisplay display = jrPlot.getValueDisplay();
    if (display != null)
    {
      if (display.getColor() != null)
      {
        chartPlot.setValuePaint(display.getColor());
      }
      if (display.getMask() != null)
      {
        chartPlot.setValueFormat(new DecimalFormat(display.getMask()));
      }
      if (display.getFont() != null)
      {
//        chartPlot.setValueFont(JRFontUtil.getAwtFont(display.getFont()));
      }
    }

    // Set the location of where the value is displayed
    ValueLocationEnum valueLocation = jrPlot.getValueLocationValue();
    switch (valueLocation)
    {
      case NONE:
       chartPlot.setValueLocation(ThermometerPlot.NONE);
       break;
      case LEFT:
       chartPlot.setValueLocation(ThermometerPlot.LEFT);
       break;
      case RIGHT:
       chartPlot.setValueLocation(ThermometerPlot.RIGHT);
       break;
      case BULB:
      default:
       chartPlot.setValueLocation(ThermometerPlot.BULB);
       break;
    }

    // Define the three ranges
    range = convertRange(jrPlot.getLowRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(2, range.getLowerBound(), range.getUpperBound());
    }

    range = convertRange(jrPlot.getMediumRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(1, range.getLowerBound(), range.getUpperBound());
    }

    range = convertRange(jrPlot.getHighRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(0, range.getLowerBound(), range.getUpperBound());
    }

View Full Code Here

Examples of net.sf.jasperreports.charts.JRThermometerPlot

    if(chart != null)
    {
      write( "JRDesignChart " + chartName + " = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_THERMOMETER);\n");
      writeChart( chart, chartName);
      writeValueDataset( (JRValueDataset) chart.getDataset(), chartName, "ValueDataset");
      JRThermometerPlot plot = (JRThermometerPlot) chart.getPlot();
      if(plot != null)
      {
        String plotName = chartName + "ThermometerPlot";
        write( "JRDesignThermometerPlot " + plotName + " = (JRDesignThermometerPlot)" + chartName + ".getPlot();\n");
        write( plotName + ".setValueLocation({0});\n", plot.getValueLocationValue());
        write( plotName + ".setMercuryColor({0});\n", plot.getMercuryColor());
        writePlot( plot, plotName);
        writeValueDisplay( plot.getValueDisplay(), plotName);
        writeDataRange( plot.getDataRange(), plotName, "DataRange");

        if (plot.getLowRange() != null)
        {
          writeDataRange( plot.getLowRange(), plotName, "LowRange");
        }

        if (plot.getMediumRange() != null)
        {
          writeDataRange( plot.getMediumRange(), plotName, "MediumRange");
        }

        if (plot.getHighRange() != null)
        {
          writeDataRange( plot.getHighRange(), plotName, "HighRange");
        }
        flush();
       
      }
      flush();
View Full Code Here

Examples of net.sf.jasperreports.charts.JRThermometerPlot

    writeChart(chart);
    writeValueDataset((JRValueDataset) chart.getDataset());

    // write plot
    JRThermometerPlot plot = (JRThermometerPlot) chart.getPlot();

    writer.startElement(JRThermometerPlotFactory.ELEMENT_thermometerPlot, getNamespace());

    writer.addAttribute(JRThermometerPlotFactory.ATTRIBUTE_valueLocation, plot.getValueLocationValue());
    writer.addAttribute(JRThermometerPlotFactory.ATTRIBUTE_mercuryColor, plot.getMercuryColor());

    writePlot(chart.getPlot());

    writeValueDisplay(plot.getValueDisplay());
    writeDataRange(plot.getDataRange());

    if (plot.getLowRange() != null)
    {
      writer.startElement(JRThermometerPlotFactory.ELEMENT_lowRange);
      writeDataRange(plot.getLowRange());
      writer.closeElement();
    }

    if (plot.getMediumRange() != null)
    {
      writer.startElement(JRThermometerPlotFactory.ELEMENT_mediumRange);
      writeDataRange(plot.getMediumRange());
      writer.closeElement();
    }

    if (plot.getHighRange() != null)
    {
      writer.startElement(JRThermometerPlotFactory.ELEMENT_highRange);
      writeDataRange(plot.getHighRange());
      writer.closeElement();
    }


    writer.closeElement();
View Full Code Here

Examples of net.sf.jasperreports.charts.JRThermometerPlot

   */
  public JRBaseThermometerPlot(JRChartPlot plot, JRChart chart)
  {
    super(plot, chart);
   
    JRThermometerPlot thermoPlot = plot instanceof JRThermometerPlot ? (JRThermometerPlot)plot : null;
    if (thermoPlot == null)
    {
      valueDisplay = new JRBaseValueDisplay(null, chart);
    }
    else
    {
      valueDisplay = new JRBaseValueDisplay(thermoPlot.getValueDisplay(), chart);
    }
  }
View Full Code Here

Examples of net.sf.jasperreports.charts.JRThermometerPlot

  /**
   *
   */
  protected JFreeChart createThermometerChart() throws JRException
  {
    JRThermometerPlot jrPlot = (JRThermometerPlot)getPlot();

    // Create the plot that will hold the thermometer.
    ThermometerPlot chartPlot = new ThermometerPlot((ValueDataset)getDataset());
    // Build a chart around this plot
    JFreeChart jfreeChart = new JFreeChart(chartPlot);

    // Set the generic options
    configureChart(jfreeChart, getPlot());
    jfreeChart.setBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
    jfreeChart.setBorderVisible(false);

    Range range = convertRange(jrPlot.getDataRange());

    if(range != null)
    {
      // Set the boundary of the thermomoter
      chartPlot.setLowerBound(range.getLowerBound());
      chartPlot.setUpperBound(range.getUpperBound());
    }
    chartPlot.setGap(0);

    // Units can only be Fahrenheit, Celsius or none, so turn off for now.
    chartPlot.setUnits(ThermometerPlot.UNITS_NONE);

    // Set the color of the mercury.  Only used when the value is outside of
    // any defined ranges.
    Paint paint = jrPlot.getMercuryColor();
    if(paint != null)
    {
      chartPlot.setUseSubrangePaint(false);
    }
    else
    {
      //it has no effect, but is kept for backward compatibility reasons
      paint = (Paint)ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(0);
    }
   
    chartPlot.setMercuryPaint(paint);

    chartPlot.setThermometerPaint(THERMOMETER_COLOR);
    chartPlot.setThermometerStroke(new BasicStroke(2f));
    chartPlot.setOutlineVisible(false);
    chartPlot.setValueFont(chartPlot.getValueFont().deriveFont(Font.BOLD));



    // Set the formatting of the value display
    JRValueDisplay display = jrPlot.getValueDisplay();
    if (display != null)
    {
      if (display.getColor() != null)
      {
        chartPlot.setValuePaint(display.getColor());
      }
      if (display.getMask() != null)
      {
        chartPlot.setValueFormat(new DecimalFormat(display.getMask()));
      }
      if (display.getFont() != null)
      {
//        chartPlot.setValueFont(JRFontUtil.getAwtFont(display.getFont()).deriveFont(Font.BOLD));
      }
    }

    // Set the location of where the value is displayed
    ValueLocationEnum valueLocation = jrPlot.getValueLocationValue();
    switch (valueLocation)
    {
      case NONE:
       chartPlot.setValueLocation(ThermometerPlot.NONE);
       break;
      case LEFT:
       chartPlot.setValueLocation(ThermometerPlot.LEFT);
       break;
      case RIGHT:
       chartPlot.setValueLocation(ThermometerPlot.RIGHT);
       break;
      case BULB:
      default:
       chartPlot.setValueLocation(ThermometerPlot.BULB);
       break;
    }

    // Define the three ranges
    range = convertRange(jrPlot.getLowRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(2, range.getLowerBound(), range.getUpperBound());
    }

    range = convertRange(jrPlot.getMediumRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(1, range.getLowerBound(), range.getUpperBound());
    }

    range = convertRange(jrPlot.getHighRange());
    if (range != null)
    {
      chartPlot.setSubrangeInfo(0, range.getLowerBound(), range.getUpperBound());
    }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.