Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    FacetChart with ChartType.PIE isn't working well

    Hello,
    I am using SmartClient Version: v8.3p_2013-03-24/Enterprise Deployment (built 2013-03-24) and having problem on using FacetChart of Pie type.

    As you can see attached file, I want to display data values on chart. So I used "chart.setShowDataValues(true);" method.
    It is diplaying value well when I set chart type to colomn. But it isn't displaying some values when I set chart type to Pie.
    I could understand if it isn't displaying the value if chart width is too short.
    But as you can see, mostly, it isn't displaying the value in biggest part.

    Please, let me know how I can display values for all data with ChartType.PIE.
    Another question, Is there no way to display postfix such as "%" on data value?

    Code:
    HLayout hLayout = new HLayout();
    		hLayout.setWidth100();
    		hLayout.setHeight100();
    		if (SC.hasCharts()) {
    			if (SC.hasDrawing()) {
    				final FacetChart chart = new FacetChart();
    				chart.setWidth(508);
    				chart.setHeight(400);
    				chart.setChartType(ChartType.PIE);
    				chart.setStacked(true);
    				chart.setValueTitle("Top 5 Fail");
    				chart.setBorder("1px solid black");
    				chart.setShowTitle(true);
    				chart.setShowChartRect(true);
    				chart.setShowDataValues(true);
    
    				Facet metricFacet = new Facet();
    				metricFacet.setValues(new FacetValue("quantity", "Quantity"));
    				metricFacet.setInlinedValues(true);
    				metricFacet.setId("metric");
    
    				chart.setFacets(new Facet("Top"), metricFacet);
    
    				chart.setData(ChartData.getData());
    
    				VLayout layout = new VLayout(15);
    				layout.addMember(chart);
    
    				hLayout.addMember(layout);
    			} else {
    				HTMLFlow htmlFlow = new HTMLFlow(
    						"<div class='explorerCheckErrorMessage'><p>This example is disabled in this SDK because it requires the optional "
    								+ "<a href=\"http://www.smartclient.com/product/index.jsp#drawing\" target=\"_blank\">Drawing module</a>.</p>"
    								+ "<p>Click <a href=\"http://www.smartclient.com/smartgwtee/showcase/#multiSeriesChart\" target=\"\">here</a> to see this example on smartclient.com</p></div>");
    				htmlFlow.setWidth100();
    				hLayout.addMember(htmlFlow);
    			}
    		} else {
    			HTMLFlow htmlFlow = new HTMLFlow("<div class='explorerCheckErrorMessage'><p>This example is disabled in this SDK because it requires the optional "
    					+ "<a href=\"http://www.smartclient.com/product/index.jsp#analytics\" target=\"_blank\">Analytics module</a>.</p>"
    					+ "<p>Click <a href=\"http://www.smartclient.com/smartgwtee/showcase/#multiSeriesChart\" target=\"\">here</a> to see this example on smartclient.com</p></div>");
    			htmlFlow.setWidth100();
    			hLayout.addMember(htmlFlow);
    		}
    
    		hLayout.show();
    Below is ChartData

    Code:
    public class ChartData extends Record {
    
    	public ChartData(String fail, float quantity) {     
            setAttribute("Top", fail);   
            setAttribute("quantity", quantity);    
        }   
      
        public static ChartData[] getData() {   
            return new ChartData[] {   
                new ChartData("Top1", 65f),
                new ChartData("Top2", 14f),
                new ChartData("Top3", 9f),
                new ChartData("Top4", 7f),
                new ChartData("Top5", 2f)
            };   
        }   
    }
    Attached Files
Working...
X