NVD3.js multiChart x-axis labels is aligned to multiple lines, but not multiple bars

前端 未结 6 954
暗喜
暗喜 2021-01-05 16:50

This question relates to NVD3.js multiChart x-axis labels is aligned to lines, but not bars

I am using NVD3.js multiChart to show multiple lines

6条回答
  •  南方客
    南方客 (楼主)
    2021-01-05 17:31

    lawry's solution works. Also if using interactive guidelines, you need to shift the interactive line to match the new scale. Modify:

    if(useInteractiveGuideline){
                    interactiveLayer
                        .width(availableWidth)
                        .height(availableHeight)
                        .margin({left:margin.left, top:margin.top})
                        .svgContainer(container)
                        .xScale(x);
                    wrap.select(".nv-interactive").call(interactiveLayer);    
                                                                              
                    //ADD THIS LINE 
                    wrap.select(".nv-interactiveGuideLine")
                    .attr('transform', 'translate(' + rbcOffset +', ' + 0  + ')' +
                    'scale(' + ((availableWidth - rbcOffset*2)/availableWidth) + ', 1)');
                }
    

    in multiChart.js.

提交回复
热议问题