Package org.richfaces.sandbox.chart.component

Examples of org.richfaces.sandbox.chart.component.AbstractSeries


           
           
            if (target instanceof AbstractLegend) {
                copyAttrs(target, chart, "", asList("position", "sorting"));
            } else if (target instanceof AbstractSeries) {
                AbstractSeries s = (AbstractSeries) target;
                ChartDataModel model = s.getData();
               
                //Collect Series specific handlers
                Map<String,Object> optMap = new HashMap<String, Object>();
                RenderKitUtils.Attributes seriesEvents = attributes()
                .generic("onplothover","onplothover","plothover")
              .generic("onplotclick","onplotclick","plotclick");
               
                addToScriptHash(optMap, context.getFacesContext(), target, seriesEvents, RenderKitUtils.ScriptHashVariableWrapper.eventHandler);
               
                if(optMap.get("onplotclick")!=null){
                    plotClickHandlers.put(new RawJSONString(optMap.get("onplotclick").toString()));
                }
                else{
                    plotClickHandlers.put(s.getOnplotclick());
                }
               
               
                if(optMap.get("onplothover")!=null){
                    plothoverHandlers.put(new RawJSONString(optMap.get("onplothover").toString()));
                }
                else{
                    plothoverHandlers.put(s.getOnplothover());
                }
                //end collect series specific handler
               
               
                if (model == null) {
                    /**
                     * data model priority: if there is data model passed
                     * through data attribute use it. Otherwise nested point
                     * tags are expected.
                     */
                    VisitSeries seriesCallback = new VisitSeries(s.getType());
                    s.visitTree(VisitContext.createVisitContext(FacesContext.getCurrentInstance()), seriesCallback);
                    model = seriesCallback.getModel();
                   
                    //if series has no data create empty model
                    if(model==null){
                      switch (s.getType()) {
            case line:
              model = new NumberChartDataModel(ChartType.line);
              break;
            case bar:
              model = new NumberChartDataModel(ChartType.bar);
              break;
            case pie:
              model = new StringChartDataModel(ChartType.pie);
              break;
            default:
              break;
            }
                    }
                    else{
                      nodata=false;
                    }
                }
                else{
                  nodata=false;
                }
                model.setAttributes(s.getAttributes());
               
                try {
                    //Check model/series compatibility
                   
                    if(chartType==null && (!nodata)){
View Full Code Here

TOP

Related Classes of org.richfaces.sandbox.chart.component.AbstractSeries

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.