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

World Hand Hygiene Day丨Teach you the correct hand washing posture

To prevent COVID-19, good hand hygiene is a key p...

Top 10 skills mobile game developers must master

If you want to design a game that pleases your pe...

The sun is smiling strangely, what does this indicate?

Have you ever seen the sun smile? Here is a photo...

Build a user rating system from 0 to 1

Huahua is a product operator at an e-commerce com...