浮地重置缩放 [英] Flot reset zoom

查看:52
本文介绍了浮地重置缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Flot Charts与鼠标滚动配合使用来放大和缩小.我创建了一个调用zoomOut()的按钮,它很好用,但是我找不到如何一直缩小以使其看起来像第一次加载时那样的解决方案.我不想重新加载who容器,因为它使用ajax在刷新时从mysql提取数据.

I'm using Flot Charts with mouse scroll to zoom in and out. I created a button to call zoomOut() and it works well, but I can't find any solution to how I can zoom out all the way so that it Looks just like when it was first loaded. I don't want to reload that who container because it using ajax to pull data from mysql on refresh.

我用Google搜索,但找不到任何东西.

I Googled but couldn't find anything.

推荐答案

您可以保存轴的初始范围并像

You can save your initial ranges of axes and redraw your plot like in example for navigating. But your code will be look like these:

// do the zooming
plotObjectPointer = $.plot(placeholder, plotData,
    $.extend(true, {}, options, {
        xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to },
        yaxis: { min: ranges.yaxis.from, max: ranges.yaxis.to }
    }));

其中范围将是您的初始范围.为了防止重复加载Ajax,可以使用window.localStorage或仅使用另一个var来存储plotData.

where ranges will be your initial ranges. To prevent repeated Ajax loading you can use window.localStorage or just another var for storing plotData.

这篇关于浮地重置缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆