Version v9.1p_2014-10-15/Pro Deployment (2014-10-15)
Hi,
I've got a problem with BarCharts (stacked) when there are 2 records and one of them has a value 3 and the other value 1. The values are correct but the graphic view is starting at 2.8 instead of 0.
Thank you in advance
Hi,
I've got a problem with BarCharts (stacked) when there are 2 records and one of them has a value 3 and the other value 1. The values are correct but the graphic view is starting at 2.8 instead of 0.
Code:
public class TesteSmartGWTEntryPoint implements EntryPoint { private VLayout rootLayout; @Override public void onModuleLoad() { try { rootLayout = new VLayout(); rootLayout.setWidth("98,5%"); rootLayout.setHeight("97%"); RootPanel.get().add(rootLayout); buildLayout(); } catch (Exception e) { } } private void buildLayout() { HashMap<String, Integer> map = new LinkedHashMap<String, Integer>(); map.put("String 1", 3); map.put("String 2", 1); final FacetChart chart = new FacetChart(); chart.setFacets(new Facet("entity", " "), new Facet("currentAttribute", "Attribute")); chart.setValueProperty("number"); chart.setChartType(ChartType.BAR); chart.setTitle("Bar Chart"); chart.setHeight100(); chart.setWidth100(); chart.setAlign(Alignment.CENTER); chart.setShowDataValues(true); List<BarChartRecord> recordList = new ArrayList<BarChartRecord>(); for (Map.Entry<String, Integer> cPair : map.entrySet()) recordList.add(new BarChartRecord(cPair.getKey(), cPair.getValue())); chart.setData(recordList.toArray(new BarChartRecord[] {})); rootLayout.addMembers(chart); } public class BarChartRecord extends Record { protected BarChartRecord() { } public BarChartRecord(String name, Integer value) { setAttribute("currentAttribute", name); setAttribute("number", value); setAttribute("entity", " "); } } }
Comment