2013-09-05 144 views
1

我正在使用Highcharts,我想關閉所有標籤。我製作了自己的圖形,它有自己的標題和數據軸。我如何使Highcharts提供的隱形?禁用HighCharts標籤

目前,我只需要擺脫y軸標記,但我不知道如何。

這是我到目前爲止有:

$('#container').highcharts({ 
    chart: { 
     type: 'area', 
     backgroundColor: 'transparent' 
    }, 

    title: { 
     text: ' ' 
    }, 
    credits: { 
     enabled: false 
    }, 
    xAxis: { 
     categories: [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '] 
    }, 
    series: [{ 
     name: 'Rich', 
     color: '#FF0000', 
     data: [] 
    }, { 
     name: 'Poor', 
     data: [] 
    }] 
}); 
} 
+0

'{tooltip:{enabled:false}}'? –

回答

6

Highcharts與小提琴的例子神話般的文檔最多的事:http://api.highcharts.com/highcharts

http://jsfiddle.net/fnHzg/

$('#container').highcharts({ 
    chart: { 
    }, 
    title : { 
     text: null 
    }, 
    xAxis: { 

     title: { 
      enabled: false 
     } 
    }, 
    yAxis: { 

     title: { 
      enabled: false 
     } 
    }, 
    series: [{ 
     data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]   
    }] 
}); 

要同時關閉Y軸和X軸標籤和刻度標記:

xAxis: { 

    title: { 
     enabled: false 
    }, 
    labels: { 
     enabled: false 
    }, 
    tickLength: 0 
}, 
yAxis: { 

    title: { 
     enabled: false 
    }, 
    labels: { 
     enabled: false 
    }, 
    tickLength: 0 
}, 
+0

這沒有奏效。 – seamlessTL

+0

@seamlessTL它以何種方式無效?什麼仍然表明你想關閉? –

+0

完美。最後的片段正是我所需要的。另一個問題,你會碰巧知道在圖的左側和右側應用填充的過程,以便初始點和最終點不會坐在邊上嗎? marginLeft,marginRight,spacingLeft和spacingRight似乎都是針對圖的外部 - 將整個圖推到一邊。 – seamlessTL