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

Can earthquake clouds and animal perception predict earthquakes?

In fact, in life, we often hear rumors about eart...

Pop Mart private domain operation method case

At the end of March, Pop Mart released its 2021 f...

Hu Q&A丨Why do nuclear submarines run so fast?

Where do nuclear submarines run faster? First, ru...

Tips for placing advertising on Tencent’s information flow!

As more and more industries move from the era of ...

Can alcohol be used to clean mobile phone screens?

During the epidemic, various disinfectants and cl...

Event promotion: Improve the conversion rate of offline activities?

This article will use offline activity cases to a...

Thinking Upgrade-How to Upgrade Thinking Model to Pursue Compound Interest Life

Thinking Upgrade - How to Upgrade Thinking Models...

How bad will your body become after losing these 6 things?

Calcium: 99% of calcium is found in bones and tee...

There are so many benefits of staying in bed in winter! Even doctors recommend it!

Source: Life Times Review|Li Nannan Director of H...