Annotation Type Chart


  • @Repeatable(Charts.class)
    @Retention(RUNTIME)
    @Target({FIELD,METHOD})
    public @interface Chart
    To display a chart using the values from a collection.

    Applies to collections.

    Example:

      @Chart
      Collection employees;  
     
    It could display a chart with several bars, one for each employee, for example.
    In this case OpenXava tries to determine automatically whose properties identifies each entity, to use them as labels, and also try to choose numeric values from entities susceptible to be shown in the chart.
    However, you can determine explicitly what properties use, like in this example:
      @Chart(labelProperties = "firstName, lastName", dataProperties = "salary, bonus")
      Collection employees;  
     
    In this case the concatenation of firstName and lastName is used as label, and the salary and bonus properties as data.

    Since v7.5 you can also specify the type of chart to use:

      @Chart(type = ChartType.LINE, labelProperties = "month", dataProperties = "sales")
      Collection sales;  
     
    Available chart types are BAR (default), LINE and PIE.
    Since:
    7.4
    Author:
    Javier Paniza
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String dataProperties
      The property (or properties) to use to get the data of each entity to display in the chart.
      java.lang.String forViews
      List of comma separated view names where this annotation applies.
      java.lang.String labelProperties
      The property (or properties) to use as label to identify each entity shown in the chart.
      java.lang.String notForViews
      List of comma separated view names where this annotation does not apply.
      ChartType type
      The type of chart to display.
    • Element Detail

      • forViews

        java.lang.String forViews
        List of comma separated view names where this annotation applies.

        Exclusive with notForViews.
        If both forViews and notForViews are omitted then this annotation apply to all views.
        You can use the string "DEFAULT" for referencing to the default view (the view with no name).

        Default:
        ""
      • notForViews

        java.lang.String notForViews
        List of comma separated view names where this annotation does not apply.

        Exclusive with forViews.
        If both forViews and notForViews are omitted then this annotation apply to all views.
        You can use the string "DEFAULT" for referencing to the default view (the view with no name).

        Default:
        ""
      • dataProperties

        java.lang.String dataProperties
        The property (or properties) to use to get the data of each entity to display in the chart.

        If not specified, all numeric properties except those with year, number, code or id in the name, are chosen.
        It's possible to indicate several properties separated by commas.

        Default:
        ""
      • labelProperties

        java.lang.String labelProperties
        The property (or properties) to use as label to identify each entity shown in the chart.

        If not specified, if year/number(or id or code) combination exists is preferred. Otherwise, the property named title, name or description is use, with year, number, code or id as prefix if exists
        As fallback the first property is used.
        It's possible to indicate several properties separated by commas.

        Default:
        ""
      • type

        ChartType type
        The type of chart to display.

        If not specified, BAR is used.

        Since:
        7.5
        Default:
        org.openxava.annotations.ChartType.BAR