2014-06-13 3 views
0

난 아무 문제없이 Afreechart를 사용하여 내 응용 프로그램에서 간단한 차트 implemenented있다. 차트는 에뮬레이터와 이전의 3,5 인치 장치에서 제대로 전체 화면으로 표시되지만 새 5 인치 스마트 폰에 설치하면 차트의 절반 크기 만 차지합니다.AFreeChart 안드로이드 전체 화면보기

public class ChartActivity extends Activity { 

    private LinearLayout linearlayout; 

    /** 
    * Called when the activity is starting. 
    * @param savedInstanceState 
    */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 

     Intent myIntent = getIntent(); 
     String sonda = myIntent.getStringExtra("sonda"); 

     EconormaChart chartView = new EconormaChart(this, sonda); 
     requestWindowFeature(Window.FEATURE_NO_TITLE); 

     linearlayout = (LinearLayout) View.inflate(this, R.layout.chart, null); 
     linearlayout.addView(chartView); 
     setContentView(linearlayout); 
    } 
} 

XML은

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:orientation="vertical"> 
</LinearLayout> 

답변

1

를 해결. AfreeChart DemoView 확장 클래스에 따라 다릅니다.

public class EconormaChart extends DemoView { 
    } 

설명 ALL 해결을위한 DemoView 클래스 내부에이 라인과 차트 작품 :

  

     if (drawWidth < this.minimumDrawWidth) { 
      this.scaleX = drawWidth/this.minimumDrawWidth;   
     drawWidth = this.minimumDrawWidth; 
   } 
      else if (drawWidth > this.maximumDrawWid 
      this.scaleX = drawWidth/this.maximumDrawWid 
     drawWidth = this.maximumDrawWidth; 
       } 


       if (drawHeight < this.minimumDrawHeight) { 
            this.scaleY = drawHeight/this.minimumDrawHeight; 
            drawHeight = this.minimumDrawHeight; 
        } 
        else if (drawHeight > this.maximumDrawHeight) { 
            this.scaleY = drawHeight/this.maximumDrawHeight; 
            drawHeight = this.maximumDrawHeight; 
        } 
관련 문제