2014-11-22 58 views
1

我的圖表不顯示氣球,我不明白爲什麼。我在y光標上顯示氣球,我可以將其更改爲顯示x軸的值,但我無法顯示氣球,它會在x光標或值行之後的氣球中顯示x軸值。Amcharts XY圖表不顯示氣球

http://jsfiddle.net/47qdtboa/

AmCharts.makeChart("chartdiv", 
      { 
"type": "xy", 
"pathToImages": "http://cdn.amcharts.com/lib/3/images/", 
"startDuration": 1.5, 
"handDrawn": true, 
"theme": "light", 
"thousandsSeparator": "'", 
"chartCursor": { 
      "categoryBalloonEnabled": true, 
      "valueLineAxis": "ValueAxis-1", 
    "valueLineBalloonEnabled": true, 
    "valueLineEnabled": true, 
     "balloonText": "[[Distance (m)]]", 
        "showBalloon": true, 
    "zoomable": false 
    }, 
//"trendLines": [], 
    "color":"#777777", 
    "fontFamily":"Londrina Outline", 
    "fontSize":23, 
    "categoryField": "Distance (km)", 
"graphs": [ 
    { 

     "id": "AmGraph-4", 
     "balloonText": "[[Distance (m)]]", 
     "title": "graph 4", 
     "valueAxis": "Not set", 
        "lineColor": "#59C45C", 
     "lineThickness": 3, 
        "fillAlphas": 0.13, 
     "fillColors": "#59C45C", 
     "fillToAxis": "ValueAxis-2", 
     "valueField": "Distance (km)", 
     "xAxis": "Distance (km)", 
     "xField": "Distance (km)", 
     "yField": "Elevation (m)" 
    } 
], 
"valueAxes": [ 
    { 
     "id": "ValueAxis-1", 
     "axisAlpha": 0, 
     "unit": "m" 

    }, 
    { 
     "id": "ValueAxis-2", 
     "position": "bottom", 
     "axisAlpha": 0, 
     "unit": "km", 
     "showLastLabel": false 
    } 
], 
"allLabels": [], 
"amExport": {}, 
"balloon": {}, 
"titles": [], 
"dataProvider": [ 
    { 
     "Distance (m)": "0", 
     "Distance (km)": "0", 
     "Elevation (m)": "749" 
    }, 
    { 
     "Distance (m)": "101.543639516933", 
     "Distance (km)": "0.11", 
     "Elevation (m)": "749" 
    }, 

    { and many more like that ...}, 

回答

0

我已經更新了你在這裏...小提琴

http://jsfiddle.net/47qdtboa/1/

你需要做的基本上是指X或Y軸,而不是一個字段的名稱是什麼。您還需要向圖表添加項目符號以顯示氣球。

"graphs": [ 
    { 

     "id": "AmGraph-4", 
     "balloonText": "[[x]] (km)", /*CHANGED THIS LINE*/ 
     "bullet": "round",   /*ADDED THIS LINE*/ 
     "bulletSize": 1,    /*ADDED THIS LINE*/ 
     "title": "graph 4", 
     "valueAxis": "Not set", 
     "lineColor": "#59C45C", 
     "lineThickness": 3, 
     "fillAlphas": 0.13, 
     "fillColors": "#59C45C", 
     "fillToAxis": "ValueAxis-2", 
     "xAxis": "Distance (km)", 
     "xField": "Distance (km)", 
     "yField": "Elevation (m)" 
    } 
], 

不知道你是否可以參考實際的字段名稱,但在快速測試下,我至少不能。

+0

謝謝。它真的讓我噁心。我在這些配置文件中看不到任何東西... – Samuel 2014-11-25 12:58:08

+0

請記住,在XY圖表中激活項目符號會減慢整個圖表的速度,例如在放大時。 我試圖找到一種方法有選擇地或以縮放級別顯示子彈以避免性能下降。 – 2014-11-25 16:15:33