7 Answers, 1 is accepted
0
Hi,
You can obtain the current axis range from the chart options:
var axis = e.sender.options.categoryAxis[0];
console.log(axis.min + " - " + axis.max);
-- Live demo --
I hope this helps.
Regards,
T. Tsonev
Telerik
You can obtain the current axis range from the chart options:
var axis = e.sender.options.categoryAxis[0];
console.log(axis.min + " - " + axis.max);
-- Live demo --
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
OMER
Top achievements
Rank 1
answered on 18 Jun 2014, 03:35 PM
Hi,
Thanks. I'm sorry I did not explain myself so well.
I need this for a scatter chart, which does not have this property:
http://trykendoui.telerik.com/omOh
It somehow calculates it, but I can't find where to access this data.
Thanks. I'm sorry I did not explain myself so well.
I need this for a scatter chart, which does not have this property:
http://trykendoui.telerik.com/omOh
It somehow calculates it, but I can't find where to access this data.
0
Hi,
I see what you mean. The drag and zoom events only provide axis ranges for named axes.
We'll need to update the code as follows:
xAxis: {
name: "xAxis",
...
},
yAxis: {
name: "yAxis",
...
}
function printRange(e) {
var xRange = e.axisRanges.xAxis;
if (xRange) {
console.log(kendo.format("X [{0:N0}, {1:N0}]", xRange.min, xRange.max));
}
var yRange = e.axisRanges.yAxis;
if (yRange) {
console.log(kendo.format("Y [{0:N0}, {1:N0}]", yRange.min, yRange.max));
}
}
-- Live demo --
Note that the axis range will be passed only if it is changed, hence we need to check for it.
I see that this is not documented clearly and we'll update the docs.
Regards,
T. Tsonev
Telerik
I see what you mean. The drag and zoom events only provide axis ranges for named axes.
We'll need to update the code as follows:
xAxis: {
name: "xAxis",
...
},
yAxis: {
name: "yAxis",
...
}
function printRange(e) {
var xRange = e.axisRanges.xAxis;
if (xRange) {
console.log(kendo.format("X [{0:N0}, {1:N0}]", xRange.min, xRange.max));
}
var yRange = e.axisRanges.yAxis;
if (yRange) {
console.log(kendo.format("Y [{0:N0}, {1:N0}]", yRange.min, yRange.max));
}
}
-- Live demo --
Note that the axis range will be passed only if it is changed, hence we need to check for it.
I see that this is not documented clearly and we'll update the docs.
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
OMER
Top achievements
Rank 1
answered on 25 Jun 2014, 01:38 PM
Hi,
Thanks.
2 more questions:
1) Can I get this minimum/maximum value from the chart object itself somehow? I need it outside the pan/zoom events (for instance, when a user clicks a button outside the chart).
2) Another thing is - when pan/zoom return this, they return a value that is not correct. For instance, in my chart I'll be able to see 0 to 10,000, and after I zoom in with the wheel, I get 100 to 9900 (that's just an example). Is there a way to get the former limits, before the event?
Thanks
Thanks.
2 more questions:
1) Can I get this minimum/maximum value from the chart object itself somehow? I need it outside the pan/zoom events (for instance, when a user clicks a button outside the chart).
2) Another thing is - when pan/zoom return this, they return a value that is not correct. For instance, in my chart I'll be able to see 0 to 10,000, and after I zoom in with the wheel, I get 100 to 9900 (that's just an example). Is there a way to get the former limits, before the event?
Thanks
0
Hello OMER,
In both case you can store the min and the max in two variables. You just need to start from the axis.min and axis.max then in the pan/zoom event you need to update these variables.
Regards,
Hristo Germanov
Telerik
In both case you can store the min and the max in two variables. You just need to start from the axis.min and axis.max then in the pan/zoom event you need to update these variables.
Regards,
Hristo Germanov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
OMER
Top achievements
Rank 1
answered on 29 Jun 2014, 01:13 PM
Thanks. The question is - how do I even get to these values?
They do not exist anywhere.
For instance - I've just drawn a chart.
Now I have this:
Let's assume I bind a datasource to this chart with a 1000 points which I do not know their values.
Now the chart is being drawn and shows an X axis from 0 to 200. How can I get to these numbers (0 and 200) from the chart's object?
The xAxis and yAxis do not have the min/max values.
They do not exist anywhere.
For instance - I've just drawn a chart.
Now I have this:
$("mychart").kendoChart({
seriesDefaults: {
type: "scatter"
},
series: {
xField: "x",
yField: "y"
},
yAxis: { name: "yAxis" }, xAxis: { name: "xAxis"}
}
Now the chart is being drawn and shows an X axis from 0 to 200. How can I get to these numbers (0 and 200) from the chart's object?
The xAxis and yAxis do not have the min/max values.
0
Hello OMER,
You are right that is not so easy to get these values when the chart is bind via dataSource. In this case the chart should get the data before it calculate the axis min/max.
You need to hook up to the dataBound event and there with setTimeout you can get the current range.
You can get each axis by name. I hope this helps.
We will considered to add methods for getting axis by name and getting range by axis name.
I have updated your telerik points.
Regards,
Hristo Germanov
Telerik
You are right that is not so easy to get these values when the chart is bind via dataSource. In this case the chart should get the data before it calculate the axis min/max.
You need to hook up to the dataBound event and there with setTimeout you can get the current range.
dataBound:
function
(e) {
setTimeout(
function
() {
console.log(e.sender._plotArea.axes);
}, 100)
}
You can get each axis by name. I hope this helps.
We will considered to add methods for getting axis by name and getting range by axis name.
I have updated your telerik points.
Regards,
Hristo Germanov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!