1

我正在尝试通过他们的教程(第一个)中的 TeeChart 示例来工作。由于某种原因,当我运行下面的代码时,它会导致 UnsupportedOperationException 发生。任何人都可以就为什么会发生这种情况提供任何帮助。

以下是相关文件。

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.teeChart02"
          android:versionCode="1"
          android:versionName="1.0">
    <uses-sdk android:minSdkVersion="15"/>
    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
        <activity android:name="MyActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

主要的.xml

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

我的活动.java

package com.example.teeChart02;

import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import com.steema.teechart.TChart;
import com.steema.teechart.drawing.Color;
import com.steema.teechart.styles.Bar;
import com.steema.teechart.styles.Series;

public class MyActivity extends Activity
{
    private TChart chart;

    @Override
    public void onCreate( Bundle savedInstanceState )
    {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.main );

        LinearLayout ll = (LinearLayout) findViewById( R.id.mylayout );

        chart = new TChart( this );
        ll.addView( chart );

        Series bar = new Bar( chart.getChart() );
        chart.getAxes().getBottom().setIncrement( 1 );
        bar.add( 123, "Apples", Color.green );
        bar.add( 456, "Oranges", Color.red );
        bar.add( 321, "Kiwis", Color.yellow );
        bar.add( 78, "Bananas", Color.orange );
    }
}

生成的异常是:

01-17 11:50:27.863: ERROR/AndroidRuntime(1631): FATAL EXCEPTION: main
        java.lang.UnsupportedOperationException
        at android.view.GLES20Canvas.clipPath(GLES20Canvas.java:413)
        at com.steema.teechart.android.Graphics3DAndroid.clipPolygon(Graphics3DAndroid.java:312)
        at com.steema.teechart.drawing.Graphics3D.clipToRight(Graphics3D.java:4575)
        at com.steema.teechart.drawing.Graphics3D.clipCube(Graphics3D.java:4614)
        at com.steema.teechart.styles.Series.clipRegionCreate(Series.java:2088)
        at com.steema.teechart.styles.Series.drawSeries(Series.java:2311)
        at com.steema.teechart.Chart.drawAllSeries(Chart.java:790)
        at com.steema.teechart.Chart.drawAxesSeries(Chart.java:752)
        at com.steema.teechart.Chart.internalDraw(Chart.java:732)
        at com.steema.teechart.Chart.paint(Chart.java:2080)
        at com.steema.teechart.Chart.paint(Chart.java:2096)
        at com.steema.teechart.TChart.onDraw(TChart.java:322)
        at android.view.View.draw(View.java:10978)
        at android.view.View.getDisplayList(View.java:10417)
        at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
        at android.view.View.getDisplayList(View.java:10415)
        at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
        at android.view.View.getDisplayList(View.java:10415)
        at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
        at android.view.View.getDisplayList(View.java:10415)
        at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
        at android.view.View.draw(View.java:10981)
        at android.widget.FrameLayout.draw(FrameLayout.java:450)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2126)
        at android.view.View.getDisplayList(View.java:10417)
        at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:842)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:1910)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1634)
        at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4424)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
        at dalvik.system.NativeStart.main(Native Method)
4

2 回答 2

2

请检查您是否在“项目属性 -> Java 构建路径 -> 订购和导出”选项卡中选择了 TeeChart.Android.jar 库

于 2013-01-21T15:31:06.173 回答
1

我使用 TeeChart 工作得很好,minSdkVersion 为 11,目标为 13。一旦我切换到 minSdkVersion 为 12,目标为 15,我开始收到完全相同的错误。我还没有花时间找出问题所在,但是当我切换回 11 和 13 时,问题就消失了

于 2013-06-07T12:32:44.347 回答