我写了一个,你可以参照下,每次重新加载页面后,可以更改echar数据(根据你的需要)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
WebBrowser1.Navigate(AppDomain.CurrentDomain.BaseDirectory + "test.html")
End Sub
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim doc As HtmlDocument = Me.WebBrowser1.Document
Dim script As HtmlElement = doc.CreateElement("script")
script.SetAttribute("type", "text/javascript")
Dim value As String = "function _func(){" &
" var option = {title:{text:'ECharts 数据统计' },tooltip:{},legend:{data:['访问量']},xAxis:{data:['Android','IOS','PC','Ohter']}," &
"yAxis:{},series:[{ name:'访问量',
type:'line',
data:[500,200,360,100]
}]
};var myChart = echarts.init(document.getElementById('chartmain'));
myChart.setOption(option);}"
script.SetAttribute("text", value)
doc.Body.AppendChild(script)
doc.InvokeScript("_func")
End Sub