Hide gridLines in Kendo UI Chart Angular 2
Asked Answered
T

2

5

I am using Kendo UI Chart with Angular 2, with the Chart by default grid lines are coming, but I want to hide it. I got the class from API which is "GridLines". but where to use it that I am not getting. and also I want to hide my X-Axis.

Coming Result: comingResult

Expected Result:

expectedResult

Code:

<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>
Tody answered 17/10, 2016 at 13:3 Comment(0)
T
11

I hide grid lines like below:

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

To remove chart X-Axis :

<kendo-chart-value-axis>
    <kendo-chart-value-axis-item [line]="{visible:false}" labels="false">
    </kendo-chart-value-axis-item>
</kendo-chart-value-axis>
Tody answered 17/10, 2016 at 13:16 Comment(1)
@alexGyoshev, Thanks for proper indentation. :)Tody
S
0

I achieved this by making changing property of a css class like following

.k-var--chart-major-lines {
    background-color:white;
}
Sika answered 17/10, 2016 at 14:43 Comment(3)
Yes, indeed, we can achieve it but I wanted to know the Kendo UI approach. thanks for your Help. :)Tody
While this will set the grid lines color, it is a better idea to use the provided SASS variables and compile the theme. This way, you can set $chart-major-lines: #fff; to modify the theme, instead of overriding it via CSS.Apache
Yes now iam using SASS variables instead of overriding thanks for your helpSika

© 2022 - 2024 — McMap. All rights reserved.