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

Ximalaya's "423 Listening Festival" promotion strategy

Friends who don’t pay much attention to the knowl...

If these scenes cannot be connected, O2O will not have a perfect ending

[[158286]] The title of CEO has changed from a sy...

How ferocious are wolves? Can an adult man holding an iron stick fight a wolf?

Although wolves are basically harmless to humans ...

Let’s talk about how to increase followers on apps like Tik Tok and Zhihu!

Today let’s talk about the issue of increasing fo...

Why are your conversions always so low?

As bidders, we may also be familiar with the term...

User Recall and Activation: 7 Case Studies on User Loss and Activation

Activation and recall are also top priorities in ...

Buyers, don't let suppliers tie your laptop to purchasing data analysis

At a procurement forum, the procurement director ...

Mid-Autumn Festival Marketing: How to Create a “High-Level” Marketing Effect?

In the book “It’s Rare in Life to Be Calm”, Mr. L...

There are so many types of myopia glasses. Which one is suitable for your child?

Nowadays, there are many myopia glasses available...