开发者

background image property not being set properly

following this example http://teethgrinder.co.uk/open-flash-chart/gallery-bg-image.php

I'm trying

import com.extjs.gxt.charts.client.model.ChartModel

ChartModel cm = new ChartModel(graphTitle, "color: #738995;font-weight: bold;font-size: 20px; font-family: arial; text-align: left;");
 cm.setBackgroundColour("ffffff");

 cm.set("bg_image", "http://teethgrinder.co.uk/open-flash-chart/images/logo.png");
 cm.set("bg_image_x","right");
 cm.set("bg_image_y","top");

without the bg_image(_x,_y) bit everything works with the bit it throws

(String): Error calling method on NPObject! [plugin exception: Error in Actionscript. Use a try/catch block to find error.].

ChartModel cm = getChartModel(dataSet);
        try {
           this.setChartModel(cm);
        } catch (Exception ex)
开发者_如何学编程        {
         GWTMessageHandler.handleInfoMessage(
         "Message ="+ex.getMessage()+
         "Cause = "+ex.getCause()+
         "getLocalizedMessage = "+ex.getLocalizedMessage()+
         "StackTrace="+ex.getStackTrace());
        }

returns Message =(String): Error calling method on NPObject! [plugin exception: Error in Actionscript. Use a try/catch block to find error.].Cause = nullgetLocalizedMessage = (String): Error calling method on NPObject! [plugin exception: Error in Actionscript. Use a try/catch block to find error.].StackTrace=[Ljava.lang.StackTraceElement;@2ff



EDIT: It sounds like the interaction between JavaScript and ActionScript is being hindered by security constraints. Try this security adjustment.


wrap your code in a try/catch block like this and see what it's trying to tell you:

try{
    ChartModel cm = new ChartModel(graphTitle, "color: #738995;font-weight: bold;font-size: 20px; font-family: arial; text-align: left;");
    cm.setBackgroundColour("ffffff");

    cm.set("bg_image", "http://teethgrinder.co.uk/open-flash-chart/images/logo.png");
    cm.set("bg_image_x","right");
    cm.set("bg_image_y","top");
} catch(err:Error) {
    trace("name: " + err.name);
    trace("message: " + err.message);
    trace("problem code: " + err.getStackTrace());
}

Without fiddling with the code, my first guess would be that the following lines should take numbers instead of strings:

cm.set("bg_image_x","200"); //instead of "right"
cm.set("bg_image_y","0"); //instead of "top"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜