1

axmapcontrol でマップをプロットし、同じ ITable を使用して IDataGraphwindow2 で散布図グラフを作成しようとしています。残念ながら、グラフは正しいデータで表示されますが、グラフのクリック イベントは機能していません。左クリックするとメモリ エラーが表示され、右クリックすると無効なメニューが表示されます。左クリックの場合、DataGraphTUI.dll が原因だと思います。IDataGraphWindow2 をロードするとき、これを初期化しないため、おそらくエラーが発生します。

以下のコードを見つけてください。

IDataGraphWindow2 pDGWin;
IDataGraphT dataGraphT = new DataGraphTClass();
IWorkspace shapefileWorkspace = null;
IWorkspaceFactory shapefileWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
shapefileWorkspace = shapefileWorkspaceFactory.OpenFromFile("C:\\abc.shp "), 0);
featureWorkspace = (IFeatureWorkspace)shapefileWorkspace;

featureLayer.FeatureClass = featureWorkspace.OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension("c:\\abc.shp"));

ITable gobjJoinedTable = (ITable)featureLayer.FeatureClass;

LoadaxMap(); /// a method to load up the axmapcontrol

dataGraphT.UseSelectedSet = true;
dataGraphT.HighlightSelection = true;
dataGraphT.GeneralProperties.Title = "Scatter Graph";
dataGraphT.LegendProperties.Visible = false;
dataGraphT.get_AxisProperties(0).Title = "Y Axis";
dataGraphT.get_AxisProperties(0).Logarithmic = false;
dataGraphT.get_AxisProperties(2).Title = "X Axis";
dataGraphT.get_AxisProperties(2).Logarithmic = false;

ISeriesProperties seriesProps = dataGraphT.AddSeries("scatter_plot");
seriesProps.SourceData = axMap.get_Layer(0) as ITable; // axMap is the map control. Itable direct binding also works here

seriesProps.SetField(0, "abc.shp-fieldname"); // you may add any fieldname
seriesProps.SetField(1, "abc.shp-fieldname");

dataGraphT.Update(null);
dataGraphT.UseSelectedSet = true;
dataGraphT.HighlightSelection = false;
dataGraphT.Update(null);
pDGWin = new DataGraphWindowClass();
pDGWin.DataGraphBase = dataGraphT;
pDGWin.PutPosition(546, 155, 1040, 540);
pDGWin.Show(true);

メモリ エラーは、モジュール 'DatagraphTUI.dll' のアドレス 0F4E358B でのアクセス違反です。アドレス 00000000 の読み取り

4

1 に答える 1

2

グラフの表示中に同じ問題が発生しました。次のコード行を使用して修正しました。

graphWindow.Application = ArcMap.Application

必要なのは、ArcMap アプリケーションへの参照だけです。

于 2011-09-30T20:57:02.050 に答える