HighChat dynamic data binding (2) and highchat binding
I am also excited about the line chart in recent days. I have read many articles from my predecessors and summarized them.
1. Check the background program first. Some of the parameters I have simulated are strings. Nothing to say
public ActionResult Index2() { string[] key = { "2017-08-01", "2017-08-02", "2017-08-03", "2017-08-04", "2017-08-05", "2017-08-06", "2017-08-07", "2017-08-08", "2017-08-09", "2017-08-10" }; double[] V1 = { 4.3, 1.2, 1.3, 1.6, 7.6, 5.9, 9.0, 22, 10, 11 }; double[] V2 = { 5.3, 1.9, 1.3, 1.4, 7.6, 0.4, 9.0, 22, 14, 12 }; string json = "{\"rows\":["; for (int i = 0; i < key.Count(); i++) { json += "{\"atrname\":\"" + key[i] + "\",\"clickvalue\":\"" + V1[i] + "\",\"impvalue\":\"" + V2[i] + "\"},"; } json = json.TrimEnd(','); json += "]}"; return Content(json); }
2. Data Binding at the front end
Method 1:
1. the header file contains the no-data-to-display.src.js file, indicating that if there is no data, it will automatically show no data
Lang: {noData: "No data"}, legend: {layout: 'vertical ', align: 'right', verticalAlign: 'middle', borderWidth: 0}
2. Please note that the current value of series: [{}] is like this, because if it is [], no data is displayed in this way.
// OOptions. series [0]. name = "third"; oOptions. series [0]. data = clickvalue;
3. var oSeries = {
// Name: "second entry", // data: clickvalue //}; // oChart. addSeries (oSeries );
When assigning values in this way, series: [{}] displays a line chart, but a line chart is displayed on the right. Series: [].
When assigning values in this way// OChart = new Highcharts. Chart (oOptions );To remove or put it on top for execution.
4. The third method is series: [] or series: [{}].
@ {Layout = null ;}<! DOCTYPE html>
I will release my demo later. I hope you can correct me in the case of any errors and make progress together.
Download link: http://pan.baidu.com/s/1jHYFjE2