zedgraph を使用してローリング グラフを作成しようとしています。ウェブサイトhttp://zedgraph.dariowiz.com/index3061.htmlにあるコードを使用しました 。正常に動作しています。サンプルのグラフは、curveitem を使用して次のように実装されています。
if ( zedGraphControl2->GraphPane->CurveList->Count <= 0 )
return;
// Get the first CurveItem in the graph
LineItem ^curve = dynamic_cast<LineItem ^>(zedGraphControl2->GraphPane->CurveList[0]);
if(curve == nullptr)
return;
// Get the PointPairList
IPointListEdit ^list = dynamic_cast <IPointListEdit^>(curve->Points);
// If this is null, it means the reference at curve.Points does not
// support IPointListEdit, so we won't be able to modify it
if ( list == nullptr)
return;
// Time is measured in seconds
double time = (Environment::TickCount - tickStart);
Output_data = CreateVariable(0);// User defined function
list->Add(time, Output_data);
次のコードを追加して、2 番目の曲線を作成しようとしました。
LineItem ^curve1 = dynamic_cast<LineItem ^>(zedGraphControl2->GraphPane->CurveList[1]);
if(curve1 == nullptr)
return;
// Get the PointPairList
IPointListEdit ^list1 = dynamic_cast <IPointListEdit^>(curve1->Points);
// If this is null, it means the reference at curve.Points does not
// support IPointListEdit, so we won't be able to modify it
if ( list1 == nullptr)
return;
// Time is measured in seconds
double time = (Environment::TickCount - tickStart);
Output_data = CreateVariable(0);// User defined function
list1->Add(time, Output_data); }
問題は、2 番目の LineItem を作成する方法です。
入力した場合: LineItem ^curve1 = dynamic_cast(zedGraphControl2->GraphPane->CurveList[1]); デバッグ中に、CurveList[1] が存在しないというエラーが表示されます。