1. #1
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Thumbs up ext.ux.ofcgxt - ChartWidget

    ext.ux.ofcgxt - ChartWidget


    UPDATE 13/02/2009 : Valentine's Day release - v1.3.0 new multi-model providers/store - sync with 1.3 of OFCGWT.
    UPDATE 24/12/2008 : Xmas eve release - v1.2.1 new model providers, new autoscale and label strategy.
    UPDATE 14/12/2008 : v1.2 released synced with OFCGWT (new charts/onclick)
    UPDATE 18/10/2008 : beta4 released with new charts and fixes


    OpenFlashChart widget for GXT -> http://code.google.com/p/ext-ux-ofcgxt/

    ChartWidget wraps a flash chart object and adds support for model/store and integrates as a normal GXT widget.

    Instructions and details on the google code website link above.

    enjoy !!

    Grant
    Attached Images

  2. #2
    Sencha User
    Join Date
    Aug 2008
    Posts
    226
    Vote Rating
    2
    TheBuzzer is on a distinguished road

      0  

    Default


    nice job. looks great.

    no clue what I could use this widget for. ya I dont have a use for charts with the stuff I am doing but still really nice. Will be helpful for ppl that needs to draw charts

  3. #3
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    Quote Originally Posted by TheBuzzer View Post
    nice job. looks great.

    no clue what I could use this widget for
    the demo provided on the website gives an example use case - as a way of better showing related information - often if you are using a grid/table/tree then you probably can benefit from graphing that same information

  4. #4
    Sencha User
    Join Date
    Aug 2008
    Posts
    226
    Vote Rating
    2
    TheBuzzer is on a distinguished road

      0  

    Default


    The only chart i could think of is to make the program i am doing have a total section where it shows the cost and profits as a graph.

    but i dont think i going to do that yet.

    maybe in the future. but still might be using this if i am.

    still trying to rewrite my whole gwt project using gxt and ui changed a lot.

    It isnt a easy task but I am liking the result of what I am doing so far but still wish I have other ppl helping me and not just a lone developer working in a company.

  5. #5
    Ext User
    Join Date
    Sep 2008
    Posts
    3
    Vote Rating
    0
    piprog is on a distinguished road

      0  

    Default


    Good work Grant, much appreciated!

  6. #6
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    beta4 release based on OFCGWT v1.0.1 and fixes for window/portal bug
    Attached Images

  7. #7
    Ext GWT Premium Member dardison's Avatar
    Join Date
    Apr 2008
    Location
    Buenos Aires, Argentina
    Posts
    174
    Vote Rating
    1
    dardison is on a distinguished road

      0  

    Post Scale calculation for BarChartProvider

    Scale calculation for BarChartProvider


    Hi Grant and all,

    I think I finally resolved the issue on calculating the Y Scale on BarChart Charts.
    What I did is modify the updateChartModelData method code in order to introduce a method to calculate Scale in order to BarChart renders properly with big Y values.

    I tested and I'm using this code.
    I posted here because I think it could help others.

    Here is the code changes I made in BarChartProvider class:

    Code:
        public void updateChartModelData(List<M> models) {
            Integer maxValue=this.getMaxYValue(models);
            Scale scale=this.calculateBaseScale(maxValue);
            bc.getValues().clear();
            chartData.getXAxis().setXAxisLabels(null);
            chartData.getYAxis().setMax(scale.getBase().intValue());
            chartData.getYAxis().setMin(0);
            chartData.getYAxis().setSteps(scale.getInterval().intValue());
            for (M m : models) {
                if (modelXLabel != null) chartData.getXAxis().addLabels((String)m.get(modelXLabel));
                Object v = m.get(modelYValue);
                if (v instanceof String) {
                    bc.addValues(new Double((String)v));                
                }
                else {
                    bc.addValues((Number)v);
                }
            }
        }
        
        protected Scale calculateBaseScale(Integer maxValue){
            double result=0;
            double interval=0;
            int divideCount=0;
            Double base=0.0;
            int intBase;
            boolean found=false;
            result=maxValue;
            if(result>1000){
                while(!found){
                    result=result / 1000;
                    divideCount++;
                    if(result<1000){
                        found=true;
                    }
                }
            }
            if(result<1000 && result>=500){
                interval=100;
            }
            if(result<500  && result>=200){
                interval=50;
            }
            if(result<200  && result>=100){
                interval=20;
            }
            if(result<100  && result>=50){
                interval=10;
            }
            if(result<50   && result>=20){
                interval=5;
            }
            if(result<20   && result>=10){
                interval=2;
            }
            if(result<10   && result>=5){
                interval=1;
            }
            if(result<5    && result>=2){
                interval=0.5;
            }
            if(result<2    && result>=1){
                interval=0.2;
            }
            base=result/interval;
            intBase=base.intValue();
            base=intBase*interval;
            for(int i=0; i<divideCount;i++){
                base=base*1000;
                interval=interval*1000;
            }
            base=base+interval;
            Scale scale=new Scale(base, interval);
            return scale;
        }
        
        protected Integer getMaxYValue(List<M> models){
            Double maxValue=0.0;
            Double currentValue;
            for(M m : models){
                Object v = m.get(modelYValue);
                if (v instanceof String) {
                    currentValue=new Double((String)v);                
                }else {
                    currentValue=(Double)v;
                }
                if(currentValue>maxValue)
                    maxValue=currentValue;
            }
            return maxValue.intValue();
        }
        
        /**
         * Gets the model y value.
         * 
         * @return the model y value
         */
        public String getModelYValue() {
            return modelYValue;
        }
    
        /**
         * Sets the model y value.
         * 
         * @param value the new model y value
         */
        public void setModelYValue(String value) {
            this.modelYValue = value;
        }
    
        /**
         * Gets the model x label.
         * 
         * @return the model x label
         */
        public String getModelXLabel() {
            return modelXLabel;
        }
    
        /**
         * Sets the model x label.
         * 
         * @param modelXLabel the new model x label
         */
        public void setModelXLabel(String modelXLabel) {
            this.modelXLabel = modelXLabel;
        }
    
        /**
         * Gets the bar chart.
         * 
         * @return the bar chart
         */
        public BarChart getBarChart() {
            return bc;
        }
    
        /**
         * Sets the bar chart.
         * 
         * @param bc the new bar chart
         */
        public void setBarChart(BarChart bc) {
            this.bc = bc;
        }
        
        protected class Scale{
            private Double base;
            private Double interval;
            
            protected Scale(Double base, Double interval){
                this.interval=interval;
                this.base=base;
            }
            
            protected Double getBase(){
                return base;
            }
            
            protected Double getInterval(){
                return interval;
            }
        }
    The changes are:

    Method to calculate the Max Value from a List of Models : getMaxYValue(models).
    The Private Scale class to hold base and interval values
    Method to calculate the Scale giving maxValue : calculateBaseScale(maxValue).

    Please feel free to use this code.
    Regards.

    Daniel

  8. #8
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    UPDATE 14/12/2008 : v1.2 released synced with OFCGWT (new charts/onclick)

  9. #9
    Ext User
    Join Date
    Dec 2008
    Location
    Shanghai,China
    Posts
    2
    Vote Rating
    0
    116708828 is on a distinguished road

      0  

    Thumbs up I want a gantt chart

    I want a gantt chart


    I want a gantt chat ,could you make a plugins? Thank you
    a GXT tenderfoot

  10. #10
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    OFCGXT is based on OFC (http://teethgrinder.co.uk/open-flash-chart-2/) so really, if you want a new chart, you'd be best asking the OFC developer.