Dynamic binding of HighChat to data backend binding (3) and highchat binding

Source: Internet
Author: User

Dynamic binding of HighChat to data backend binding (3) and highchat binding

Today, I read some blogs from some of the bosses. Now I want to share some of them as a reference for the future.

Not to mention the code

1. Background code

 public ActionResult Ajax2() {            ReportData reportData = new ReportData();            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", "2017-08-11", "2017-08-12" };            reportData.categories = key;            double?[] value = { 3.9, 4.6, 5.7, 10.5, 1.9, 15.2, 15.0, 16.6, 19.2, 10.0, 5.2, 46.8 };            double?[] value1 = { 3.9, 3.6, 5.7, 8.5, 1.9, 15.2, 12.0, 16.6, 12.2, 10.0, 5.1, 46.8 };            ReportItem ri1 = new ReportItem() { data = value, name = "Agent Used" };            reportData.ReportItems.Add(ri1);            ReportItem ri2 = new ReportItem() { data = value1, name = "Emission" };            reportData.ReportItems.Add(ri2);            return Json(reportData);        }

Defines entity classes to receive data

public class ReportData {        public string[] categories { get; set; }        public List<ReportItem> ReportItems = new List<ReportItem>();    }    public class ReportItem {        public string name { get; set; }        public double?[] data { get; set; }    }

The front-end is also very simple

 

@ {Layout = null ;}<! DOCTYPE html> 

 

 

Ga feels that this is the simplest way. All the data is bound from the backend, and the front-end is only responsible for display. It was learned only after reading many articles.

 

Download link: http://pan.baidu.com/s/1skOrBQX

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.