Post new topic Reply to topic  [ 2 posts ] 

Board index : GWT-Ext Forums : GWT-Ext 2.x Help

Author Message
 Post subject: YUI chart style setting through chartConfig
PostPosted: Sat Jan 03, 2009 7:25 pm 
Offline

Joined: Sat Jan 03, 2009 5:46 pm
Posts: 2
Hi,

first post here and fairly new to gwt and gwt-ext so please don't beat me up if this sounds too basic...

I've been experimenting with gwt-ext charts for the past couple of weeks and I've been trying to set the animationEnabled style parameter for a YUI ColumnChart (through gwt-ext) without any luck.

Looking at the documentation for basic styling here it looks like standard CSS but it's NOT ! ! !

From the link above:
Quote:
Because the Charts Control is powered by Flash Player, standard browser CSS is not available for styling individual subcomponents of a chart. Instead, styleable properties are exposed through a style attribute on the chart itself. This hash accepts a standardized set of style values for things like border, background, fonts, padding, axis styles, and datatip styles.


To cut a long story short this means that we need access to the chartConfig member declared in com.gwtext.client.widgets.chart.yui.ChartPanel so I've added an accessor method for that member.

I've also added a "convenience" method for the particular property I want to disable (animationEnabled) but that's not very clean. I suspect that the proper way to do is to create a new ChartStyle class that contains all the properties defined in the above link and is accessible through a set of ChartStyle getter/setter methods (similar to the Axis class handling the xAxis and yAxis parameters).

I might actually get to do this myself depending on how the project (based on gwt-ext) the company I work for is going to progress so that other members of the community can have access to it...

What I would like to know for now is if what I'm saying makes sense or if there's another way to modify the style properties or even access the chartConfig object.

Finally this seems to be a very similar request to what's been asked in the topic below, so I'm bumping it as well.
How to insert a legend in a chart ?

Cheers,
Vas.


P.S.: for those who're interested here's how I've modified ChartPanel
Code:
    public JavaScriptObject getChartConfig(){
       return chartConfig;
    }
   
    public void setAnimationEnabled(boolean animationEnabled){
       JavaScriptObject styleObject = JavaScriptObjectHelper.getAttributeAsJavaScriptObject(chartConfig, "style");
       if (styleObject == null) {
          styleObject = JavaScriptObjectHelper.createObject();
       }
       JavaScriptObjectHelper.setAttribute(styleObject, "animationEnabled", animationEnabled);
       JavaScriptObjectHelper.setAttribute(chartConfig, "style", styleObject);
    }


Back to top
 Profile  
 
 Post subject: Re: YUI chart style setting through chartConfig
PostPosted: Thu Jan 14, 2010 10:53 am 
Offline

Joined: Mon May 19, 2008 6:48 am
Posts: 10
One useful tip:

As chartConfig member has protected access in ChartPanel, one can extend LineChart/ColumnChart etc. in his own code and provide a method setAnimationEnabled(boolean) in his implementation i.e. no need to modify ChartPanel and build gwt-ext jar!!

Regards,
Vikas Garg


Back to top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

Board index : GWT-Ext Forums : GWT-Ext 2.x Help


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Style by Midnight Phoenix & N.Design Studio
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.