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](https://img-blog.csdnimg.cn/img_convert/efd9ba4928c956c3687078219f714cb2.png)
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 图表