1. #1
    Ext User
    Join Date
    Feb 2009
    Posts
    18
    Vote Rating
    0
    smfed is on a distinguished road

      0  

    Default ext.ux.ofcgxt - LineChartProvider example

    ext.ux.ofcgxt - LineChartProvider example


    Hi,

    I have some stupid problem with LineChartProvider. I was able to set up BarChartProvider as in the Demo.java and graphs were rendered. But when I am doing the same with LineChartProvider i get the exception. Here is the trace:

    Code:
    [ERROR] Unable to load module entry point class com.sungard.testqa.magellan.client.FastVersions (see associated exception for details)
    java.lang.NullPointerException: null
        at com.extjs.gxt.ui.client.data.NestedModelUtil.isNestedProperty(NestedModelUtil.java:68)
        at com.extjs.gxt.ui.client.data.BaseModelData.get(BaseModelData.java:42)
        at ext.ux.ofcgxt.client.data.ModelChartProvider$2.getStringValue(ModelChartProvider.java:94)
        at ext.ux.ofcgxt.client.data.LineChartProvider.updateChartModelData(LineChartProvider.java:97)
        at ext.ux.ofcgxt.client.data.BaseModelChartBuilder.buildJsonData(BaseModelChartBuilder.java:77)
        at ext.ux.ofcgxt.client.GxtChartWidget.refresh(GxtChartWidget.java:64)
        at ext.ux.ofcgxt.client.GxtChartWidget.setModelChartBuilder(GxtChartWidget.java:78)
        at com.sungard.testqa.magellan.client.FastVersions.onModuleLoad(FastVersions.java:90)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:320)
        at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:329)
        at com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$300(BrowserWidgetIE6.java:37)
        at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6.java:76)
        at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke(BrowserWidgetIE6.java:139)
        at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
        at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
        at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
        at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
        at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
        at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
        at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
        at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)
    Probably there is something wrong with my store?? But it is very simple. If anyone can have a look at this or simply give me the code of working LineChart it would be great!

    Here is the code:
    Code:
            final ListStore<Duration2> store2 = new ListStore<Duration2>();
            store2.add(new Duration2("Q1", 2));
            store2.add(new Duration2("Q2", 1));
            store2.add(new Duration2("Q3", 3));
            store2.add(new Duration2("Q4", 5));
    
            final GxtChartWidget chart1 = new GxtChartWidget();
              
    
             BaseModelChartBuilder builder = new BaseModelChartBuilder();
            
             final LineChartProvider<Duration2> lcp = new LineChartProvider<Duration2>(LineChart.LineStyle.NORMAL, "alphasales");
             lcp.setStore(store2);
           
             builder.getChartData().setTitle(new Text("Sales by Qtr (Alpha & Beta Teams)"));
             builder.getChartData().setBackgroundColour("#eeeeee");
             builder.addProvider(lcp);
             betacp.getBarChart().setColour("#00aa00");
            
             chart1.setModelChartBuilder(builder);
    
            
            cont.add(chart1, new RowData(1f, 0.65f));
            view.add(cont, new BorderLayoutData(LayoutRegion.CENTER));
            RootPanel.get().add(view);
    
    ........
    public class Duration2 extends BaseModel {
            /**
             * 
             */
            private static final long serialVersionUID = -2697488328170513282L;
    
            public Duration2(String qtr, double a) {
                setQtr(qtr);
                setAlphaSales(a);
                
            }
    
            public void setQtr(String qtr) {
                set("qtr", qtr);
            }
    
            public String getQtr() {
                return get("qtr");
            }
    
            public void setAlphaSales(double sales) {
                set("alphasales", sales);
            }
    
            public String getAlphaSales() {
                return get("alphasales");
            }        
    
        }
    Thank you,
    Stepan

  2. #2
    Ext User
    Join Date
    Feb 2009
    Posts
    18
    Vote Rating
    0
    smfed is on a distinguished road

      0  

    Default


    So i ve done some debuging the problem is in this line of code:i
    Code:
    String label = labelProvider.getStringValue(m, modelXValue);
    in file LineChartProvider

    our modelXValue in null because we didn't set it anywhere. And here is the mistery part, I don't know what happened to me but I was pretty damn sure that when instantiating LineChartProvider we can only state yvalue, which is aparently not true.
    Code:
    new LineChartProvider<Duration2>(LineChart.LineStyle.NORMAL, "alphasales", "qtr");
    I knew that the problem was very stupid and it was me. Any way why would anyone need to instntiate LCP only with yvalue, so I am going to blame developer for this. Just a joke. It is a really nice stuff. Thanks for this one