Xamarin.android 单机器人的三分图

Xamarin.android 单机器人的三分图,xamarin.android,teechart,Xamarin.android,Teechart,我正在尝试创建一个与TeeChart集成的MonoDroid应用程序,我希望有一个活动来保存图表和一些其他组件,如textview、button等。下面是代码 protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Test); var testpanel

我正在尝试创建一个与TeeChart集成的MonoDroid应用程序,我希望有一个活动来保存图表和一些其他组件,如textview、button等。下面是代码

protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Test);
            var testpanel = FindViewById<LinearLayout>(Resource.Id.MealChartPanel);

            Steema.TeeChart.TChart tChart1 = new Steema.TeeChart.TChart(this);

            Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar();
            tChart1.Series.Add(bar1);

            bar1.Add(3, "Pears", Color.Red);
            bar1.Add(4, "Apples", Color.Blue);
            bar1.Add(2, "Oranges", Color.Green);
            Steema.TeeChart.Themes.BlackIsBackTheme theme = new Steema.TeeChart.Themes.BlackIsBackTheme(tChart1.Chart);
            theme.Apply();

            testpanel.AddView(tChart1);
        }

    <?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">
  <LinearLayout
     android:id="@+id/MealChartPanel"
     android:layout_width="fill_parent"
     android:layout_height="100dip"
     android:layout_marginLeft="5dip"
     android:layout_marginRight="5dip">
  </LinearLayout>
</LinearLayout>
protectedoverride void OnCreate(捆绑包)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Test);
var testpanel=findviewbyd(Resource.Id.MealChartPanel);
Steema.TeeChart.TChart tChart1=新的Steema.TeeChart.TChart(本);
Steema.TeeChart.Styles.bar1=新的Steema.TeeChart.Styles.Bar();
tChart1.系列。添加(bar1);
bar1.添加(3,“梨”,颜色为红色);
bar1.添加(4个“苹果”,颜色为蓝色);
bar1.添加(2,“橙子”,颜色为绿色);
Steema.TeeChart.Themes.BlackIsBackTheme主题=新的Steema.TeeChart.Themes.BlackIsBackTheme(tChart1.Chart);
theme.Apply();
testpanel.AddView(tChart1);
}
我使用了testpanel.AddView(tChart1);但是那里什么也没有显示,我怎么能把图表放到MealChartPanel线性布局中呢


谢谢,

这是因为您需要指定图表尺寸。您可以设置绝对像素尺寸或使用LayoutParams,例如:

  testpanel.AddView(tChart1, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));

谢谢,行得通!网站上有详细的教程吗?我的同事一直在为monotouch使用teechart,我正在研究他的代码,了解如何创建功能图表。但是monotouch和monodroid之间确实存在一些差异,就像在monotouch中一样,您可以设置ZoomScrollStyle,newChart.Chart.Aspect.ZoomScrollStyle=Steema.TeeChart.Drawing.Aspect.ZoomScrollStyles.Manual;但是如何在monodorid中设置呢?@user1467537在本月底之前,我们将发布一个新的测试版,其中包括教程。在MonoDroid中,可以设置Zoom.Style,例如:tChart1.Zoom.Style=Steema.TeeChart.ZoomStyles.FullChart@user1467537我们刚刚发布了一个测试版更新,其中包括完整的文档和教程:。我们希望下一个版本是最终版本。