Draw custom charts in watchOS

Draw custom charts in watchOS

Source code introduction: watchOS does not have a UIView class, so YOChartImageKit is used to implement drawing UIImage for charts of custom values.

You can draw line charts, bar charts, doughnut charts, etc., and you can adjust the display options for each.

Source code effect:

Source code snippet:

  1. let image = YOLineChartImage()
  2. image.strokeWidth = 4.0                // width of line  
  3. image.strokeColor = randomColor() // color of line  
  4. image.values ​​= [ 0.0 , 1.0 , 2.0 ] // chart values  
  5. image.smooth = false                   // disable smooth line  
  6. image.drawImage(frame, scale: scale) // draw an image  

Download address: http://download..com/data/2070668

<<:  E-commerce platform HighstreetWatchApp

>>:  Apple's R&D spending exceeds $2 billion for the first time. How much of it went to programmers?

Recommend

Why do we Chinese prefer iPhone 6 plus?

One of the characteristics of the Internet is tha...

Advanced Software Test: System Architecture Designer Elite Class 2022 5th

Course Catalog ├──1–Understanding Cognition (Pre-c...

Are you still using Python 2? You’re about to be eliminated!

[[132462]] Python 2.7 will end support in 2020, a...

Dinosaurs are not completely gone. Look up if you don't believe me.

Dinosaurs are known to almost everyone. These pre...

How to use the Golden Circle Rule to write a marketing promotion plan?

Double 11, Double 12, Christmas Eve and other fes...

How to deal with plural nouns in iOS project internationalization

The way to handle plural nouns in the internation...

Prosecutors reveal the "four crimes" of Alipay fraud

With the increasing number of Alipay users, crimin...

WiFi for outbound travel: a small but big business

When traveling, taking a few photos and posting t...

A Preliminary Study on WeChat Mini Programs

[[174033]] In the early morning of September 22, ...