在Kendo UI Chart Angular 2中隐藏gridLines

时间:2016-10-17 13:03:25

标签: angular kendo-chart kendo-ui-angular2

我正在使用Angular 2的Kendo UI Chart, 默认情况下,图表会出现网格线,但我想隐藏它。我从API获得了这个类,它是" GridLines"。但在哪里使用它,我没有得到。而且我想要隐藏我的X轴。

即将到来的结果: comingResult

预期结果:

expectedResult

代码:

<kendo-chart>
    <kendo-chart-value-axis>
        <kendo-chart-value-axis-item [title]="{ text: 'Score' }" [min]="0" [max]="11" >
        </kendo-chart-value-axis-item>
    </kendo-chart-value-axis>

    <kendo-chart-series-defaults type="bar">
        <kendo-chart-series-defaults-labels format="">
        </kendo-chart-series-defaults-labels>
    </kendo-chart-series-defaults>

    <kendo-chart-category-axis>
        <kendo-chart-category-axis-item  [categories]="chartObject.skills">
        </kendo-chart-category-axis-item>
    </kendo-chart-category-axis>

    <kendo-chart-series>
        <kendo-chart-series-item color="#337ab7" [data]="chartObject.rates" type="bar" [border]="{ width: 0 }">
        </kendo-chart-series-item>
    </kendo-chart-series>
</kendo-chart>

2 个答案:

答案 0 :(得分:4)

我隐藏了如下的网格线:

<kendo-chart-axis-defaults [majorGridLines]="{ visible : false}">
</kendo-chart-axis-defaults>

删除图表X轴:

<kendo-chart-value-axis>
    <kendo-chart-value-axis-item [line]="{visible:false}" labels="false">
    </kendo-chart-value-axis-item>
</kendo-chart-value-axis>

答案 1 :(得分:0)

我通过改变css类的属性来实现这一点,如下面的

.k-var--chart-major-lines {
    background-color:white;
}