admin管理员组文章数量:1430063
I really appreciate if someone can help me out on this. We are using Jqplot to plot some statistical data and like the zooming functionality.
Specifically we want to use the examples in
.html and
.html
One of the thing we need to do is to recalculate some values we display on the page like standard deviation, mean etc for the points visible in the graph after zooming in. For this we need to get the list of data points that are there (remain) on the graph after we zoomed in. So ideally we are looking at a method which returns the current data set visible in the graph after I zoomed in.
I looked up the API documentation, but no such method seems to be available. So I would really appreciate if somebody helps with how I should proceed with this.
Thanks....Amit
I really appreciate if someone can help me out on this. We are using Jqplot to plot some statistical data and like the zooming functionality.
Specifically we want to use the examples in
http://www.jqplot./deploy/dist/examples/zoom1.html and
http://www.jqplot./deploy/dist/examples/zoomOptions.html
One of the thing we need to do is to recalculate some values we display on the page like standard deviation, mean etc for the points visible in the graph after zooming in. For this we need to get the list of data points that are there (remain) on the graph after we zoomed in. So ideally we are looking at a method which returns the current data set visible in the graph after I zoomed in.
I looked up the API documentation, but no such method seems to be available. So I would really appreciate if somebody helps with how I should proceed with this.
Thanks....Amit
Share Improve this question asked May 24, 2013 at 9:59 AmitabhAmitabh 7391 gold badge11 silver badges30 bronze badges 2- I'm trying to get the same data as well for another reason, but I'm not seeing any easy way to do it. I will update with an answer if I find anything – Java Drinker Commented May 24, 2013 at 15:03
- Thanks @JavaDrinker . On same boat :-) – Amitabh Commented May 24, 2013 at 15:36
1 Answer
Reset to default 6Ok, so after a lot of digging through the code, there is not really any simple way to get this data, but, there is a way.
In the solution below, I have a zoomChart jqPLot obj that acts as a zoom-proxy to my main jqPLot, called chart. Presumably, if you don't have a proxy, this should work just as well, as long as you bind to the right object.
What I'm doing is binding a custom function to the 'jqplotZoom' event, which is called after a zoom action has been pleted.
zoomChart.target.bind('jqplotZoom', function(ev, gridpos, datapos, plot, cursor){
var plotData = plot.series[0].data;
for (var i=0; i< plotData.length; i++) {
if(plotData[i][0] >= chart.axes.xaxis.min && plotData[i][0] <= chart.axes.xaxis.max ) {
//this dataset from the original is within the zoomed region
//You can save these datapoints in a new array
//This new array will contain your zoom dataset
//for ex: zoomDataset.push(plotData[i]);
}
}
});
Does this make sense? Essentially, the chart.axes.xaxis
contains the bounds of the zoomed area, and the plot.series[N].data
is all your original data in the chart format.
Note that I used chart
because I originally created var chart = $.jqplot("chartDiv", ...
You should use whatever variable name you gave your plot. Hope this helps!
本文标签: javascriptGet list of data points in the canvas after zoom jqplotStack Overflow
版权声明:本文标题:javascript - Get list of data points in the canvas after zoom jqplot - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745472507a2659813.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论