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

The second half of Android developers

In 2018, the entire mobile Internet entered the s...

WeChat Reading - How to use social reading apps

From the perspective of event operation and user ...

2021 New Consumer Brand Digitalization Report

China has become the world's second largest c...

Let’s talk about 5 aspects: How to do brand cross-border marketing?

Cross-border marketing is the process of combinin...

How do you plan an event that everyone wants to attend?

Now with a mobile phone in hand, everyone can hav...

Sony: There are a large number of "defectors" among PS4 players

Sony's PS4 game console has sold more than 7 m...

How should the routing antenna be placed to achieve faster Internet speed?

Recently, there has been a lot of controversy onl...

Where can I buy fresh dog meat?

Where should I buy dog ​​meat online? Where can I...

Commonly rejected advertising materials and coping skills!

In daily work, I often hear the cries of operatio...