Class JFreeChartEngine

java.lang.Object
org.zkoss.zkex.zul.impl.JFreeChartEngine
All Implemented Interfaces:
Serializable, org.zkoss.zul.impl.ChartEngine

public class JFreeChartEngine extends Object implements org.zkoss.zul.impl.ChartEngine, Serializable
A chart engine implemented with JFreeChart.

Available in ZK PE and ZK EE.

This is the JFreeChart base chart engine implementation. All chart would support drilldown by providing Area hot spots. Each Area would callback to ChartAreaListener class that application developers can do processing on each area.

Note that useful ChartModel information is put in Area's custom attribute Map so you can retrieve them by calling Area's getAttribute(key) method and use them in drilldown function. Following is the table of keys for different ChartModel.

modelkey
PieModelentity
category
value
CategoryModelentity
series
category
value
XYModelentity
series
x
y
XYZModelentity
since 3.5.0series
x
y
z
HiLoModelentity
series
date
open
high
low
close
volumn

Following is the explanation for each key:

  • entity: entity is used to distinguish the different entities on a chart. It might be TITLE, CATEGORY, DATA, LEGEND. The most important entity might be DATA entity where the real chart data point is located. For example, the DATA Area is each slice in a Pie chart.
  • category: category name of the associated data.
  • value: value of the associated data.
  • series: series name of the associated data.
  • x: x value of the XYModel and XYZModel
  • y: y value of the XYModel and XYZModel
  • z: z value of the XYZModel
  • date, open, high, low, close, volumn: data of the HiLoModel

See also jFreeChart.

Since:
3.0.0
Author:
henrichen
See Also:
  • Constructor Details

    • JFreeChartEngine

      public JFreeChartEngine()
  • Method Details

    • prepareJFreeChart

      protected boolean prepareJFreeChart(org.jfree.chart.JFreeChart jfchart, org.zkoss.zul.Chart chart)
      Developers with special needs can override this method to apply own rendering properties on the created JFreeChart. The original implementation of this method simply return false to tell the engine to apply its default rendering properties. Return true tells the engine NOT to apply its default rendering properties.
      Parameters:
      jfchart - the created JFreeChart
      chart - the ZK chart component associated with this ChartEngine.
      Returns:
      true to tell this engine NOT to apply its default rendering properties; false to tell this engine TO apply its default rendering properties.
      Since:
      3.0.1
    • drawChart

      public byte[] drawChart(Object data)
      Specified by:
      drawChart in interface org.zkoss.zul.impl.ChartEngine
    • getGanttTaskTooltip

      protected String getGanttTaskTooltip(Date start, Date end, Number percent)
      Returns data tooltiptext of the GanttTask.
      Parameters:
      start - the starting date
      end - the ending date
      percent - the complete percentage
      Returns:
      data tooltiptext of the GanttTask.