Android 自由图表:如何在缩放时增加X轴值(间隙或域范围)
有人能帮我做下面的缩放吗! 在进行水平缩放时,我希望增加并显示间距或范围 现在连接的范围是10,12,14,16。。。缩放时,它应显示为10,11,12,13,。。。Android 自由图表:如何在缩放时增加X轴值(间隙或域范围),android,jfreechart,Android,Jfreechart,有人能帮我做下面的缩放吗! 在进行水平缩放时,我希望增加并显示间距或范围 现在连接的范围是10,12,14,16。。。缩放时,它应显示为10,11,12,13,。。。 如何在缩放时增加此域范围。请指导我。受保护的静态int-gapValue//两个日期之间的间隔 专用空心缩放(点F源、双起点距离、双终点距离){ Plot-Plot=this.chart.getPlot(); PlotRenderingInfo=this.info.getPlotInfo(); if(可缩放的绘图实例){ 浮点数
如何在缩放时增加此域范围。请指导我。受保护的静态int-gapValue//两个日期之间的间隔 专用空心缩放(点F源、双起点距离、双终点距离){
Plot-Plot=this.chart.getPlot();
PlotRenderingInfo=this.info.getPlotInfo();
if(可缩放的绘图实例){
浮点数距离=(浮点数)(起点距离/终点距离);
//用于保持水平缩放范围的限制
如果(this.mScale*scaleDistance 0.1f){
this.mScale*=scaleInstance;
可缩放z=(可缩放)图;
z、 zoomDomainAxes(缩放位置、信息、来源、错误);
int sealValue=(int)(gapValue*this.mScale);
//间隙应大于零
如果(sealValue==0)
sealValue=1;
//在域轴中重新呈现图形日期的步骤
((DateAxis)this.getChart().getXYPlot().getDomainAxis())
.setTickUnit(新的DateTickUnit(DateTickUnitType.DAY),
sealValue,新简化格式(“MM/dd”);
}
}
//重新油漆
使无效();
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();