OxyPlotビューを使用して、ダイアグラムにデータを表示しています。昨日まで正しく動作しています。バープロットを含むモデルを作成中のOxyplot例外
Oxyplotのexcepttion:オブジェクト参照のインスタンスに設定されていない私は、アクティビティページがOxyPlotを含んで開くたびに、それだけでモバイル画面上にこのメッセージを示し、自分のアプリケーションにデータベース部(SQLiteの)を添加し、以来 オブジェクトです。型system.NullReferenceExceptionの例外は私が
System.NullReferenceException
がスローされたときにブレークポイントを置くことによって、それが起こっている場所を見つけることを試みた[0x00006]
Oxyplot.ReflectionPath..ctor(可能System.Stringパス)で を投げたが、プログラムは停止されませんでした。 UPDATED
design d = new design();
var plotView = new PlotView(this);
plotView.Model = d.CreatePlotModelTest;
this.AddContentView(plotView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
:
私が気づい、代わりにバーシリーズのプロットモデルを作成しながら、私は線形シリーズを使用した場合、エラーの私の活動のユーザインタフェースにPlotView
コントロールを追加する
消えるだろう。しかし、私が棒のシリーズを試してみると(下のコードでは、あなたがコメントされているのを見ることができます)、アプリケーションは私にエラーを再度表示します。
public PlotModel CreatePlotModelTest()
{
var plotModel = new PlotModel { Title = "OxyPlot Demo" };
plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Maximum = 10, Minimum = 0 });
var series1 = new LineSeries
{
MarkerType = MarkerType.Circle,
MarkerSize = 4,
MarkerStroke = OxyColors.White
};
series1.Points.Add(new DataPoint(0.0, 6.0));
series1.Points.Add(new DataPoint(1.4, 2.1));
series1.Points.Add(new DataPoint(2.0, 4.2));
series1.Points.Add(new DataPoint(3.3, 2.3));
series1.Points.Add(new DataPoint(4.7, 7.4));
series1.Points.Add(new DataPoint(6.0, 6.2));
series1.Points.Add(new DataPoint(8.9, 8.9));
plotModel.Series.Add(series1);
/*var barSeries = new BarSeries
{
ItemsSource = new List<BarItem>(new[]
{
new BarItem{ Value = (2) },
new BarItem{ Value = (3) },
new BarItem{ Value = (4) },
new BarItem{ Value = (5) },
new BarItem{ Value = (6) }
}),
LabelPlacement = LabelPlacement.Inside,
LabelFormatString = "{2:0.0}"
};
plotModel.Series.Add(barSeries);
plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
plotModel.Axes.Add(new CategoryAxis
{
Position = AxisPosition.Left,
Key = "CakeAxis",
ItemsSource = new[]
{
"Apple cake",
"Baumkuchen",
"Bundt Cake",
"Chocolate cake",
"Carrot cake"
}
});*/
return plotModel;
}
誰かが、バーシリーズのモデルを作成する際の問題点は何ですか?
どのラインでエラーが発生していますか? – Piyush
これは私の問題です。私はブレークポイントを設定しましたが、実際にVSはエラーをどのラインで表示していません。 –
'energyBarsList'と' PlotView'とは何ですか?あなたが作成したPlotViewクラスを表示します。 – Piyush