我正在尝试使用Xamarin和Microcharts创建一个不错的情节。不幸的是,微图似乎不再维护了,轴标签直接是not supported。
我想知道是否有一种手动添加轴标签的方法。我绘制信号的代码如下:
private void PlotSignals() {
ChartView chartView = FindViewById<ChartView>(Resource.Id.chartView);
var chart = new LineChart();
chart.IsAnimated = false;
chart.LineMode = LineMode.Straight;
chart.PointMode = PointMode.None;
var chartEntries = //my chart entries
chart.Entries = chartEntries;
chartView.Chart = chart;
}
相应的.axml布局文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_myActivity">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<microcharts.droid.ChartView
android:id="@+id/chartView"
android:layout_width="match_parent"
android:layout_height="160dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<Button
android:id="@+id/StartButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="false"
android:layout_weight="0.5"
android:text="Start"
/>
<Button
android:id="@+id/StopButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Stop"
/>
</LinearLayout>
</RelativeLayout>