Javascript HighCharts JS Ajax数据语言

Javascript HighCharts JS Ajax数据语言,javascript,csv,highcharts,Javascript,Csv,Highcharts,有人能帮我修改HighCharts测角仪演示的代码,从逗号分隔的值文件加载数据吗 逗号分隔值列应该是可指定的。i、 e:数据[0],数据[1],数据[2] $(function () { $('#container').highcharts({ chart: { type: 'gauge', plotBackgroundColor: null, plotBackgroundImage: null, plotBorderW

有人能帮我修改HighCharts测角仪演示的代码,从逗号分隔的值文件加载数据吗

逗号分隔值列应该是可指定的。i、 e:数据[0],数据[1],数据[2]

$(function () {

$('#container').highcharts({

    chart: {
        type: 'gauge',
        plotBackgroundColor: null,
        plotBackgroundImage: null,
        plotBorderWidth: 0,
        plotShadow: false
    },

    title: {
        text: 'Speedometer'
    },

    pane: {
        startAngle: -150,
        endAngle: 150,
        background: [{
            backgroundColor: {
                linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
                stops: [
                    [0, '#FFF'],
                    [1, '#333']
                ]
            },
            borderWidth: 0,
            outerRadius: '109%'
        }, {
            backgroundColor: {
                linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
                stops: [
                    [0, '#333'],
                    [1, '#FFF']
                ]
            },
            borderWidth: 1,
            outerRadius: '107%'
        }, {
            // default background
        }, {
            backgroundColor: '#DDD',
            borderWidth: 0,
            outerRadius: '105%',
            innerRadius: '103%'
        }]
    },

    // the value axis
    yAxis: {
        min: 0,
        max: 200,

        minorTickInterval: 'auto',
        minorTickWidth: 1,
        minorTickLength: 10,
        minorTickPosition: 'inside',
        minorTickColor: '#666',

        tickPixelInterval: 30,
        tickWidth: 2,
        tickPosition: 'inside',
        tickLength: 10,
        tickColor: '#666',
        labels: {
            step: 2,
            rotation: 'auto'
        },
        title: {
            text: 'km/h'
        },
        plotBands: [{
            from: 0,
            to: 120,
            color: '#55BF3B' // green
        }, {
            from: 120,
            to: 160,
            color: '#DDDF0D' // yellow
        }, {
            from: 160,
            to: 200,
            color: '#DF5353' // red
        }]        
    },

    series: [{
        name: 'Speed',
        data: [80],
        tooltip: {
            valueSuffix: ' km/h'
        }
    }]

}, 
// Add some life
function (chart) {
    if (!chart.renderer.forExport) {
        setInterval(function () {
            var point = chart.series[0].points[0],
                newVal,
                inc = Math.round((Math.random() - 0.5) * 20);

            newVal = point.y + inc;
            if (newVal < 0 || newVal > 200) {
                newVal = point.y - inc;
            }

            point.update(newVal);

        }, 3000);
    }
});
});
$(函数(){
$(“#容器”)。高图({
图表:{
类型:“仪表”,
plotBackgroundColor:null,
plotBackgroundImage:空,
绘图边框宽度:0,
plotShadow:false
},
标题:{
文字:“速度表”
},
窗格:{
startAngle:-150,
端角:150,
背景:[{
背景颜色:{
线性半径:{x1:0,y1:0,x2:0,y2:1},
停止:[
[0,#FFF'],
[1, '#333']
]
},
边框宽度:0,
外层:109%
}, {
背景颜色:{
线性半径:{x1:0,y1:0,x2:0,y2:1},
停止:[
[0, '#333'],
[1'#FFF']
]
},
边框宽度:1,
外层:107%
}, {
//默认背景
}, {
背景颜色:“#DDD”,
边框宽度:0,
外层:105%,
内半径:“103%”
}]
},
//价值轴
亚克斯:{
分:0,,
最高:200,
minorTickInterval:“自动”,
minorTickWidth:1,
minorTickLength:10,
minorTickPosition:“内部”,
minorTickColor:“#666”,
像素间隔:30,
宽度:2,
位置:'内部',
长度:10,
勾选颜色:'#666',
标签:{
步骤:2,
旋转:“自动”
},
标题:{
文字:“公里/小时”
},
绘图带:[{
起:0,,
致:120,
颜色:'#55BF3B'//绿色
}, {
起:120,
收件人:160,
颜色:'#DDDF0D'//黄色
}, {
起:160,
致:200,,
颜色:'#DF5353'//红色
}]        
},
系列:[{
名称:“速度”,
数据:[80],
工具提示:{
valueSuffix:'公里/小时'
}
}]
}, 
//增添活力
功能(图表){
if(!chart.renderer.forExport){
setInterval(函数(){
变量点=图表。系列[0]。点[0],
纽瓦尔,
inc=数学舍入((数学随机数()-0.5)*20);
newVal=点y+inc;
如果(newVal<0 | | newVal>200){
newVal=point.y-inc;
}
更新点(newVal);
}, 3000);
}
});
});
一个逗号分隔值数据加载到Highcharts的示例演示-Ajax加载数据,可点击点

 $(function () {

// Register a parser for the American date format used by Google
Highcharts.Data.prototype.dateFormats['m/d/Y'] = {
    regex: '^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2})$',
    parser: function (match) {
        return Date.UTC(+('20' + match[3]), match[1] - 1, +match[2]);
    }
};

// Get the CSV and create the chart
$.get('/samples/highcharts/demo/line-ajax/analytics.csv', function (csv) {

    $('#container').highcharts({

        data: {
            csv: csv
        },

        title: {
            text: 'Daily visits at www.highcharts.com'
        },

        subtitle: {
            text: 'Source: Google Analytics'
        },

        xAxis: {
            type: 'datetime',
            tickInterval: 7 * 24 * 3600 * 1000, // one week
            tickWidth: 0,
            gridLineWidth: 1,
            labels: {
                align: 'left',
                x: 3,
                y: -3
            }
        },

        yAxis: [{ // left y axis
            title: {
                text: null
            },
            labels: {
                align: 'left',
                x: 3,
                y: 16,
                formatter: function() {
                    return Highcharts.numberFormat(this.value, 0);
                }
            },
            showFirstLabel: false
        }, { // right y axis
            linkedTo: 0,
            gridLineWidth: 0,
            opposite: true,
            title: {
                text: null
            },
            labels: {
                align: 'right',
                x: -3,
                y: 16,
                formatter: function() {
                    return Highcharts.numberFormat(this.value, 0);
                }
            },
            showFirstLabel: false
        }],

        legend: {
            align: 'left',
            verticalAlign: 'top',
            y: 20,
            floating: true,
            borderWidth: 0
        },

        tooltip: {
            shared: true,
            crosshairs: true
        },

        plotOptions: {
            series: {
                cursor: 'pointer',
                point: {
                    events: {
                        click: function() {
                            hs.htmlExpand(null, {
                                pageOrigin: {
                                    x: this.pageX,
                                    y: this.pageY
                                },
                                headingText: this.series.name,
                                maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x) +':<br/> '+
                                    this.y +' visits',
                                width: 200
                            });
                        }
                    }
                },
                marker: {
                    lineWidth: 1
                }
            }
        },

        series: [{
            name: 'All visits',
            lineWidth: 4,
            marker: {
                radius: 4
            }
        }, {
            name: 'New visitors'
        }]
    });
});

});
$(函数(){
//为谷歌使用的美国日期格式注册解析器
Highcharts.Data.prototype.dateFormats['m/d/Y']={
正则表达式:“^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2})$”,
解析器:函数(匹配){
返回日期。UTC(+('20'+匹配[3]),匹配[1]-1,+匹配[2]);
}
};
//获取CSV并创建图表
$.get('/samples/highcharts/demo/line ajax/analytics.csv',函数(csv){
$(“#容器”)。高图({
数据:{
csv:csv
},
标题:{
文字:“每日访问www.highcharts.com”
},
副标题:{
文本:“来源:谷歌分析”
},
xAxis:{
键入:“日期时间”,
间隔时间:7*24*3600*1000,//一周
宽度:0,
网格线宽度:1,
标签:{
对齐:“左”,
x:3,
y:-3
}
},
yAxis:[{//左y轴
标题:{
文本:空
},
标签:{
对齐:“左”,
x:3,
y:16,
格式化程序:函数(){
返回Highcharts.numberFormat(this.value,0);
}
},
showFirstLabel:错误
},{//右y轴
链接到:0,
网格线宽:0,
相反:是的,
标题:{
文本:空
},
标签:{
对齐:“右”,
x:-3,
y:16,
格式化程序:函数(){
返回Highcharts.numberFormat(this.value,0);
}
},
showFirstLabel:错误
}],
图例:{
对齐:“左”,
垂直排列:“顶部”,
y:20,
浮动:是的,
边框宽度:0
},
工具提示:{
分享:是的,
十字准星:对
},
打印选项:{
系列:{
光标:“指针”,
要点:{
活动:{
单击:函数(){
hs.htmlExpand(空{
页面来源:{
x:this.pageX,
y:这个,佩吉
},
headingText:this.series.name,
maincontentText:Highcharts.dateFormat(“%A,%b%e,%Y',this.x)+':
+ 这个.y+“访问”, 宽度:200 }); } } }, 标记:{ 线宽:1 } } }, 系列:[{ 名称:'所有访问', 线宽:4, 标记:{ 半径:4 } }, { 名称:'新访客'