I have a graph in Kendo with positive values. The problem is that the Y-axes takes his range in function of the values.E.g. minimum value is 5000 -> the y-axis starts from 4500.Is there a way to get the y-axis fixed on 0? So it always starts from 0 instead of a narrower range. I found that you can put the min on 0 in ValuesAxis, but the problem here is that I can't get any negative values in this way.
My code:
My code:
$scope.line = {<br> cache:
false
,<br> legend: {<br> visible:
false
<br> },<br> title: {<br> text:
"Last 10"
<br> },<br> series: [{<br> type:
"line"
,<br> style:
"smooth"
,<br> field:
"OBAmount"
,<br> categoryField:
"date"
,<br> color:
'#0c50dd'
<br> }],<br> valueAxis: {<br> line: {<br> visible:
false
<br> }<br> },<br> tooltip: {<br> visible:
true
,<br> template:
"#= kendo.format('{0:n2}', value) # "
<br> }<br> }
7 Answers, 1 is accepted
0
Hello Ibrahim,
Basically in order to fix valueAxis range you should specify its min / max values. What I can suggest for this particular case is setting these option dynamically (depending on the values) via the setOptions method. As an example:
Regards,
Iliana Nikolova
Telerik
Basically in order to fix valueAxis range you should specify its min / max values. What I can suggest for this particular case is setting these option dynamically (depending on the values) via the setOptions method. As an example:
var
chart = $(
"#chart"
).data(
"kendoChart"
);
chart.setOptions({valueAxis: {min: 0}});
Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ibrahim
Top achievements
Rank 1
answered on 02 May 2014, 06:49 AM
Hello Iliano
I've tried your solution, but I don't see anything changed.
Is this the right command? I'm using AngularJS with Kendo UI.
I've tried your solution, but I don't see anything changed.
Is this the right command? I'm using AngularJS with Kendo UI.
setOptions: ({
valueAxis: {min: 0}
})
0
Hello,
I'm not sure why the valueAxis.min value is not applied. It should fix the axis range as in this demo:
http://trykendoui.telerik.com/ODIf
But even if it is applied, it still won't be a good solution because of the concerns you express about negative values.
My recommendation is to set narrowRange to false:
http://trykendoui.telerik.com/ODIf/2
This will always keep the axis minimum at 0 for positive values.
I hope this helps.
Regards,
T. Tsonev
Telerik
I'm not sure why the valueAxis.min value is not applied. It should fix the axis range as in this demo:
http://trykendoui.telerik.com/ODIf
But even if it is applied, it still won't be a good solution because of the concerns you express about negative values.
My recommendation is to set narrowRange to false:
http://trykendoui.telerik.com/ODIf/2
This will always keep the axis minimum at 0 for positive values.
I hope this helps.
Regards,
T. Tsonev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ibrahim
Top achievements
Rank 1
answered on 06 May 2014, 08:18 AM
Hey,
Could it be that there is fault in the demo of the narrowRange? When I run it, it starts from 4440. I've tried it also in my own code and also here it doesn't start from 0.
Kind regards
Could it be that there is fault in the demo of the narrowRange? When I run it, it starts from 4440. I've tried it also in my own code and also here it doesn't start from 0.
Kind regards
0
Hello,
I'm not sure what I was looking at when I prepared the demo. Indeed the narrowRange setting has no effect in this case, as it's default value is false.
We'll consider our options to make your scenario possible by modifying the behavior of this property or by introducing a new one.
For the moment, I can suggest the following workaround:
series: [{
data: [4500, 4600],
type: "column"
}, {
data: [0],
visible: false
}]
-- Live demo --
Apologies for not verifying my earlier solution properly.
Regards,
T. Tsonev
Telerik
I'm not sure what I was looking at when I prepared the demo. Indeed the narrowRange setting has no effect in this case, as it's default value is false.
We'll consider our options to make your scenario possible by modifying the behavior of this property or by introducing a new one.
For the moment, I can suggest the following workaround:
series: [{
data: [4500, 4600],
type: "column"
}, {
data: [0],
visible: false
}]
-- Live demo --
Apologies for not verifying my earlier solution properly.
Regards,
T. Tsonev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
William
Top achievements
Rank 1
answered on 19 Aug 2014, 05:44 PM
I'm having the same problem with narrowRange, the chart is completely ignoring narrowRange: false
0
Hi,
Indeed the workaround from my previous reply is no longer effective.
I'm afraid the only workaround for the moment is to set the axis min value conditionally, as in this snippet.
We'll investigate this issue. Apologies for the caused inconvenience.
Regards,
T. Tsonev
Telerik
Indeed the workaround from my previous reply is no longer effective.
I'm afraid the only workaround for the moment is to set the axis min value conditionally, as in this snippet.
We'll investigate this issue. Apologies for the caused inconvenience.
Regards,
T. Tsonev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!