org.jfree.chart.labels.XYSeriesLabelGenerator Java Examples

The following examples show how to use org.jfree.chart.labels.XYSeriesLabelGenerator. 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: ReportPage.java    From freeacs with MIT License 4 votes vote down vote up
private void displayReportChartWithImageMap(
    Map<String, Object> root,
    int numberOfColumns,
    int averageLengthPrLegend,
    List<String> aggregation,
    HttpSession session) {
  StringWriter stringWriter = new StringWriter();
  PrintWriter writer = new PrintWriter(stringWriter);

  boolean shouldZoom = true;

  switch (reportType) {
    case JOB:
    case UNIT:
      shouldZoom = false;
      break;
    default:
      break;
  }

  String clickablePointUrl = "";
  if (shouldZoom || periodType.getSelected().isLongerThan(PeriodType.HOUR)) {
    clickablePointUrl =
        generateClickablePointUrl(
            periodType.getSelected(),
            reportType.getName(),
            method.getSelected(),
            optionalmethod.getSelected());
  }

  XYPlot plot = (XYPlot) chart.getPlot();
  XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
  XYURLGenerator urls = new ReportURLGenerator(clickablePointUrl, chart, aggregation);
  renderer.setURLGenerator(urls);
  XYSeriesLabelGenerator slg =
      new CustomXYSeriesLabelGenerator("javascript:xAPS.report.updateReport(%d);");
  renderer.setLegendItemURLGenerator(slg);
  renderer.setDefaultShapesVisible(true);
  renderer.setDrawOutlines(true);
  renderer.setUseFillPaint(true);
  renderer.setDefaultFillPaint(Color.white);

  try {
    ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
    ByteArrayOutputStream image = new ByteArrayOutputStream();

    int chartWidth = 700 + 10 * averageLengthPrLegend * numberOfColumns + 35 * numberOfColumns;

    ChartUtils.writeChartAsPNG(image, chart, chartWidth, 400, info);

    session.setAttribute("JFreeChartPNG" + reportType.getName(), image.toByteArray());

    ImageMapUtils.writeImageMap(
        writer,
        "chart" + reportType.getName(),
        info,
        arg0 -> " title=\"" + arg0 + "\" alt=\"" + arg0 + "\"",
        arg0 -> " href=\"" + arg0 + "\"");

    writer.println(
        "<img src=\""
            + Page.REPORT.getUrl()
            + "&type="
            + reportType.getName()
            + "&image=true&d="
            + new Date().getTime()
            + "\" border=\"0\" usemap=\"#chart"
            + reportType.getName()
            + "\" id=\"ImageMapImg\" alt=\"ReportImage\"/>");
    writer.close();

    root.put("imagemap", stringWriter.toString());
  } catch (IOException e) {
    e.printStackTrace();
  }
}
 
Example #2
Source File: AbstractXYItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the legend item label generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> not permitted).
 *
 * @see #getLegendItemLabelGenerator()
 */
@Override
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator) {
    ParamChecks.nullNotPermitted(generator, "generator");
    this.legendItemLabelGenerator = generator;
    fireChangeEvent();
}
 
Example #3
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the legend item label generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> not permitted).
 *
 * @see #getLegendItemLabelGenerator()
 */
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator) {
    if (generator == null) {
        throw new IllegalArgumentException("Null 'generator' argument.");
    }
    this.legendItemLabelGenerator = generator;
    fireChangeEvent();
}
 
Example #4
Source File: AbstractXYItemRenderer.java    From SIMVA-SoS with Apache License 2.0 3 votes vote down vote up
/**
 * Sets the legend item label generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> not permitted).
 *
 * @see #getLegendItemLabelGenerator()
 */
@Override
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator) {
    ParamChecks.nullNotPermitted(generator, "generator");
    this.legendItemLabelGenerator = generator;
    fireChangeEvent();
}
 
Example #5
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the legend item label generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> not permitted).
 *
 * @see #getLegendItemLabelGenerator()
 */
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator) {
    if (generator == null) {
        throw new IllegalArgumentException("Null 'generator' argument.");
    }
    this.legendItemLabelGenerator = generator;
    fireChangeEvent();
}
 
Example #6
Source File: AbstractXYItemRenderer.java    From ccu-historian with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Sets the legend item label generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> not permitted).
 *
 * @see #getLegendItemLabelGenerator()
 */
@Override
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator) {
    ParamChecks.nullNotPermitted(generator, "generator");
    this.legendItemLabelGenerator = generator;
    fireChangeEvent();
}
 
Example #7
Source File: AbstractXYItemRenderer.java    From openstock with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Sets the legend item label generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> not permitted).
 *
 * @see #getLegendItemLabelGenerator()
 */
@Override
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator) {
    ParamChecks.nullNotPermitted(generator, "generator");
    this.legendItemLabelGenerator = generator;
    fireChangeEvent();
}
 
Example #8
Source File: AbstractXYItemRenderer.java    From opensim-gui with Apache License 2.0 3 votes vote down vote up
/**
 * Sets the legend item label generator and sends a 
 * {@link RendererChangeEvent} to all registered listeners.
 * 
 * @param generator  the generator (<code>null</code> not permitted).
 * 
 * @see #getLegendItemLabelGenerator()
 */
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator) {
    if (generator == null) {
        throw new IllegalArgumentException("Null 'generator' argument.");
    }
    this.legendItemLabelGenerator = generator;
    notifyListeners(new RendererChangeEvent(this));
}
 
Example #9
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the legend item URL generator.
 *
 * @return The URL generator (possibly <code>null</code>).
 *
 * @see #setLegendItemURLGenerator(XYSeriesLabelGenerator)
 */
public XYSeriesLabelGenerator getLegendItemURLGenerator() {
    return this.legendItemURLGenerator;
}
 
Example #10
Source File: XYItemRenderer.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the legend item tool tip generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> permitted).
 *
 * @see #getLegendItemToolTipGenerator()
 * 
 * @since 1.2.0
 */
public void setLegendItemToolTipGenerator(XYSeriesLabelGenerator generator);
 
Example #11
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the legend item URL generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> permitted).
 *
 * @see #getLegendItemURLGenerator()
 */
public void setLegendItemURLGenerator(XYSeriesLabelGenerator generator) {
    this.legendItemURLGenerator = generator;
    fireChangeEvent();
}
 
Example #12
Source File: XYItemRenderer.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the legend item label generator.
 *
 * @return The legend item label generator (never <code>null</code>).
 *
 * @see #setLegendItemLabelGenerator(XYSeriesLabelGenerator)
 */
public XYSeriesLabelGenerator getLegendItemLabelGenerator();
 
Example #13
Source File: XYItemRenderer.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the legend item label generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> not permitted).
 */
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator);
 
Example #14
Source File: XYItemRenderer.java    From opensim-gui with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the legend item label generator.
 * 
 * @param generator  the generator (<code>null</code> not permitted).
 */
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator);
 
Example #15
Source File: AbstractXYItemRenderer.java    From opensim-gui with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the legend item URL generator and sends a 
 * {@link RendererChangeEvent} to all registered listeners.
 * 
 * @param generator  the generator (<code>null</code> permitted).
 * 
 * @see #getLegendItemURLGenerator()
 */
public void setLegendItemURLGenerator(XYSeriesLabelGenerator generator) {
    this.legendItemURLGenerator = generator;
    notifyListeners(new RendererChangeEvent(this));
}
 
Example #16
Source File: AbstractXYItemRenderer.java    From opensim-gui with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the legend item tool tip generator and sends a 
 * {@link RendererChangeEvent} to all registered listeners.
 * 
 * @param generator  the generator (<code>null</code> permitted).
 * 
 * @see #getLegendItemToolTipGenerator()
 */
public void setLegendItemToolTipGenerator(
        XYSeriesLabelGenerator generator) {
    this.legendItemToolTipGenerator = generator;
    notifyListeners(new RendererChangeEvent(this));
}
 
Example #17
Source File: AbstractXYItemRenderer.java    From opensim-gui with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the legend item tool tip generator.
 * 
 * @return The tool tip generator (possibly <code>null</code>).
 * 
 * @see #setLegendItemToolTipGenerator(XYSeriesLabelGenerator)
 */
public XYSeriesLabelGenerator getLegendItemToolTipGenerator() {
    return this.legendItemToolTipGenerator;
}
 
Example #18
Source File: XYItemRenderer.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the legend item tool tip generator.
 *
 * @return The tool tip generator (possibly <code>null</code>).
 *
 * @see #setLegendItemToolTipGenerator(XYSeriesLabelGenerator)
 * 
 * @since 1.2.0
 */
public XYSeriesLabelGenerator getLegendItemToolTipGenerator();
 
Example #19
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the legend item tool tip generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> permitted).
 *
 * @see #getLegendItemToolTipGenerator()
 */
public void setLegendItemToolTipGenerator(
        XYSeriesLabelGenerator generator) {
    this.legendItemToolTipGenerator = generator;
    fireChangeEvent();
}
 
Example #20
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the legend item tool tip generator.
 *
 * @return The tool tip generator (possibly <code>null</code>).
 *
 * @see #setLegendItemToolTipGenerator(XYSeriesLabelGenerator)
 */
public XYSeriesLabelGenerator getLegendItemToolTipGenerator() {
    return this.legendItemToolTipGenerator;
}
 
Example #21
Source File: AbstractXYItemRenderer.java    From openstock with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Returns the legend item label generator.
 *
 * @return The label generator (never <code>null</code>).
 *
 * @see #setLegendItemLabelGenerator(XYSeriesLabelGenerator)
 */
@Override
public XYSeriesLabelGenerator getLegendItemLabelGenerator() {
    return this.legendItemLabelGenerator;
}
 
Example #22
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the legend item label generator.
 *
 * @return The label generator (never <code>null</code>).
 *
 * @see #setLegendItemLabelGenerator(XYSeriesLabelGenerator)
 */
public XYSeriesLabelGenerator getLegendItemLabelGenerator() {
    return this.legendItemLabelGenerator;
}
 
Example #23
Source File: DefaultPolarItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the legend item URL generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> permitted).
 *
 * @see #getLegendItemURLGenerator()
 * @since 1.0.14
 */
public void setLegendItemURLGenerator(XYSeriesLabelGenerator generator) {
    this.legendItemURLGenerator = generator;
    fireChangeEvent();
}
 
Example #24
Source File: DefaultPolarItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the legend item URL generator.
 *
 * @return The URL generator (possibly <code>null</code>).
 *
 * @see #setLegendItemURLGenerator(XYSeriesLabelGenerator)
 * @since 1.0.14
 */
public XYSeriesLabelGenerator getLegendItemURLGenerator() {
    return this.legendItemURLGenerator;
}
 
Example #25
Source File: XYItemRenderer.java    From opensim-gui with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the legend item label generator.
 * 
 * @return The legend item label generator (never <code>null</code>).
 */
public XYSeriesLabelGenerator getLegendItemLabelGenerator();
 
Example #26
Source File: DefaultPolarItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the legend item tool tip generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> permitted).
 *
 * @see #getLegendItemToolTipGenerator()
 * @since 1.0.14
 */
public void setLegendItemToolTipGenerator(
        XYSeriesLabelGenerator generator) {
    this.legendItemToolTipGenerator = generator;
    fireChangeEvent();
}
 
Example #27
Source File: DefaultPolarItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the legend item tool tip generator.
 *
 * @return The tool tip generator (possibly <code>null</code>).
 *
 * @see #setLegendItemToolTipGenerator(XYSeriesLabelGenerator)
 * @since 1.0.14
 */
public XYSeriesLabelGenerator getLegendItemToolTipGenerator() {
    return this.legendItemToolTipGenerator;
}
 
Example #28
Source File: XYItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the legend item label generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> not permitted).
 */
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator);
 
Example #29
Source File: XYItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the legend item label generator.
 *
 * @return The legend item label generator (never <code>null</code>).
 *
 * @see #setLegendItemLabelGenerator(XYSeriesLabelGenerator)
 */
public XYSeriesLabelGenerator getLegendItemLabelGenerator();
 
Example #30
Source File: XYItemRenderer.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the legend item tool tip generator and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param generator  the generator (<code>null</code> permitted).
 *
 * @see #getLegendItemToolTipGenerator()
 *
 * @since 1.2.0
 */
public void setLegendItemToolTipGenerator(XYSeriesLabelGenerator generator);