ios 图表_在ios应用中实现蜘蛛网图表

ios 图表

Spider web charts are great tool for visualizing data in your app. They are compact, convey a lot of info and look cool. This article shows you how you can add spider web charts to your iOS app using SpiderWebChart pod.

蜘蛛网图表是用于可视化应用程序中数据的出色工具。 它们紧凑,传达了很多信息,看上去很酷。 本文向您展示了如何使用SpiderWebChart窗格将蜘蛛网图表添加到iOS应用中。

Let’s start by importing the pod. Simply add the following line to your Podfile

让我们从导入Pod开始。 只需Podfile添加到您的Podfile

pod 'SpiderWebChart'

In the view controller where you want to display the chart simply add the following code snippet and modify the view frame.

在要显示图表的视图控制器中,只需添加以下代码片段并修改视图框架。

func addSpiderWebChartView() {
    // Create a Spider Web Chart View with desired frame
    let graphView = SpiderWebChartView(frame: CGRect(x: 12.5,
                                                     y: 200,
                                                     width: 350,
                                                     height: 350))
    
    // Add the text for parameters
    graphView.parameters = ["Creativity", "Curiosity", "Eye For Detail", "Enthusiasm",
                            "Patience", "Risk Taking", "Resourcefulness", "Perseverance"]
    
    // Add the parameter values 0.0 - 1.0 for scale 1, 0.0 - 100.0 for scale 100
    graphView.parameterValues = [0.90, 0.78, 0.88, 0.75, 0.84, 0.65, 0.83, 0.95]
    graphView.scale = 1
    
    // Set background color of the view
    graphView.backgroundColor = UIColor.clear
    
    // Add the graph to the view
    self.view.addSubview(graphView)
  }

This creates a spider web chart that looks like:

这将创建一个蜘蛛网图表,如下所示:

Image for post

You can check all the available customization options in the README.

您可以在README中检查所有可用的自定义选项。

翻译自: https://medium.com/swlh/implement-a-spider-web-chart-in-ios-apps-797fad44751b

ios 图表

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值