2014-06-25 71 views

回答

1

protected static int gapValue; //兩個日期

私人無效變焦(的PointF源,雙startDistance,雙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(); 
之間間隙