如何在时间序列的轴边界上进行可缩放缩放

问题描述 投票:0回答:1

我开发了一个图表来显示温度。我不知道如何使用android plot制作可缩放的缩放时间轴。

我正在使用此函数来设置限制边框,但它只需要数字参数:我收到simpleDateFormat作为数据时间。

plot.getOuterLimits().set(minX : 0, maxX 9, minY : 0, maxY : 100);
java android zoom androidplot
1个回答
0
投票

Androidplot文档有一个section about enabling pan & zoom

例如,您可以启用水平平移/缩放:

PanZoom.attach(plot, PanZoom.Pan.HORIZONTAL, PanZoom.Zoom.STRETCH_HORIZONTAL);

就设置限制而言,有助于记住内部Androidplot将所有值视为数字。在没有看到更多代码的情况下,我只能假设您实际上在x轴上使用了纪元时间长值。基于这个假设,你可以这样做:

Date minTime = new Date(...) // earliest date to display
Date maxTime = new Date(...) // latest date to display
plot.getOuterLimits().set(minTime.getTime(), maxTime.getTime(), yourMinY, yourMaxY);
© www.soinside.com 2019 - 2024. All rights reserved.