google-code-export / tatami

Automatically exported from code.google.com/p/tatami
1 stars 1 forks source link

Chart2D dont work properly in IE8 (It works fine in FireFox) #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Copy the Char2D example in point 4.3.4 in Tatami Programmatic Document.

Chart2D chart = new Chart2D("300px","300px"); 
chart.setTheme("PlotKit.blue"); 
PiePlot<Integer> plot = new PiePlot<Integer>(); 
plot.setFont("normal␣normal␣bold␣12pt␣Tahoma"); 
plot.setFontColor("white"); 
plot.setLabelOffset(40); 
List<Integer> data = Arrays.asList((new Integer[]{4,2,1,1})); 
plot.addSerie(new Serie<Integer>(data)); 
chart.addPlot(plot); 

2. Add chart in RootPanel.
3. Compile and test in FireFox and IE.

What is the expected output? What do you see instead?
I saq a JavaScript Error Message with text 'Invalida argument'

What version of the product are you using? On what operating system?
Tatami 1.3.1, GWT 1.5.3, IE 8. I didnt test it in previous versions of IE.

Please provide any additional information below.

The problem seems to be caused when you are getting offset width and offset
height and the returned value is negative.

Original issue reported on code.google.com by lunarjchav@gmail.com on 24 Feb 2009 at 8:00

GoogleCodeExporter commented 9 years ago
Ok, i fix the bug changing 2 methods in Chart2D.

1.- Constructor. It seems IE hate values ended with "%" in size when it 
calculates
the offeset width/height. The current Chart2D constructor is:

    public Chart2D(String width, String height) {
        DojoController.getInstance().loadDojoWidget(this);
        defineTatamiChart();
        setElement(DOM.createDiv());
        dojoElem = DOM.createDiv();
        DOM.setStyleAttribute(dojoElem, "width", "100%");
        DOM.setStyleAttribute(dojoElem, "height", "100%");
        DOM.appendChild(getElement(), dojoElem);
        setSize(width, height);
    }

If you change 100% in code with any value, you have:

    public Chart2DExt(String width, String height) {
        DojoController.getInstance().loadDojoWidget(this);
        defineTatamiChart();
        setElement(DOM.createDiv());
        dojoElem = DOM.createDiv();
        DOM.setStyleAttribute(dojoElem, "width", "500");
        DOM.setStyleAttribute(dojoElem, "height", "500");
        DOM.appendChild(getElement(), dojoElem);
        setSize(width, height);
    }

2.- adaptSize(). You must test 0 result getting offesets.

    Current adaptSize():

        public void adaptSize() {
        if(dojoWidget != null){
            dojoUpdateSize(dojoWidget,getOffsetWidth(),getOffsetHeight());
        }
    }

      Fixed method:
    public void adaptSize() {
        if (dojoWidget != null) {
            int offsetWidth = getOffsetWidth();
            int offsetHeight = getOffsetHeight();

            if (offsetWidth != 0 && offsetHeight != 0) {
                dojoUpdateSize(dojoWidget, offsetWidth, offsetHeight);
            }
        }
    }

I hope see this bug fixed in 1.3.2 ;)

Original comment by lunarjchav@gmail.com on 24 Feb 2009 at 9:22

GoogleCodeExporter commented 9 years ago
This should be fixed now with the tatami version 1.4. 

Original comment by vgrass...@gmail.com on 9 Oct 2009 at 2:18

GoogleCodeExporter commented 9 years ago
I opened a new defect because this is still a problem in version 1.4.

Joel Rives

Original comment by jmri...@gmail.com on 16 Jun 2011 at 7:23