3

我正在使用两个 Y 轴(左右)当我为其中一个隐藏所有使用的数据集时,刻度(轴标签)变为 1 到 -1。

我想在不使用时隐藏轴或标签,有什么想法吗?

隐藏前: 使用两个 Y 轴

隐藏后: 右 Y 轴已更改 - 未使用

选项>比例:

        yAxes: [
            {type: "linear", id: "y-axis-0", display: true, position: "right",gridLines:{display: false},
            scaleLabel:{display: true, labelString: 'mBar'}},
            {type: "linear", id: "y-axis-1", display: true, position: "left",ticks: {beginAtZero:true},
            scaleLabel:{display: true, labelString: 'Knots/°C'} }
          ]

在文档中没有找到任何东西。

4

2 回答 2

5
   If you want to remove the x axis and y axis data so to do that you need 
        to use scales and put in bar-chart-demo.ts file and inside export
          class you have to paste like that what  i mentioned below 
             and it worked . 

 public barChartOptions:any = {
  scaleShowVerticalLines: false,
     animation: false,
     scaledisplay:false,
     responsive: true,

scales: {
   xAxes: [
    {
        display: false
    }
  ],
   yAxes: [
      {
        display: false
    }
]
}


   };``
于 2017-04-04T07:00:56.290 回答
2

您可以在代码中隐藏轴。只需添加一个 Angular on-mouseover 事件并将显示设置为 true/false 并使用否定!条件:

scales: {
    xAxes: [
        {
            display: false
        }
    ],
    yAxes: [
        {
            display: false
        }
    ]
}
于 2017-02-09T02:45:58.840 回答