如何从线图的ajax响应中动态给出highchart pointstart值?

时间:2019-05-31 19:26:13

标签: jquery highcharts

我有静态折线图,下面有给定代码和屏幕截图(我对js fiddle有一些问题,所以只发布了我的图表的屏幕截图)

Highcharts.chart('modelinsample', {

title: {
    text: 'Model In Sample'
},
yAxis: {
    title: {
        text: 'Validation'
    }
},
legend: {
    layout: 'vertical',
    align: 'right',
    verticalAlign: 'middle'
},

plotOptions: {
    series: {
        label: {
            connectorAllowed: false
        },
        pointStart: 1
    }
},

series: [{
    name: 'Decile',
    data: [10,14,23,31,37,39,46,55,59,61,63,67,71,75,79,88,92,96,99,100]
}],

responsive: {
    rules: [{
        condition: {
            maxWidth: 500
        },
        chartOptions: {
            legend: {
                layout: 'horizontal',
                align: 'center',
                verticalAlign: 'bottom'
            }
        }
    }]
}

});

所以,现在我的图表具有ajax响应json,json响应在下面

[
{
    "Label": "]0.00708953 ; 0.0148331]",
    "Frequency": "0",
    "Random": "1",
    "Wizard": "438.004",
    "Validation": "8.76008"
},
{
    "Label": "]0.00210157 ; 0.00261405]",
    "Frequency": "0.05",
    "Random": "1",
    "Wizard": "20.2837",
    "Validation": "4.54604"
},
{
    "Label": "]0.00172042 ; 0.00210157]",
    "Frequency": "0.1",
    "Random": "1",
    "Wizard": "10.3644",
    "Validation": "3.83974"
},
{
    "Label": "]0.00143234 ; 0.00172042]",
    "Frequency": "0.15",
    "Random": "1",
    "Wizard": "6.7637",
    "Validation": "3.19948"
},
{
    "Label": "]0.00116126 ; 0.00143234]",
    "Frequency": "0.2",
    "Random": "1",
    "Wizard": "5.02669",
    "Validation": "2.77347"
},
{
    "Label": "]0.000861394 ; 0.00116126]",
    "Frequency": "0.25",
    "Random": "1",
    "Wizard": "4.03834",
    "Validation": "2.49955"
},
{
    "Label": "]0.000620576 ; 0.000861394]",
    "Frequency": "0.3",
    "Random": "1",
    "Wizard": "3.35734",
    "Validation": "2.23083"
},
{
    "Label": "]0.000439105 ; 0.000620576]",
    "Frequency": "0.35",
    "Random": "1",
    "Wizard": "2.86599",
    "Validation": "2.02536"
},
{
    "Label": "]0.000216112 ; 0.000439105]",
    "Frequency": "0.4",
    "Random": "1",
    "Wizard": "2.51149",
    "Validation": "1.87191"
},
{
    "Label": "]3.33243e-05 ; 0.000216112]",
    "Frequency": "0.45",
    "Random": "1",
    "Wizard": "2.22881",
    "Validation": "1.75907"
},
{
    "Label": "]-0.000160508 ; 3.33243e-05]",
    "Frequency": "0.5",
    "Random": "1",
    "Wizard": "2.00589",
    "Validation": "1.65907"
},
{
    "Label": "]-0.000376067 ; -0.000160508]",
    "Frequency": "0.55",
    "Random": "1",
    "Wizard": "1.82362",
    "Validation": "1.56734"
},
{
    "Label": "]-0.000611674 ; -0.000376067]",
    "Frequency": "0.6",
    "Random": "1",
    "Wizard": "1.67024",
    "Validation": "1.48756"
},
{
    "Label": "]-0.000776782 ; -0.000611674]",
    "Frequency": "0.65",
    "Random": "1",
    "Wizard": "1.53885",
    "Validation": "1.41316"
},
{
    "Label": "]-0.000997037 ; -0.000776782]",
    "Frequency": "0.7",
    "Random": "1",
    "Wizard": "1.4298",
    "Validation": "1.33712"
},
{
    "Label": "]-0.00124148 ; -0.000997037]",
    "Frequency": "0.75",
    "Random": "1",
    "Wizard": "1.33403",
    "Validation": "1.26358"
},
{
    "Label": "]-0.00146601 ; -0.00124148]",
    "Frequency": "0.8",
    "Random": "1",
    "Wizard": "1.25024",
    "Validation": "1.20665"
},
{
    "Label": "]-0.00182562 ; -0.00146601]",
    "Frequency": "0.85",
    "Random": "1",
    "Wizard": "1.17719",
    "Validation": "1.1493"
},
{
    "Label": "]-0.00231078 ; -0.00182562]",
    "Frequency": "0.9",
    "Random": "1",
    "Wizard": "1.11154",
    "Validation": "1.10414"
},
{
    "Label": "[-0.00327763 ; -0.00231078]",
    "Frequency": "0.95",
    "Random": "1",
    "Wizard": "1.05305",
    "Validation": "1.05305"
},
{
    "Label": "[-0.00868633 ; -0.00425356]",
    "Frequency": "1",
    "Random": "1",
    "Wizard": "1",
    "Validation": "1"
}

]

上面的

我只想要频率和验证值。我正在迭代和推送数组中的值,并使用validation在串联选项下为数据建立我的值。就像我想要频率值作为我的pointstart值。如何实现这一点? linechart

0 个答案:

没有答案