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

How does a paid content store increase new users?

Since 2016, the concept of "micro-course&quo...

Can Xiaomi become a Fortune 500 company?

This article is reprinted from Fortune Chinese we...

What should you eat for midnight snack? Check out these 5 mistakes you've made.

This summer, the country has been experiencing hi...

Why do humans have menopause? Do animals have menopause?

We have observed a strange phenomenon: most anima...

360 search advertising promotion, keyword quality optimization skills!

What is keyword quality? Keyword quality represen...

How to attract fans on Douyin? How does Tik Tok attract fans?

If there are not enough fans on the Douyin platfo...