2017-02-07 66 views
0

我在multichart(multilinechart)有問題nvd3工具提示。這裏我的XAxis標籤是JAN,FEB,MAR... DEC.但是,當我將鼠標懸停在圖上時,它顯示0,1,2,3.. 11作爲工具提示標題。但我需要顯示JAN,FEB.. DEC而不是索引。這裏是我的圖表選項代碼,nvd3工具提示顯示索引而不是標籤

{ 
    "chart": { 
    "type": "multiChart", 
    "height": 400, 
    "interpolate": "linear", 
    "showLegend": false, 
    "margin": { 
     "top": 50, 
     "right": 100, 
     "bottom": 60, 
     "left": 100 
    }, 
    "reduceXTicks": false, 
    "useVoronoi": false, 
    "useInteractiveGuideline": true, 
    "duration": 500, 
    "xAxis": { 
     "axisLabel": "MONTHLY", 
     "tickPadding": 10, 
     "tickSize": 1, 
     "tickValues": [ 
     0, 
     1, 
     2, 
     3, 
     4, 
     5, 
     6 
     ] 
    }, 
    "yAxis1": { 
     "axisLabel": "Left", 
     "tickPadding": 10 
    }, 
    "yAxis2": { 
     "axisLabel": "Right", 
     "width": 60, 
     "tickPadding": 10 
    }, 
    "yDomain1": [ 
     0, 
     5 
    ], 
    "yDomain2": [ 
     0, 
     100 
    ] 
    } 
} 

這裏是圖像的問題(需要顯示FEB卻是露出1), enter image description here 這裏是第二(需要顯示MAR卻是露出2) enter image description here

請有人幫助識別問題,

在此先感謝。

+0

能否請您創建一個TESTDATA的jsfiddle? – bgth

回答

1

你可以嘗試使用方法interactiveLayer.tooltip.headerFormatter編輯頭的標籤,如:

chart.interactiveLayer.tooltip.headerFormatter(d => { 
     if (typeof d === 'string') return d 
    }) 
相關問題