nvd3折线图,如何删除网格线和y轴 [英] nvd3 line chart, how to remove gridlines and yaxis

查看:309
本文介绍了nvd3折线图,如何删除网格线和y轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用view finder做了一个折线图。



这是我的初始代码

  var chart = nv.models .lineWithFocusChart(); 

// chart.transitionDuration(500);
chart.xAxis
.tickFormat(d3.format(',g'));
chart.xAxis
.axisLabel(Date);
chart.xAxis.tickPadding(0);


chart.x2Axis
.tickFormat(d3.format(',g'));




chart.yAxis
.tickFormat(d3.format(',。2g'));
chart.y2Axis
.tickFormat(d3.format(',。2h'));
// chart.showYAxis(false);

我想删除y轴标签(即我不想在y轴上显示数字)。



我也想移除所有网格线。



有像chart.yAxis.something


showYAxis(false)应删除y轴。



如果这不起作用,您可以应用 .nv -y text {display:none;} 作为样式。



使用样式 .tick line {display:none;} 来摆脱网格线,



使用 .tick {display:none;}除去所有轴和线



:)


I have made a line chart with view finder.

Here is my initial code

     var chart = nv.models.lineWithFocusChart();

 // chart.transitionDuration(500);
  chart.xAxis
      .tickFormat(d3.format(',g'));
  chart.xAxis
        .axisLabel("Date");
  chart.xAxis.tickPadding(0);


  chart.x2Axis
      .tickFormat(d3.format(',g'));




  chart.yAxis
      .tickFormat(d3.format(',.2g'));
  chart.y2Axis
      .tickFormat(d3.format(',.2h'));
 // chart.showYAxis(false);

I want to remove the y axis labels ( i.e. i want no number showing on the y axis).

I also want to remove all the gridlines.

is there something like chart.yAxis.somethinghere to do this?

Thanks

解决方案

.showYAxis(false) should remove the y axis.

If that doesn't work, you can apply .nv-y text{display: none;} as a style.

Use the style .tick line {display: none;} to get rid of grid lines, and keep x axis.

Get rid of all axis and lines with .tick{display: none;}

:)

这篇关于nvd3折线图,如何删除网格线和y轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆