2012-08-29 42 views
3

我有兩個系列的圖表:columnspline。在編程上,我改變了某些符合某些標準的列的顏色,假設10個最低分數以綠色呈現,其餘爲藍色。如何增加一項至Highcharts legend?

現在,在圖例中,我有系列名稱,但顯然,它顯示了樣條系列名稱和列系列名稱的默認藍色。例如,我想知道如何爲渲染爲綠色的列的圖例添加一個名稱,例如「最低分數」。

編輯:

該系列的代碼:

series: [{ 
    type: 'column', 
    color: '#215868', 
    name: 'Score per round ', 
    data: [ 
    {y:65,name:'Caracas Country Club', color: '#7EB035'}, 
    {y:72,name:'Biltmore Golf Course', color: '#7EB035'}, 
    {y:72,name:'Nashua Country Club', color: '#7EB035'}, 
    {y:90,name:'Hilaman Park Golf Course'}, 
    {y:105,name:'Biltmore Golf Course'}, 
    {y:90,name:'Binks Forest Golf Club', color: '#7EB035'}, 
    {y:90,name:'Binks Forest Golf Club', color: '#7EB035'}, 
    {y:90,name:'Blackhawk Country Club | The Falls', color: '#7EB035'}, 
    {y:90,name:'Blackhawk Country Club | The Falls', color: '#7EB035'}, 
    {y:72,name:'Pembroke Country Club', color: '#7EB035'}, 
    {y:90,name:'The Greens At North Hills Country Club'}, 
    {y:90,name:'Havana Country Club | Kilamanjaro/Kenya'}, 
    {y:90,name:'Biltmore Golf Course'}, 
    {y:90,name:'Biltmore Golf Course'}, 
    {y:90,name:'Challenge At Santa Rita'}, 
    {y:100,name:'Lake Chabot Golf Course | Lake Chabot'}, 
    {y:90,name:'Hillcrest Golf & Country Club | Championship', color: '#7EB035'}, 
    {y:100,name:'Hillcrest Golf & Country Club | Championship'}, 
    {y:100,name:'Hillcrest Golf & Country Club | Championship'}, 
    {y:90,name:'Hillcrest Golf & Country Club | Championship', color: '#7EB035'},] 
    }, 
    { 
    type: 'spline', 
    name: 'Avg Score', 
    color: '#009900', 
    data: [ 
     {y:89.9,name:'Caracas Country Club'}, 
     {y:89.4,name:'Biltmore Golf Course'}, 
     {y:88.9,name:'Nashua Country Club'}, 
     {y:88.9,name:'Hilaman Park Golf Course'}, 
     {y:89.4,name:'Biltmore Golf Course'}, 
     {y:89.4,name:'Binks Forest Golf Club'}, 
     {y:89.4,name:'Binks Forest Golf Club'}, 
     {y:89.4,name:'Blackhawk Country Club | The Falls'}, 
     {y:89.4,name:'Blackhawk Country Club | The Falls'}, 
     {y:89.0,name:'Pembroke Country Club'},{y:89.0,name:'The Greens At North Hills Country Club'}, 
     {y:89.0,name:'Havana Country Club | Kilamanjaro/Kenya'}, 
     {y:89.1,name:'Biltmore Golf Course'}, 
     {y:89.1,name:'Biltmore Golf Course'}, 
     {y:89.1,name:'Challenge At Santa Rita'}, 
     {y:89.3,name:'Lake Chabot Golf Course | Lake Chabot'}, 
     {y:89.4,name:'Hillcrest Golf & Country Club | Championship'}, 
     {y:89.6,name:'Hillcrest Golf & Country Club | Championship'},{y:89.8,name:'Hillcrest Golf & Country Club | Championship'}, 
     {y:89.8,name:'Hillcrest Golf & Country Club | Championship'}, 
    ] 
    } 
] 
+0

*相關代碼*請! – Jashwant

+0

對不起,已添加code。我曾問過的第一個問題。 – iwannabaa

+0

可能不是你想要的。但是,您可以創建第三個系列,將綠色分爲一個系列,另一個系列爲另一個系列。這個傳說實際上只是爲了系列而設計的。您也可以嘗試在圖表上爲綠色項目添加註釋。 – wergeld

回答

11

我只是添加了所需的屬性(名稱和顏色)的空系列和它的工作。以防萬一你在這種情況下發現自己。

+5

最好將空白系列的'type'作爲'line',這樣它就不會影響你的主要系列,如果它是像列或欄那樣的東西。 – Vigneshwaran

+6

以上評論非常有用。但是除此之外,如果您希望圖例符號默認顯示爲方形,則可以使用圖表類型作爲區域。輸入爲行顯示圖例符號爲刪除 – crazycrv