gpt4 book ai didi

android - Afree图表: How to increase X axis values(gap or domain range) while zooming

转载 作者:行者123 更新时间:2023-11-30 02:49:46 25 4
gpt4 key购买 nike

任何人都可以帮助我进行下面的缩放!在进行水平缩放时,我想增加并显示间隙或范围。

https://dl.dropboxusercontent.com/u/184003479/actual.png

现在附加链接上的范围是 10,12,14,16... 缩放时应显示为 10,11,12,13,...我如何在缩放时增加这个域范围。请指导我。

最佳答案

protected 静态 int gapValue;//两个日期之间的差距

private void zoom(PointF source, double startDistance, double endDistance) {

    Plot plot = this.chart.getPlot();
PlotRenderingInfo info = this.info.getPlotInfo();

if (plot instanceof Zoomable) {
float scaleDistance = (float) (startDistance / endDistance);
//for maintaining the limit of zooming range horizontally
if (this.mScale * scaleDistance <= 1.0f
&& this.mScale * scaleDistance > 0.1f) {
this.mScale *= scaleDistance;
Zoomable z = (Zoomable) plot;
z.zoomDomainAxes(scaleDistance, info, source, false);

int sealValue = (int) (gapValue * this.mScale);
// gap shoud be greater than zero
if (sealValue == 0)
sealValue = 1;
// To re-render the graph dates in domain axis
((DateAxis) this.getChart().getXYPlot().getDomainAxis())
.setTickUnit(new DateTickUnit(DateTickUnitType.DAY,
sealValue, new SimpleDateFormat("MM/dd")));

}
}

// repaint
invalidate();

关于android - Afree图表: How to increase X axis values(gap or domain range) while zooming,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24407290/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com