2016-10-20 33 views
0

我有一個'spline'HighChart工作,但想向工具提示添加更多的數據,所以希望使用帶有xy語法的JSON對象,以便能夠進一步填充此對象Highcharts Series data as JSON does not render

本來我是用一系列的格式爲:

{ 
    name: 'Series 1', 
    data: [[x,y],[x,y],[x,y]] 
} 

這工作得很好,但它更改爲:

{ 
    name: 'Series 1', 
    data: [{x: xVal, y: yVal},{x: xVal, y: yVal},{x: xVal, y: yVal}] 
} 

哈我停止了我的圖表工作。在這裏使用小提琴:https://jsfiddle.net/xbL65gqn/此句法看起來是有效的。什麼可能導致它無法工作?

僅供參考繼承人我highcharts配置:

{ 
chart: { 
    type: 'spline', 
    backgroundColor: 'transparent', 
    style: { 
    color: FONT_COLOR 
    } 
}, 
credits: { enabled: false }, 
plotOptions: { 
    series: { 
    marker: { enabled: false } 
    } 
}, 
legend: { enabled: false }, 
series: series, 
title: { 
    text: '', 
    labels: { 
    style: { 
     color: FONT_COLOR 
    } 
    } 
}, 
tooltip: { 
    crosshairs: { 
    dashStyle: 'solid' 
    } 
}, 
xAxis: { 
    type: 'datetime', 
    labels: { 
    style: { 
     color: FONT_COLOR 
    } 
    } 
}, 
yAxis: { 
    title: { 
    text: 'Uplift', 
    textAlign: 'right', 
    rotation: 0, 
    style: { 
     color: FONT_COLOR 
    }, 
    y: -174, 
    x: 34 
    }, 
    max: maxLabel, 
    min: -maxLabel, 
    showLastLabel: false, 
    labels: { 
    formatter: function() { 
     return this.value + '%' 
    }, 
    style: { 
     color: FONT_COLOR 
    } 
    } 
} 
+0

您加載到圖表上多少點?如果超過1000,則可能是由turboThreshold https://jsfiddle.net/xbL65gqn/1/引起的。如果是由turboThreshold引起的,請將其設置爲0(0或大於點數的值) – morganfree

回答

0

我這個解決我自己。當計算在yminmax我用的是一系列的數據通過獲取seriesData[1](在y座標),以找到他們,改變結構的JSON對象時沒有考慮到這一點

因此我minmaxy軸上分別是NaN