This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes GWT and the fly likes GWTCanvas alternatives Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "GWTCanvas alternatives" Watch "GWTCanvas alternatives" New topic
Author

GWTCanvas alternatives

Laura Bickle
Greenhorn

Joined: Aug 22, 2011
Posts: 1
I'm trying to create a chart using GWT. The chart has a grid and x and y axis labels and at least one line indicating status over time. The example code I got from a co-worker uses two classes the com.google.gwt.widgetideas.graphics.client package: GWTCanvas and Color.

The documentation about GWTCanvas says to use Canvas instead, but Canvas has a very limited number of methods. How do I replicate these methods?
- clear()
- setFillStyle(Color color)
- fillRect(double startX, double startY, double width, double height)
- setLineWidth(double width)
- setStrokeStyle(Color color)
- beginPath()
- moveTo(double x, double y)
- lineTo(double x, double y)
- stoke()

Any help is appreciated. Thanks!
-Laura
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

Welcome to the Ranch.

To start with,the Canvas API docs of v2.3 says
This widget may not be supported on all browsers.
I hope you are aware of that. If you want to display charts, you might find this interesting http://code.google.com/p/gwt-google-apis/wiki/VisualizationGettingStarted

Coming back to your question. Check out Canvas#getContext2d.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GWTCanvas alternatives