1. #1
    Sencha Premium Member
    Join Date
    Apr 2014
    Posts
    8
    Vote Rating
    0
    mc_user is on a distinguished road

      0  

    Default Legend/color reversing in AreaSeries chart gxt

    Legend/color reversing in AreaSeries chart gxt


    When we developed a Cumulative chart, using the AreaSeries , the chart legends is not appearing as it is in the chart and vice versa. ie., there are 3 legends - Open , Inprogress , Close. But the chart looks fine only when "Open" is rendered at the back,"Inprogress" in front of 'Open' and "Close" in the front other wise the "Close" is hidden. The legend appears as "Close","Open" and "Inprogress".

    Code:
    AreaSeries<CumulativePointsTO> series = new AreaSeries<CumulativePointsTO>();
    series.setHighlighting(true);
    series.setYAxisPosition(Chart.Position.LEFT);
    series.addYField(cumulativePointsProperties.closeCumulative());
    series.addYField(cumulativePointsProperties.inProgressCumulative());
    series.addYField(cumulativePointsProperties.openCumulative());
    series.addColor(6,new RGB(148, 174, 10));
    series.addColor(5,new RGB(17, 95, 166));
    series.addColor(4,new RGB(166, 17, 32));
    series.setLegendTitles(Arrays.asList("Close", "InProgress", "Open"));
    There seems to be an option with
    Code:
    series.addYField
    and
    Code:
    series.addColor
    where by the method takes an integer argument also along with value and color respectively which is the position. But when i either give 0,1,2 or 1,2,3 no chart is rendered. The javascript error shows

    "uncaught exception: java.lang.IndexOutOfBoundsException: Index: 3, Size: 0"


    Any thoughts?

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Posts
    99
    Vote Rating
    6
    Andreas Samjeske is on a distinguished road

      0  

    Default


    More info would be helpful:
    - your ValueProvider, which you are adding with series.addYField(...)
    - the whole call stack (where exactly happens that OutOfBounds)
    - more of your classes. At least the one that made the call which leads to OutOfBounds

    I guess, addColor(...) has nothing to do with your problem.

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2014
    Posts
    8
    Vote Rating
    0
    mc_user is on a distinguished road

      0  

    Default


    But how is that if i add the index number in either addColor or addYField or both throws the exception??

    (Also read that as 1,2,3 or 0,1,2 instead of 4,5,6 in the java code)

  4. #4
    Sencha User
    Join Date
    Jul 2011
    Posts
    99
    Vote Rating
    6
    Andreas Samjeske is on a distinguished road

      0  

    Default


    Quote Originally Posted by mc_user View Post
    But how is that if i add the index number in either addColor or addYField or both throws the exception??

    (Also read that as 1,2,3 or 0,1,2 instead of 4,5,6 in the java code)
    What happens if u add only one color or none at all?
    Again, more info needed!

  5. #5
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Code:
    AreaSeries<CumulativePointsTO> series = new AreaSeries<CumulativePointsTO>();
    //...
    series.addColor(6,new RGB(148, 174, 10));
    series.addColor(5,new RGB(17, 95, 166));
    series.addColor(4,new RGB(166, 17, 32));
    Without more details, that looks like the problem right there - you are inserting a 4th, 5th, and 6th item without ever having made a 0, 1, 2, 3 item. That *should* cause an index out of bounds exception.