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

Why is short video promotion and marketing so popular? How to play?

Driven by the trends of video mobility, informati...

Make money by operating Tik Tok, here are the detailed methods!

Yesterday I introduced to you a money-making proj...

Typhoon Siam is approaching! It will make landfall today

Typhoon Siam, the third typhoon this year, is app...

Channel promotion: All the things you don’t know are here

He used to work for a large Internet company, whe...

Just now, iOS WeChat released the official version 8.0.12

Surprisingly, iOS WeChat was updated again today....

How to create highly sticky products? Teach you 3 models

What is CLV? You must understand this word when m...

Mobile phone processors: basically all have to be clean

When Nokia, Blackberry, and Motorola fell one afte...

Practical operation of Douyin account in K12 education industry!

As the proportion of short videos in the content ...