ICEfaces
  1. ICEfaces
  2. ICE-11337

add support for other Number classes in selectListener property of ace:chart

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.3.0.GA_P04, 4.2
    • Fix Version/s: EE-3.3.0.GA_P06
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      ace

      Description

      In an ace:chart (pie chart) component in view page populated with String-Long type of key-value pairs. The chart is rendered fine, but when I clicking on a slice invoking the method registered in selectListener property, NumberFormatException is thrown saying that the label cannot be cast to int.

      This mechanism resides in the ChartRenderer.processSelections API method when the seriesIndex and pointIndex variables are attempted to create.

      private void processSelections(Chart chart, String[] select) {
      int seriesIndex = Integer.parseInt(select[0]);
      int pointIndex = Integer.parseInt(select[1]);
      chart.queueEvent(new SeriesSelectionEvent(chart, seriesIndex, pointIndex));
      }

      the select[0] and select[1] values should first be checked for type of Object and then cast accordingly, rather than assumed it's an Integer value. (Support Case would like to be able to use a String for label of pie chart)
      1. chartDynamic.xhtml
        3 kB
        Judy Guglielmin
      2. ChartDynamicBean.java
        6 kB
        Judy Guglielmin

        Activity

        Judy Guglielmin created issue -
        Judy Guglielmin made changes -
        Field Original Value New Value
        Assignee Judy Guglielmin [ judy.guglielmin ]
        Judy Guglielmin made changes -
        Fix Version/s EE-3.3.0.GA_P05 [ 13082 ]
        Fix Version/s 4.3 [ 13096 ]
        Judy Guglielmin made changes -
        Description In an ace:chart (pie chart) component in view page populated with String-Long type of key-value pairs. The chart is rendered fine, but when I clicking on a slice invoking the method registered in selectListener property, NumberFormatException is thrown saying that the label cannot be cast to int.

        This mechanism resides in the ChartRenderer.processSelections API method when the seriesIndex and pointIndex variables are attempted to create.

        private void processSelections(Chart chart, String[] select) {
        int seriesIndex = Integer.parseInt(select[0]);
        int pointIndex = Integer.parseInt(select[1]);
        chart.queueEvent(new SeriesSelectionEvent(chart, seriesIndex, pointIndex));
        }

        the select[0] and select[1] values should first be checked for type of Number and then cast accordingly, rather than assumed it's an Integer value.
        In an ace:chart (pie chart) component in view page populated with String-Long type of key-value pairs. The chart is rendered fine, but when I clicking on a slice invoking the method registered in selectListener property, NumberFormatException is thrown saying that the label cannot be cast to int.

        This mechanism resides in the ChartRenderer.processSelections API method when the seriesIndex and pointIndex variables are attempted to create.

        private void processSelections(Chart chart, String[] select) {
        int seriesIndex = Integer.parseInt(select[0]);
        int pointIndex = Integer.parseInt(select[1]);
        chart.queueEvent(new SeriesSelectionEvent(chart, seriesIndex, pointIndex));
        }

        the select[0] and select[1] values should first be checked for type of Object and then cast accordingly, rather than assumed it's an Integer value. (Support Case would like to be able to use a String for label of pie chart)
        Ken Fyten made changes -
        Fix Version/s EE-3.3.0.GA_P05 [ 13082 ]
        Ken Fyten made changes -
        Assignee Priority P1 [ 10010 ]
        Ken Fyten made changes -
        Fix Version/s EE-3.3.0.GA_P06 [ 13114 ]
        Hide
        Judy Guglielmin added a comment - - edited

        The selectListener was assuming all data was going to be of type Integer. The SeriesSelectionEvent has been expanded such that if the parsing of the values to Integer fails, it just returns strings. So the user now can retrieve Strings (and parse however they would like ) from the event. Attributes of SeriesSelectionEvent are pointIndex and seriesIndex (both "int" values and kept for backwards compatability) and new attributes pointLabel and SeriesLabel which will are String values and can be parsed however the user would like.

        Wiki has been updated.
        rev 51968 for IF4.x
        rev 51969 for IF 3.3.x

        Modified the chartDynamic.xhtml page of showcase app to test the dragListener and no problems exist using float or double values in the chart & table. attaching the bean and xhtml in case QA wants to create a test for it.

        Show
        Judy Guglielmin added a comment - - edited The selectListener was assuming all data was going to be of type Integer. The SeriesSelectionEvent has been expanded such that if the parsing of the values to Integer fails, it just returns strings. So the user now can retrieve Strings (and parse however they would like ) from the event. Attributes of SeriesSelectionEvent are pointIndex and seriesIndex (both "int" values and kept for backwards compatability) and new attributes pointLabel and SeriesLabel which will are String values and can be parsed however the user would like. Wiki has been updated. rev 51968 for IF4.x rev 51969 for IF 3.3.x Modified the chartDynamic.xhtml page of showcase app to test the dragListener and no problems exist using float or double values in the chart & table. attaching the bean and xhtml in case QA wants to create a test for it.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #51968 Thu Sep 28 15:57:39 MDT 2017 judy.guglielmin ICE-11337 fix for selectListener to use non-Integer values.
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/ace/component/src/org/icefaces/ace/event/SeriesSelectionEvent.java
        Commit graph MODIFY /icefaces4/trunk/icefaces/ace/component/src/org/icefaces/ace/component/chart/ChartRenderer.java
        Judy Guglielmin made changes -
        Attachment chartDynamic.xhtml [ 22611 ]
        Attachment ChartDynamicBean.java [ 22612 ]
        Hide
        Judy Guglielmin added a comment -

        rev 51968 IF 4
        rev 51968 rev 3.3

        Show
        Judy Guglielmin added a comment - rev 51968 IF 4 rev 51968 rev 3.3
        Judy Guglielmin made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Liana Munroe added a comment -

        Verified ICEfaces 4 trunk, EE-3.3.0 maintenance branch r51976, Tomcat 8, MS Edge, IE 11, 10, 9, 8 7, FF 53, Chrome 61.

        Show
        Liana Munroe added a comment - Verified ICEfaces 4 trunk, EE-3.3.0 maintenance branch r51976, Tomcat 8, MS Edge, IE 11, 10, 9, 8 7, FF 53, Chrome 61.
        Ken Fyten made changes -
        Fix Version/s EE-3.3.0.GA_P07 [ 13118 ]
        Fix Version/s 4.3 [ 13096 ]
        Fix Version/s EE-3.3.0.GA_P06 [ 13114 ]
        Ken Fyten made changes -
        Fix Version/s EE-3.3.0.GA_P06 [ 13114 ]
        Fix Version/s EE-3.3.0.GA_P07 [ 13118 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Judy Guglielmin
            Reporter:
            Judy Guglielmin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: