Class FunnelChart

All Implemented Interfaces:
DataDescriptorCallback, ClickableChartData<FunnelChart>, SimpleSeriesChart<FunnelChart,Series>

A funnel chart displays one data series. A funnel contains several trapezoid shapes, denoting data points. Every trapezoid shape has a different color (automatically calculated, but can also be specified). The trapezoid denoting the highest value is placed on the top, while other data points are visualized as gradually smaller shapes. The overall outline of the chart has the shape of a funnel. Each trapezoid shape is shown in the legend, helping the user to find out what sort of data the shapes represent.

This chart is does not allow you to modify the tooltip, you can only use a DOT. However, the chart enables you to create custom tooltips using any JBStrap component. If you want to display a tooltip that is different from the default one, you need to create it on your own using ChartTooltipRenderer. You only need to implement one method which returns the tooltip as a component. In order to do this, you can reuse any JBStrap component. It is possible to display a button, a list or even another chart on the tooltip.

The chart also supports click events. This means that you can implement server-side business logic for the event that is triggered when a user clicks on a data point. This is when a ChartClick event is triggered. This event provides you information on where and which chart the user clicked on. This can be reused in various ways, e.g. to update a list.

Since:
4.0
Author:
JBStrap
See Also:
  • Field Details

  • Constructor Details

    • FunnelChart

      public FunnelChart(String name)
      Creates a funnel chart component.
      Parameters:
      name - Chart name It is mandatory to specify the chart name and it must be unique within the ChartCanvas. Later on, you can reference the chart with the name specified here.
      Throws:
      NullPointerException - Thrown if the specified name is null or it is an empty string
    • FunnelChart

      public FunnelChart(String name, DataDescriptor dataDescriptor, String categoryColumnName)
      Creates a funnel chart component and sets the name of the DataDescriptor and that of the X axis column.
      Parameters:
      name - Chart name It is mandatory to specify the chart name and it must be unique within the ChartCanvas. Later on, you can reference the chart with the name specified here.
      dataDescriptor - The DataDescriptor that contains the chart data
      categoryColumnName - The name of the DataDescriptor containing X axis data If not specified, or null is specified, the framework starts looking for the “CATEGORY” column.
      Throws:
      NullPointerException - Thrown if the specified name is null or it is an empty string
      IllegalArgumentException - Thrown if the column specified in the categoryColumnName parameter is not found in the DataDescriptor or if the categoryColumnName parameter is not specified and no “CATEGORY” column is found in the DataDescriptor.
  • Method Details

    • init

      protected void init()
      Description copied from class: BaseChart
      Chart initialization.
      Specified by:
      init in class BaseChart<FunnelChart>
    • setDataLabels

      public FunnelChart setDataLabels(DataLabels labels)
      Sets the label for each circle item. By default, the label shows how much per cent a data point represents of the entire chart.
      Parameters:
      labels - Label type Available types are listed in the enum DataLabels. If null is specified, no label is displayed.
      Returns:
      Chart instance
    • getDataLabels

      public DataLabels getDataLabels()
      Gets the chart labels.
      Returns:
      Label type
    • setBorderColor

      public FunnelChart setBorderColor(String color)
      Sets the border color around each item. By default, each item is surrounded by a white border.
      Parameters:
      color - Border color in the CSS3 format
      Returns:
      Chart instance
    • getBorderColor

      public String getBorderColor()
      Gets the border color around each item.
      Returns:
      Border color in CSS3 format
    • setBorderWidth

      public FunnelChart setBorderWidth(int width)
      Sets the border width around each item. By default, items are surrounded by a 0 pixels thick border (no visible border).
      Parameters:
      width - Border around the items in pixels If a number smaller than 0 is specified, border width is set to 0. No visible border is displayed.
      Returns:
      Chart instance
    • getBorderWidth

      public int getBorderWidth()
      Gets the border width around each item.
      Returns:
      Border width
    • setSeries

      public FunnelChart setSeries(Series series)
      Sets the series displayed on the chart.
      Specified by:
      setSeries in interface SimpleSeriesChart<FunnelChart,Series>
      Parameters:
      series - Series instance displayed on the chart
      Returns:
      Chart