我需要帮助来绘制图形,如iOS的附加截图

时间:2018-04-17 05:42:15

标签: ios objective-c iphone graph linechart

我尝试过很多图表,但没有取得成功。所有图表将分别使用监视器和GPS基于心率和平均实时更新速度动态更新。

  1. 此图表将显示用户在特定区域花费了多少时间的数据。

  2. 此设计将根据百分比显示完成挑战,其他用户的个人资料将按完成百分比移动。

  3. 此设计将在练习期间显示1至5区范围内的心率,我想在第1张图像上绘制相同的数据(第一张图像上方)。橙色的白色部分是一个指示器,它将遵循相同设计中显示的心率计数的不同颜色路径。

  4. This graph will show the data that user had spent how much time in a particular zones.

    This design will show the completion of challenge based on the percentage, other user's profile will move with the percentage of completion.

    This design will show heart rate during the exercise for range from zone 1to 5, Same data will available which i want to draw on image no 1(Above first image). White portion in orange colour is a indicator which will follow the different colour path as per heart rate count shown in same design.

1 个答案:

答案 0 :(得分:0)

您可以使用高级图表在线创建。并在Native应用程序中实现。下载HTML文件并根据需要在评论部分设置类似的内容。

Highcharts

        func drawChart(barsData:NSMutableArray){

        let jsonData = try! JSONSerialization.data(withJSONObject: barsData, options: (JSONSerialization.WritingOptions(rawValue: 0)))
        let theJSONText = NSString(data: jsonData,
                                   encoding: String.Encoding.ascii.rawValue)
        let htmlFile: String? = Bundle.main.path(forResource: "YourHTML", ofType: "html")
        var htmlString = try? String(contentsOfFile: htmlFile!, encoding: String.Encoding.utf8)

        let oldWdith = "<div id=\"container\" style=\"min-width: 380px; height: 180px; margin: 0 auto\"></div>"
        let ReplaceWdith = "<div id=\"container\" style=\"min-width: \(width)px; height: 180px; margin: 0 auto\"></div>"
        htmlString = htmlString?.replacingOccurrences(of: oldWdith, with: ReplaceWdith)
        yourWbview.stringByEvaluatingJavaScript(from: htmlString! as String)
        yourWbview.loadHTMLString(htmlString!, baseURL: nil)

}