隐藏angularjs-chartjs中的x轴

时间:2016-10-26 09:00:14

标签: javascript angularjs html5 chart.js

我使用angularjs-chartjs来显示图表。如何在不实际设置标签的情况下隐藏x轴:["","",""]

我只想隐藏它们,因为我需要在toolTipTemplate中使用它们

 vm.att = {
            labels: avgLabels,
            datasets: [
              {
                  label: "Average Response Time",
                  fillColor: Colors.byName('warning'),
                  strokeColor: Colors.byName('warning'),
                  highlightFill: Colors.byName('warning'),
                  highlightStroke: Colors.byName('warning'),
                  data: avgTest
              },
            ]
        };

        vm.barOptions = {

            scaleLabel: "<%=value%>" + ' ' + 'ms',
            scaleBeginAtZero: true,
            scaleShowGridLines: false,
            scaleGridLineColor: 'rgba(0,0,0,.05)',
            scaleGridLineWidth: 1,
            barShowStroke: true,
            barStrokeWidth: 2,
            barValueSpacing: 2,
            barDatasetSpacing: 1,
            tooltipTemplate: function (valueObj) {
                return $filter('date')(valueObj.label, 'shortDate')
            }
        };

我的图表目前看起来像这样:

Chart

1 个答案:

答案 0 :(得分:-1)

来自docs:

new Chart(ctx, {
type: 'line',
data: data,
options: {
    scales: {
        xAxes: [{
            display: false
        }]
    }
}
});