2017-02-07 2 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 
    ] 
    } 
} 

이미지의 문제는 (2월을 보여주기 위해 필요하지만 1을 보여주고있다)이다 다음 enter image description here 이 두 번째입니다, (MAR를 보여줄 필요가 있지만,이 보여주는) 를

어떤 하나 개의 도움이 문제를 확인하기 바랍니다 enter image description here, 사전에

감사합니다.

+0

당신이 testdata로와 jsfiddle을 만들시겠습니까? – bgth

답변

1

당신은 같은 헤더의 레이블을 편집하는 방법 interactiveLayer.tooltip.headerFormatter를 사용하려고 할 수 있습니다

chart.interactiveLayer.tooltip.headerFormatter(d => { 
     if (typeof d === 'string') return d 
    }) 
관련 문제