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

Practical tips: How to promote an event well?

First, let me give you a few tips: Tip 1: How to ...

Galanz sues Tmall for alleged abuse of market dominance

On November 5, 2019, Galanz released an announcem...

How to use data to analyze whether an operation project is going well or not?

Recently, my friends often ask me the following q...

They are most afraid of you going to the hospital...

“As long as you can hold it in, there is no need ...

Traffic War: How do I operate e-commerce on JD.com (Part 2)

The top-level structure of traffic logic ① Accura...

Gout equals "pain madness"? You must pay attention to these foods!

Our dad’s review, there is a Mr. Guo who does not...

Briefly talk about 20 laws of brand communication

Once the defense is broken, it will kill instantl...

Your color is quite nice! Do "chameleons" really exist among fish?

Produced by: Science Popularization China Author:...

The unity of aging and evolution: Why do lifespans vary so much across species?

We can understand aging from an evolutionary pers...

Do you know how to solve the 3 most important equations in APP operation?

During APP operation , there are a large number o...