zoukankan      html  css  js  c++  java
  • 'data.csv'

    $.get('data.csv', function(data) {
        // Split the lines
        var lines = data.split('\n');
       
        // Iterate over the lines and add categories or series
        $.each(lines, function(lineNo, line) {
            var items = line.split(',');
           
            // header line containes categories
            if (lineNo == 0) {
                $.each(items, function(itemNo, item) {
                    if (itemNo > 0) options.xAxis.categories.push(item);
                });
            }
           
            // the rest of the lines contain data with their name in the first position
            else {
                var series = {
                    data: []
                };
                $.each(items, function(itemNo, item) {
                    if (itemNo == 0) {
                        series.name = item;
                    } else {
                        series.data.push(parseFloat(item));
                    }
                });
               
                options.series.push(series);
       
            }
           
        });
       
        // Create the chart
        var chart = new Highcharts.Chart(options);
    });

    来自杭州西溪。主打Linux系统架构、维优、项目外包
  • 相关阅读:
    IDEA 如何批量修改变量名
    Idea 竖选文本、竖向选择、横向纵向选择文本代码
    IDEA中的.iml文件和.idea文件夹
    IDEA-Maven的Dependencies中出现红色波浪线
    接收来自路劲中的参数
    Jquery基础知识点
    JavaScript浏览器对象
    JavaScript面向对象编程
    HTML5 <iframe> 标签
    JavaScript标准对象
  • 原文地址:https://www.cnblogs.com/tinaleft/p/2867345.html
Copyright © 2011-2022 走看看