我尝试过很多图表,但没有取得成功。所有图表将分别使用监视器和GPS基于心率和平均实时更新速度动态更新。
答案 0 :(得分:0)
您可以使用高级图表在线创建。并在Native应用程序中实现。下载HTML文件并根据需要在评论部分设置类似的内容。
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)
}