Hello:
I found a solution that seems to work great with SmartGWT. What I did was download the code for the GWT OFCGWT project. I then changed one class and recompiled the project and now I have charts that do not disappear when resizing and seemed to resize with absolutely no problem.
The source code that I modified is ChartWidget. It now extends the com.smartgwt.client.widgets.Canvas class.
I've attached the file so you can look at it yourself. I'm not sure if I'm allowed to upload the entire jar file legally (I think I can because its open source code) but if I am I'm more than happy to share this with everyone.
Example:
--
Chris Hodges
I found a solution that seems to work great with SmartGWT. What I did was download the code for the GWT OFCGWT project. I then changed one class and recompiled the project and now I have charts that do not disappear when resizing and seemed to resize with absolutely no problem.
The source code that I modified is ChartWidget. It now extends the com.smartgwt.client.widgets.Canvas class.
I've attached the file so you can look at it yourself. I'm not sure if I'm allowed to upload the entire jar file legally (I think I can because its open source code) but if I am I'm more than happy to share this with everyone.
Example:
Code:
WidgetCanvas wc = new WidgetCanvas(createSampleChart()); wc.setHeight100(); wc.setWidth100(); //Then add to wherever you need it... protected Canvas createSampleChart() { ChartWidget chart1 = new ChartWidget(); ChartData cd1 = new ChartData( "Sales by Month 2006", "font-size: 14px; font-family: Verdana; text-align: center;" ); cd1.setBackgroundColour( "#ffffff" ); XAxis xa = new XAxis(); xa.setLabels( "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D" ); xa.setMax( 12 ); cd1.setXAxis( xa ); YAxis ya = new YAxis(); ya.setSteps( 16 ); ya.setMax( 160 ); cd1.setYAxis( ya ); BarChart bchart1 = new BarChart( BarStyle.NORMAL ); bchart1.setTooltip( "$#val#" ); bchart1.addValues( 133, 123, 144, 122, 155, 123, 135, 153, 123, 122, 111, 100 ); cd1.addElements( bchart1 ); //chart1.setSize( "100%", "100%" ); chart1.setWidth100(); chart1.setHeight100(); chart1.setJsonData( cd1.toString() ); HTML label1 = new HTML( "<u>Normal Bar Chart</u>" ); label1.setWidth( "100%" ); label1.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER ); return chart1; }
Chris Hodges
Comment