• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

GWTCanvas alternatives

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic