Success! Looks like we've fixed this one. According to our records the fix was applied for EXTGWT-2480 in a recent build.
  1. #1
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    117
    Vote Rating
    0
    tmancini is on a distinguished road

      0  

    Default Issue with PieChart rendering as straight line

    Issue with PieChart rendering as straight line


    I am not sure what would cause the one set of data to render properly in the PieChart while the other renders as a straight line. I don't know if there's something wrong that I am doing or if this is a bug. I extracted a small part of a larger project that could be used to reproduce the issue. Please let me know if you need anything additional on my part. Thank you.

    PHP Code:
    public class Dashboard implements EntryPoint {

      public final static 
    String MAIN_ROOT_PANEL "mainRootPanel";
      protected 
    CompareDataPropertyAccess compareDataAccess CompareDataPropertyAccess.INSTANCE;
      private 
    EPieChart<CompareDatapieChart;
      
      public 
    Dashboard() { }

      @
    Override
      
    public void onModuleLoad() {
        
    RootPanel rootPanel RootPanel.get(Dashboard.MAIN_ROOT_PANEL);
        
    rootPanel.add(getPieChart());
      }
      
      private 
    Widget getPieChart() {
        
    VerticalLayoutContainer verticalContainer;
        
        
    verticalContainer = new VerticalLayoutContainer();
        
        final 
    EComboBox fundComboBox = new EComboBox();
        
    fundComboBox.add("Fund 1");
        
    fundComboBox.add("Fund 2");
        
    fundComboBox.setValue("Fund 1");
        
    fundComboBox.setForceSelection(true);
        
        
    FieldLabel fundFieldLabel = new FieldLabel(fundComboBox"Select Fund");
        
    fundFieldLabel.setLabelWidth(70);
        
        
    verticalContainer.add(fundFieldLabel, new VerticalLayoutData(-1, -1, new Margins(100010)));
        
        final 
    ListStore<CompareDatastore = new ListStore<CompareData>(compareDataAccess.nameKey());
        
    store.addAll(getData(1));
        
        
    pieChart = new EPieChart<CompareData>(store"Revenue");    
        
    pieChart.addChartSeries();
        
        final 
    ContentPanel panel = new ContentPanel();
        
    panel.add(pieChart);
        
    verticalContainer.add(panel, new VerticalLayoutData(500500, new Margins(10)));
        
        
    fundComboBox.addSelectionHandler(new SelectionHandler<String>() {
          @
    Override
          
    public void onSelection(SelectionEvent<Stringevent) {
            
    store.clear();
            
    store.addAll(getData(event.getSelectedItem().equals("Fund 1") ? 2));
            
    panel.remove(pieChart);
            
    //Need to recreate the chart since the number of "slices" could change based on the Fund Selection
            //This is not apparent in this test case, however I believe it is necessary with my actual project.
            
    pieChart = new EPieChart<CompareData>(store"Revenue");    
            
    pieChart.addChartSeries(); 
            
    panel.add(pieChart);
            
    panel.forceLayout();
          }
        });
        
        return 
    verticalContainer;
      }
      
      private List<
    CompareDatagetData(int fund) {
        List<
    CompareDatadataList = new ArrayList<CompareData>();
        if(
    fund == 1) {
          
    dataList.add(new CompareData("FUND1""Fund 1", new BigDecimal(0), new BigDecimal(50.55), new BigDecimal(99.34)));
        }
        else {
          
    dataList.add(new CompareData("FUND2""Fund 2", new BigDecimal(.03), new BigDecimal(9.93), new BigDecimal(11.89)));
        }
        return 
    dataList;
      }

    PHP Code:
    public class EComboBox extends SimpleComboBox<String> {

      private final static 
    StringLabelProvider<StringSTRING_LABEL_PROVIDER = new StringLabelProvider<String>();
      private final 
    int CHARACTER_WIDTH 11;
      private 
    int maxWidth 0;
      
      public 
    EComboBox() {
        
    super(STRING_LABEL_PROVIDER);
        
    setForceSelection(true);
        
    setEditable(false);
        
    setTriggerAction(TriggerAction.ALL);
      }
      
      public 
    void addAll(String... strings) {
        if(
    strings != null) {
          
    addAll(Arrays.asList(strings));
        }
      }

      public 
    void addAll(List<Stringstrings) {
        if(
    strings != null) {
          for(
    String item strings) {
            
    add(item);
          }
        }
      }

      @
    Override
      
    public void add(String value) {
        
    super.add(value);
        if(
    value instanceof String) {
          
    int width value.length() * CHARACTER_WIDTH;
          if(
    width maxWidth) {
            
    setWidth(width);
            
    maxWidth width;
          }
        }
      }

    PHP Code:
    public abstract class AbstractChart<T> extends Chart<T> {

      protected 
    ListStore<Tstore;
      protected final 
    SeriesToolTipConfig<Tconfig = new SeriesToolTipConfig<T>();
      
      public 
    AbstractChart() {
        
    super();
      }
      
      public 
    AbstractChart(ListStore<Tstore) {
        
    super();
        
    this.store store;
        
    setStore(store);
        
    setShadowChart(true);
        
    setAnimated(true);
        
    setBorders(true);
        
        
    config.setLabelProvider(null);
        
    config.setDismissDelay(0);
        
    config.setHideDelay(0);
      }
      

    PHP Code:
    public class EPieChart<extends CompareData> extends AbstractChart<T> {
      
      private List<
    GradientgradientList;
      private 
    CompareDataPropertyAccess dataAccess CompareDataPropertyAccess.INSTANCE;
      private 
    Map<StringColorcolorHash = new HashMap<StringColor>();
      
      public 
    EPieChart() {
        
    super();
      }
      
      public 
    EPieChart(ListStore<TstoreString title) {
        
    super(store);
        
    setDefaultInsets(50);
        
    setBorders(true);
        
        
    gradientList = new ArrayList<Gradient>();
        
        for(
    int i=0store.size(); i++) {
            
    Gradient gradient = new Gradient(title+i45);
            
    gradient.addStop(0getColors().get(i));
            
    gradient.addStop(100getColors().get(i));
            
    addNewGradient(gradient);
            
    colorHash.put(store.get(i).getName().trim(), getColors().get(i));
        }
      }
      
      public 
    void addNewGradient(Gradient gradient) {
        
    addGradient(gradient);
        
    gradientList.add(gradient);
      }
      
      public 
    void addChartSeries() {
        final 
    PieSeries<Tseries = new PieSeries<T>();
        
    series.setAngleField(dataAccess.currentYearAmt());
        for(
    Gradient gradient gradientList) {
          
    series.addColor(gradient);
        }
        
        
    series.setHighlighting(true);
        
    series.setLegendValueProvider(dataAccess.descript(), new LabelProvider<String>() {
     
          @
    Override
          
    public String getLabel(String item) {
            return 
    item;
          }
        });
        
        
    series.addSeriesItemOverHandler(new SeriesItemOverHandler<T>() {
          @
    Override
          
    public void onSeriesOverItem(SeriesItemOverEvent<Tevent) {
            if(
    getElement() != null) {
              
    config.setBodyHtml(getToolTipText(storeevent.getIndex()));
              
    series.setToolTipConfig(config);
            }
          }
        });
        
        
    series.addSeriesItemOutHandler(new SeriesItemOutHandler<T>() {
          @
    Override
          
    public void onSeriesLeaveItem(SeriesItemOutEvent<Tevent) {
            
    series.getToolTip().hide();
          }
        });
        
    addSeries(series);
     
        final 
    Legend<Tlegend = new Legend<T>();
        
    legend.setPosition(Position.RIGHT);
        
    legend.setItemHighlighting(true);
        
    legend.setItemHiding(true);
        
        final 
    LegendToolTipConfig<TlegendConfig = new LegendToolTipConfig<T>();
        
    legendConfig.setDismissDelay(0);
        
    legendConfig.setHideDelay(0);
        
        
    legend.addLegendItemOverHandler(new LegendItemOverHandler() {
          @
    Override
          
    public void onLegendItemOver(LegendItemOverEvent event) {
            if(
    getElement() != null) {
              
    legendConfig.setBodyHtml(getToolTipText(storeevent.getIndex()));
              
    legend.setToolTipConfig(legendConfig);
            }
          } 
        });
        
        
    legend.addLegendItemOutHandler(new LegendItemOutHandler() {
          @
    Override
          
    public void onLegendItemOut(LegendItemOutEvent event) {
            
    legend.getToolTip().hide();
          }
        });
        
        
    setLegend(legend);
      }
      
      private 
    String getToolTipText(ListStore<Tstoreint index) {
        List<
    TdataList store.getAll();
        
    BigDecimal total Constants.ZERO;
        
    BigDecimal percentage Constants.ZERO;
        for(
    int i=0dataList.size(); i++) {
          
    total total.add(dataList.get(i).getCurrentYearAmt());
        }
        
    percentage store.get(index).getCurrentYearAmt().divide(total2BigDecimal.ROUND_HALF_UP);
        
    StringBuilder toolTipBuilder = new StringBuilder();
        
    toolTipBuilder.append(store.get(index).getDescript());
        
    toolTipBuilder.append("<br>");
        
    toolTipBuilder.append(Format.number(store.get(index).getCurrentYearAmt().doubleValue(), "$###,###.00"));
        
    toolTipBuilder.append("<br>");
        
    toolTipBuilder.append(Format.number(percentage.doubleValue(), "(###.##%)"));
        return 
    toolTipBuilder.toString();
      }
      
      public 
    Color getColor(String name) {
          if(
    colorHash.containsKey(name.trim())) {
              return 
    colorHash.get(name.trim());
          }
          return 
    null;
      }
      
      private List<
    ColorgetColors() {
          List<
    ColorcolorList = new ArrayList<Color>();
          
    colorList.add(new RGB(5784111));
          
    colorList.add(new RGB(1161028));
          
    colorList.add(new RGB(110145180));
          
    colorList.add(new RGB(8457111));
          
    colorList.add(new RGB(5711157));
          
    colorList.add(new RGB(8411157));
          
    colorList.add(new RGB(11111157));
          
    colorList.add(new RGB(1118457));
          
    colorList.add(new RGB(1115757));
          
    colorList.add(new RGB(78115151));
          
    colorList.add(new RGB(5757111));
          
    colorList.add(new RGB(180145110));
          
    colorList.add(new RGB(15111578));
          
    colorList.add(new RGB(1115784));
          return 
    colorList;
      }


    PHP Code:
    public interface CompareDataPropertyAccess extends PropertyAccess<CompareData> {
      
      public 
    CompareDataPropertyAccess INSTANCE GWT.create(CompareDataPropertyAccess.class);
      
      
    ValueProvider<CompareDataStringname();
      
      
    ValueProvider<CompareDataStringdescript();
      
      
    ValueProvider<CompareDataBigDecimalpriorYearAsOfDateAmt();
      
      
    ValueProvider<CompareDataBigDecimalpriorYearAmt();
      
      
    ValueProvider<CompareDataBigDecimalcurrentYearAmt();
      
      
    ValueProvider<CompareDataBigDecimalchange();
      
      @
    Path("name")
      
    ModelKeyProvider<CompareDatanameKey();
      
      @
    Path("descript")
      
    ModelKeyProvider<CompareDatadescriptKey();


  2. #2
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    117
    Vote Rating
    0
    tmancini is on a distinguished road

      0  

    Default


    Was anyone able to take a look at and reproduce this issue?

  3. #3
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    I redirected this question to the correct person. If this is a high priority issue for you, you should try to open a real support ticket in the ticket system.

  4. #4
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    117
    Vote Rating
    0
    tmancini is on a distinguished road

      0  

    Default PieChart renders as a line for particular data set

    PieChart renders as a line for particular data set


    I am not sure what would cause the one set of data to render properly in the PieChart while the other renders as a straight line. I don't know if there's something wrong that I am doing or if this is a bug. I extracted a small part of a larger project that could be used to reproduce the issue. Please let me know if you need anything additional on my part. Thank you.

    PHP Code:
    public class Dashboard implements EntryPoint {

      public final static 
    String MAIN_ROOT_PANEL "mainRootPanel";
      protected 
    CompareDataPropertyAccess compareDataAccess CompareDataPropertyAccess.INSTANCE;
      private 
    EPieChart<CompareDatapieChart;
      
      public 
    Dashboard() { }

      @
    Override
      
    public void onModuleLoad() {
        
    RootPanel rootPanel RootPanel.get(Dashboard.MAIN_ROOT_PANEL);
        
    rootPanel.add(getPieChart());
      }
      
      private 
    Widget getPieChart() {
        
    VerticalLayoutContainer verticalContainer;
        
        
    verticalContainer = new VerticalLayoutContainer();
        
        final 
    EComboBox fundComboBox = new EComboBox();
        
    fundComboBox.add("Fund 1");
        
    fundComboBox.add("Fund 2");
        
    fundComboBox.setValue("Fund 1");
        
    fundComboBox.setForceSelection(true);
        
        
    FieldLabel fundFieldLabel = new FieldLabel(fundComboBox"Select Fund");
        
    fundFieldLabel.setLabelWidth(70);
        
        
    verticalContainer.add(fundFieldLabel, new VerticalLayoutData(-1, -1, new Margins(100010)));
        
        final 
    ListStore<CompareDatastore = new ListStore<CompareData>(compareDataAccess.nameKey());
        
    store.addAll(getData(1));
        
        
    pieChart = new EPieChart<CompareData>(store"Revenue");    
        
    pieChart.addChartSeries();
        
        final 
    ContentPanel panel = new ContentPanel();
        
    panel.add(pieChart);
        
    verticalContainer.add(panel, new VerticalLayoutData(500500, new Margins(10)));
        
        
    fundComboBox.addSelectionHandler(new SelectionHandler<String>() {
          @
    Override
          
    public void onSelection(SelectionEvent<Stringevent) {
            
    store.clear();
            
    store.addAll(getData(event.getSelectedItem().equals("Fund 1") ? 2));
            
    panel.remove(pieChart);
            
    //Need to recreate the chart since the number of "slices" could change based on the Fund Selection
            //This is not apparent in this test case, however I believe it is necessary with my actual project.
            
    pieChart = new EPieChart<CompareData>(store"Revenue");    
            
    pieChart.addChartSeries(); 
            
    panel.add(pieChart);
            
    panel.forceLayout();
          }
        });
        
        return 
    verticalContainer;
      }
      
      private List<
    CompareDatagetData(int fund) {
        List<
    CompareDatadataList = new ArrayList<CompareData>();
        if(
    fund == 1) {
          
    dataList.add(new CompareData("FUND1""Fund 1", new BigDecimal(0), new BigDecimal(50.55), new BigDecimal(99.34)));
        }
        else {
          
    dataList.add(new CompareData("FUND2""Fund 2", new BigDecimal(.03), new BigDecimal(9.93), new BigDecimal(11.89)));
        }
        return 
    dataList;
      }

    PHP Code:
    public class EComboBox extends SimpleComboBox<String> {

      private final static 
    StringLabelProvider<StringSTRING_LABEL_PROVIDER = new StringLabelProvider<String>();
      private final 
    int CHARACTER_WIDTH 11;
      private 
    int maxWidth 0;
      
      public 
    EComboBox() {
        
    super(STRING_LABEL_PROVIDER);
        
    setForceSelection(true);
        
    setEditable(false);
        
    setTriggerAction(TriggerAction.ALL);
      }
      
      public 
    void addAll(String... strings) {
        if(
    strings != null) {
          
    addAll(Arrays.asList(strings));
        }
      }

      public 
    void addAll(List<Stringstrings) {
        if(
    strings != null) {
          for(
    String item strings) {
            
    add(item);
          }
        }
      }

      @
    Override
      
    public void add(String value) {
        
    super.add(value);
        if(
    value instanceof String) {
          
    int width value.length() * CHARACTER_WIDTH;
          if(
    width maxWidth) {
            
    setWidth(width);
            
    maxWidth width;
          }
        }
      }

    PHP Code:
    public abstract class AbstractChart<T> extends Chart<T> {

      protected 
    ListStore<Tstore;
      protected final 
    SeriesToolTipConfig<Tconfig = new SeriesToolTipConfig<T>();
      
      public 
    AbstractChart() {
        
    super();
      }
      
      public 
    AbstractChart(ListStore<Tstore) {
        
    super();
        
    this.store store;
        
    setStore(store);
        
    setShadowChart(true);
        
    setAnimated(true);
        
    setBorders(true);
        
        
    config.setLabelProvider(null);
        
    config.setDismissDelay(0);
        
    config.setHideDelay(0);
      }
      

    PHP Code:
    public class EPieChart<extends CompareData> extends AbstractChart<T> {
      
      private List<
    GradientgradientList;
      private 
    CompareDataPropertyAccess dataAccess CompareDataPropertyAccess.INSTANCE;
      private 
    Map<StringColorcolorHash = new HashMap<StringColor>();
      
      public 
    EPieChart() {
        
    super();
      }
      
      public 
    EPieChart(ListStore<TstoreString title) {
        
    super(store);
        
    setDefaultInsets(50);
        
    setBorders(true);
        
        
    gradientList = new ArrayList<Gradient>();
        
        for(
    int i=0store.size(); i++) {
            
    Gradient gradient = new Gradient(title+i45);
            
    gradient.addStop(0getColors().get(i));
            
    gradient.addStop(100getColors().get(i));
            
    addNewGradient(gradient);
            
    colorHash.put(store.get(i).getName().trim(), getColors().get(i));
        }
      }
      
      public 
    void addNewGradient(Gradient gradient) {
        
    addGradient(gradient);
        
    gradientList.add(gradient);
      }
      
      public 
    void addChartSeries() {
        final 
    PieSeries<Tseries = new PieSeries<T>();
        
    series.setAngleField(dataAccess.currentYearAmt());
        for(
    Gradient gradient gradientList) {
          
    series.addColor(gradient);
        }
        
        
    series.setHighlighting(true);
        
    series.setLegendValueProvider(dataAccess.descript(), new LabelProvider<String>() {
     
          @
    Override
          
    public String getLabel(String item) {
            return 
    item;
          }
        });
        
        
    series.addSeriesItemOverHandler(new SeriesItemOverHandler<T>() {
          @
    Override
          
    public void onSeriesOverItem(SeriesItemOverEvent<Tevent) {
            if(
    getElement() != null) {
              
    config.setBodyHtml(getToolTipText(storeevent.getIndex()));
              
    series.setToolTipConfig(config);
            }
          }
        });
        
        
    series.addSeriesItemOutHandler(new SeriesItemOutHandler<T>() {
          @
    Override
          
    public void onSeriesLeaveItem(SeriesItemOutEvent<Tevent) {
            
    series.getToolTip().hide();
          }
        });
        
    addSeries(series);
     
        final 
    Legend<Tlegend = new Legend<T>();
        
    legend.setPosition(Position.RIGHT);
        
    legend.setItemHighlighting(true);
        
    legend.setItemHiding(true);
        
        final 
    LegendToolTipConfig<TlegendConfig = new LegendToolTipConfig<T>();
        
    legendConfig.setDismissDelay(0);
        
    legendConfig.setHideDelay(0);
        
        
    legend.addLegendItemOverHandler(new LegendItemOverHandler() {
          @
    Override
          
    public void onLegendItemOver(LegendItemOverEvent event) {
            if(
    getElement() != null) {
              
    legendConfig.setBodyHtml(getToolTipText(storeevent.getIndex()));
              
    legend.setToolTipConfig(legendConfig);
            }
          } 
        });
        
        
    legend.addLegendItemOutHandler(new LegendItemOutHandler() {
          @
    Override
          
    public void onLegendItemOut(LegendItemOutEvent event) {
            
    legend.getToolTip().hide();
          }
        });
        
        
    setLegend(legend);
      }
      
      private 
    String getToolTipText(ListStore<Tstoreint index) {
        List<
    TdataList store.getAll();
        
    BigDecimal total Constants.ZERO;
        
    BigDecimal percentage Constants.ZERO;
        for(
    int i=0dataList.size(); i++) {
          
    total total.add(dataList.get(i).getCurrentYearAmt());
        }
        
    percentage store.get(index).getCurrentYearAmt().divide(total2BigDecimal.ROUND_HALF_UP);
        
    StringBuilder toolTipBuilder = new StringBuilder();
        
    toolTipBuilder.append(store.get(index).getDescript());
        
    toolTipBuilder.append("<br>");
        
    toolTipBuilder.append(Format.number(store.get(index).getCurrentYearAmt().doubleValue(), "$###,###.00"));
        
    toolTipBuilder.append("<br>");
        
    toolTipBuilder.append(Format.number(percentage.doubleValue(), "(###.##%)"));
        return 
    toolTipBuilder.toString();
      }
      
      public 
    Color getColor(String name) {
          if(
    colorHash.containsKey(name.trim())) {
              return 
    colorHash.get(name.trim());
          }
          return 
    null;
      }
      
      private List<
    ColorgetColors() {
          List<
    ColorcolorList = new ArrayList<Color>();
          
    colorList.add(new RGB(5784111));
          
    colorList.add(new RGB(1161028));
          
    colorList.add(new RGB(110145180));
          
    colorList.add(new RGB(8457111));
          
    colorList.add(new RGB(5711157));
          
    colorList.add(new RGB(8411157));
          
    colorList.add(new RGB(11111157));
          
    colorList.add(new RGB(1118457));
          
    colorList.add(new RGB(1115757));
          
    colorList.add(new RGB(78115151));
          
    colorList.add(new RGB(5757111));
          
    colorList.add(new RGB(180145110));
          
    colorList.add(new RGB(15111578));
          
    colorList.add(new RGB(1115784));
          return 
    colorList;
      }


    PHP Code:
    public interface CompareDataPropertyAccess extends PropertyAccess<CompareData> {
      
      public 
    CompareDataPropertyAccess INSTANCE GWT.create(CompareDataPropertyAccess.class);
      
      
    ValueProvider<CompareDataStringname();
      
      
    ValueProvider<CompareDataStringdescript();
      
      
    ValueProvider<CompareDataBigDecimalpriorYearAsOfDateAmt();
      
      
    ValueProvider<CompareDataBigDecimalpriorYearAmt();
      
      
    ValueProvider<CompareDataBigDecimalcurrentYearAmt();
      
      
    ValueProvider<CompareDataBigDecimalchange();
      
      @
    Path("name")
      
    ModelKeyProvider<CompareDatanameKey();
      
      @
    Path("descript")
      
    ModelKeyProvider<CompareDatadescriptKey();


  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


    I've been trying to piece this together, what with the missing classes from your post. I'd like to suggest that to make a project reproducible, it would be helpful if the project contained all the necessary pieces, otherwise I'm doing a fair bit of guessing.

    Constants is missing, but I assumed that Constants.ZERO is just new BigDecimal(0).

    The CompareData class was missing, so I tried to make it up based on the getters that are called and the constructor. Unfortunatly, while it probably doesn't matter which argument is name versus descript, the other three values passed in are less clear, but I can't seem to get a bug with any one of the three. Of the four methods in the PropertyAccess class that deal with numbers only currentYearAmt is even invoked, and likewise that is the only BigDecimal returning getter method that was invoked, so I tried each of the three BigDecimal arguments wired up to that method.
    Code:
      public class CompareData {
        private String name;
        private String descript;
        private BigDecimal currentYearAmt;
        public CompareData(String name, String descript, 
            BigDecimal x, BigDecimal y, BigDecimal z) {
          this.name = name;
          this.descript = descript;
          this.currentYearAmt = x;
    //      this.currentYearAmt = y;
    //      this.currentYearAmt = z;
        }
        public BigDecimal getCurrentYearAmt() {
          return currentYearAmt;
        }
        public String getDescript() {
          return descript;
        }
        public String getName() {
          return name;
        }
      }
    The first value ends up create one object with a value of zero. This causes an exception in the getToolTipText method, as the result of dividing by zero when the mouse is hovered over the legend. I attempted to fix this with the following line:
    Code:
    //percentage = store.get(index).getCurrentYearAmt().divide(total, 2, BigDecimal.ROUND_HALF_UP);
    percentage = total.equals(ZERO) ? ZERO : store.get(index).getCurrentYearAmt().divide(total, 2, BigDecimal.ROUND_HALF_UP);
    With that changed, selecting the first entry in the ComboBox "Fund 1" creates a blank pie chart (since the value of currentYearAmt is zero), while the second one creates a full wheel (since it is the only slice, and is non-zero).

    Switching to the second argument, both rendered as full discs. Using the third, with "Fund 2" selected, I noticed the issue - a shadowed blue line instead of a full disc.

    This being the only way I could reproduce the issue, I stripped out as much code as possible to isolate the actual issue:
    Code:
    public class Test implements EntryPoint {
      private static final CompareDataPropertyAccess compareDataAccess = GWT.create(CompareDataPropertyAccess.class);
    
      @Override
      public void onModuleLoad() {
        RootPanel rootPanel = RootPanel.get();
        rootPanel.add(getPieChart());
      }
      
      private Widget getPieChart() {
        final ListStore<CompareData> store = new ListStore<CompareData>(compareDataAccess.nameKey());
        store.add(new CompareData("FUND2", new BigDecimal(11.89)));
        
        Chart<CompareData> pieChart = new Chart<CompareData>();
        pieChart.setStore(store);
        pieChart.setShadowChart(true);
        pieChart.setPixelSize(500, 500);
        
        PieSeries<CompareData> series = new PieSeries<CompareData>();
        series.setAngleField(compareDataAccess.currentYearAmt());
        
        pieChart.addSeries(series);
        
        return pieChart;
      }
    
      public interface CompareDataPropertyAccess extends PropertyAccess<CompareData> {
        ValueProvider<CompareData, BigDecimal> currentYearAmt();
        
        @Path("name")
        ModelKeyProvider<CompareData> nameKey();
      }
      public static class CompareData {
        private String name;
        private BigDecimal currentYearAmt;
        public CompareData(String name, BigDecimal z) {
          this.name = name;
          this.currentYearAmt = z;
        }
        public BigDecimal getCurrentYearAmt() {
          return currentYearAmt;
        }
        public String getName() {
          return name;
        }
      }
    }
    Changing this apparently magic value of 11.89 up or down by 1, 10, or even .01 apparently causes it to correctly draw a full disc, so the bug in GXT must only be present around certain values.

    It is looking to be a rounding issue in the placement of the PieSeries sprites - I'll move this to the bugs forum (and merge it with your other thread) so it can be updated when there is a fix or workaround available.

  6. #6
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    117
    Vote Rating
    0
    tmancini is on a distinguished road

      0  

    Default


    Thanks for your help and sorry for the additional work. I thought I included everything and although it no longer matters, here is the CompareData class.

    Code:
    public class CompareData implements Serializable{
    
      private static final long serialVersionUID = 1L;
    
      private String groupBy;
      private String name;
      private String descript;
      private BigDecimal priorYearAsOfDateAmt;
      private BigDecimal priorYearAmt;
      private BigDecimal ytdAmt;
      private BigDecimal change;
    
      public CompareData() {
      }
    
      public CompareData(String groupBy, String name, String descript, BigDecimal priorYearAsOfDateAmt, BigDecimal priorYearAmt, BigDecimal ytdAmt) {
        this.setGroupBy(groupBy);
        this.name = name;
        this.descript = descript;
        this.priorYearAsOfDateAmt = priorYearAsOfDateAmt;
        this.priorYearAmt = priorYearAmt;
        this.ytdAmt = ytdAmt;
    
        change = priorYearAsOfDateAmt.compareTo(Constants.ZERO) > 0 ?
                  (ytdAmt.subtract(priorYearAsOfDateAmt)).divide(priorYearAsOfDateAmt, 2, BigDecimal.ROUND_HALF_UP)
                  : Constants.ZERO;
      }
    
      public String getGroupBy() {
        return groupBy;
      }
    
      public void setGroupBy(String groupBy) {
        this.groupBy = groupBy;
      }
    
      public String getName() {
        return name;
      }
    
      public void setName(String name) {
        this.name = name;
      }
    
      public String getDescript() {
        return descript;
      }
    
      public void setDescript(String descript) {
        this.descript = descript;
      }
    
      public BigDecimal getPriorYearAsOfDateAmt() {
        return priorYearAsOfDateAmt;
      }
    
      public void setPriorYearAsOfDateAmt(BigDecimal priorYearAsOfDateAmt) {
        this.priorYearAsOfDateAmt = priorYearAsOfDateAmt;
      }
    
      public BigDecimal getPriorYearAmt() {
        return priorYearAmt;
      }
    
      public void setPriorYearAmt(BigDecimal priorYearAmt) {
        this.priorYearAmt = priorYearAmt;
      }
    
      public BigDecimal getYtdAmt() {
        return ytdAmt;
      }
    
      public void setYtdAmt(BigDecimal ytdAmt) {
        this.ytdAmt = ytdAmt;
      }
    
      public BigDecimal getChange() {
        return change;
      }
    
      public void setChange(BigDecimal change) {
        this.change = change;
      }
    }
    Thanks again.

  7. #7
    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


    This has been fixed in SVN and will be available in the next release.

    The specific problem is that there is a rounding issue in PieChart - not something that can be cleanly overridden -- no easy workaround. The value 11.89 apparently hits this in a way other datasets we've tested haven't, but rounding one way or another will get you around this case.

Thread Participants: 2