Fusionchart无法以正确的帧呈现

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Fusionchart无法以正确的帧呈现相关的知识,希望对你有一定的参考价值。

[enter image description here]之前我曾使用UIWebView和具有正确框架的图表显示FusionCharts。现在由于不赞成使用UIWebView,所以我将其替换为WKWebView。html文档中的相关图表或javascript函数均未进行代码更改。文件中有一个js函数,我在其中使用数据作为参数发送此函数来创建FusionChart。但是现在图表没有正确的框架。

类ViewController:UIViewController,WKUIDelegate,WKNavigationDelegate {

var webView: WKWebView!
var graphString = "{ "chart": { "xaxisname":"Months", "yaxisname":"Total No Of Claims", "caption":"Claims By Month", "palette":"0", "showValues":"1", "numberPrefix":"", "useRoundEdges":"1", "animation":"1", "numdivlines":"2", "numberprefix":"", "yaxisminvalue":"0", "showborder":"0", "exportEnabled":"0", "formatNumberScale":"0"},"categories":[{ "category":[{"label":"Jun_2019","stepSkipped":"false", "appliedSmartLabel":"true", "showlabel":"1" },{"label":"Jul_2019","stepSkipped":"false", "appliedSmartLabel":"true", "showlabel":"1" },{"label":"Aug_2019","stepSkipped":"false", "appliedSmartLabel":"true", "showlabel":"1" },{"label":"Sep_2019","stepSkipped":"false", "appliedSmartLabel":"true", "showlabel":"1" }]}],"dataset":[{"seriesname":"Accepted", "data": [{"value":"1808", "link":""},{"value":"1281", "link":""},{"value":"25", "link":""},{"value":"7", "link":""}]},{"seriesname":"Adjusted", "data": [{"value":"8", "link":""},{"value":"", "link":""},{"value":"7", "link":""},{"value":"1", "link":""}]},{"seriesname":"Correction Needed", "data": [{"value":"", "link":""},{"value":"34", "link":""},{"value":"1", "link":""},{"value":"", "link":""}]},{"seriesname":"Paid", "data": [{"value":"404", "link":""},{"value":"1", "link":""},{"value":"3", "link":""},{"value":"4", "link":""}]},{"seriesname":"Part Return", "data": [{"value":"40", "link":""},{"value":"75", "link":""},{"value":"1", "link":""},{"value":"1", "link":""}]},{"seriesname":"Rejected", "data": [{"value":"198", "link":""},{"value":"96", "link":""},{"value":"15", "link":""},{"value":"4", "link":""}]},{"seriesname":"Waiting For Approval", "data": [{"value":"1", "link":""},{"value":"541", "link":""},{"value":"11", "link":""},{"value":"10", "link":""}]}] }"


override func loadView() {
    let webConfiguration = WKWebViewConfiguration()
    webView = WKWebView(frame: .zero, configuration: webConfiguration)
    webView.uiDelegate = self
    webView.navigationDelegate = self
    view = webView
}

override func viewDidLoad() {
    super.viewDidLoad()

   // let webView = WKWebView()
    //let htmlPath = Bundle.main.path(forResource: "chart", ofType: "html")
   // let htmlUrl = URL(fileURLWithPath: htmlPath!, isDirectory: false)
   // webView.loadFileURL(htmlUrl, allowingReadAccessTo: htmlUrl)
    //view = webView

    createGraph()
}

func createGraph()
{
    var path = ""
    let thisBundle = Bundle.main
    path = thisBundle.path(forResource: "columncharts", ofType: "html") ?? ""
    let instructionsURL = URL(fileURLWithPath: path)
    var htmlString: String? = nil
    do {
        htmlString = try String(contentsOfFile: path, encoding: .utf8)
    } catch {
    }
    self.webView.loadHTMLString(htmlString!, baseURL: instructionsURL)
}



func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {


        let graphFunction = String(format: "showChart(%@,%f,%f,%ld)", self.graphString, self.view.frame.size.width, self.view.frame.size.height, 1)
        webView.evaluateJavaScript(graphFunction, completionHandler: nil)

}[![Expected Result][1]][1]
 [![INcorrect Result][2]][2]
答案

同样也无法呈现图表。以前它为我工作,然后突然停止工作。

以上是关于Fusionchart无法以正确的帧呈现的主要内容,如果未能解决你的问题,请参考以下文章

调用 layoutIfNeeded 后 Snapkit 3.0 无法获得正确的帧

使用 jquerymobile 的移动 Web 应用程序的背景图像无法以 iphone 横向正确呈现?

更改高度时,UITextView 的 textContainer 在错误的帧处呈现

使用片段时 Intellij 无法正确识别 Thymeleaf 模型变量

为啥我的 Ray March 片段着色器反射纹理查找会减慢我的帧速率?

fusionChart 未使用 Json 和 C# 加载动态数据