0

I am working on a POC (for an existing application) to implement charts in Apple Watch (Analytics for Business/Enterprise data). I have seen a video from Saleforce tool that they include options for showing graphs and charts in Apple Watch.

I went through the documentation of Apple Watch and I am not able to find out a documentation for drawing (like we have in usual iOS applications) graphs/chart programmatically in the UI.

So I went and checked Telerik examples and looks like they are using images of charts (which they will have to run in iPhone first and then take a screenshot) and pass it to Apple Watch using shared groups.

Is there a way for us to draw dynamically in a Apple Watch interface (with in the watch app) without opening and passing the image from iPhone app?

Example from salesforce below:

enter image description here

enter image description here

Please advise a direction to go ahead with this implementation. Any help on this is highly appreciated

3 Answers3

1

I guess no. I read it from the project at: https://github.com/hmaidasani/RadialChartImageGenerator

The way Apple WatchKit SDK allows animations or visualizations is to use a sequence of static images (WatchKit Design Guidlines). In fact, Apple's own WatchKit sample app called Lister does animations of this radial progress chart using 360 different static images of the chart. The reason for this is that drawing pixels or shapes would require a lot of computation and drain the battery of the watch. So, good luck creating hundreds of images by yourself.

supNate
  • 432
  • 3
  • 10
1

Ok so watch os 2 is here and there are definitely better ways to animate things.

https://github.com/shu223/watchOS-2-Sampler contains an example of a few shapes that are dynamically rendered with Core Graphics. The circle example can easily be turned into a bar graph, and I'm sure rendering a line graph is doable. Haven't tried, but you can basically use the image interface element as a blank canvas and you just save whatever you render as an image.

Chuck Dries
  • 1,630
  • 13
  • 19
0

You can use images instead of showing charts. You can view charts in your iphone and convert those charts into image (screenshot) and push it as NSData to your watch as you mentioned above. Another way is basic charts you can display on apple watch like bar-chart, radial-chart, line-chart. You have to pass the data and basic charts you can see on apple watch. That example is already implemented, check on google you'll find.

Piyush
  • 51
  • 6