この問題を Web で検索し、ドキュメントを調べましたが、解決策を見つけることができませんでした。
私のコードではMasterPaneを作成し、13個のGraphPanesを利用していますが、グラフが多いと細部が見づらくなってしまうので、グラフを選択(クリック)して拡大したいのですが、具体的に実現する機能はありますか?そうでない場合は、どの手順を実行する必要がありますか。
前もって感謝します
この問題を Web で検索し、ドキュメントを調べましたが、解決策を見つけることができませんでした。
私のコードではMasterPaneを作成し、13個のGraphPanesを利用していますが、グラフが多いと細部が見づらくなってしまうので、グラフを選択(クリック)して拡大したいのですが、具体的に実現する機能はありますか?そうでない場合は、どの手順を実行する必要がありますか。
前もって感謝します
遅くても、他の人に役立つことを願っています。
アイデアは、MasterPan PaneList コレクションを使用することです。
ウィンドウにいくつかのボタンを追加し、それらから制御を行います。もう 1 つの方法
は、MasterPan クラスで FindPane メソッドを使用し、クリックしてこれを行うことです。
両方の方法を示します。
コードは次のとおりです。
// graphSystem Class
MasterPane masterPane;
PaneList plist = new PaneList();
private void InitGraphs()
{
//Zedgraph control
var zgc = Apprefs.Zedgraph;
//MasterPan
masterPane = zgc.CreateMasterPan(Title, System.Drawing.Color.White);
// CreateMultiGraph is my own API to create Graph
zgc.CreateMultiGraph("Graph1", 1, "G1xtitle", "G1ytitle", false);
zgc.CreateMultiGraph("Graph2", 1, "G2xtitle", "G2ytitle", false);
zgc.CreateMultiGraph("Graph3", 1, "G3xtitle", "G3ytitle", false);
// save the Pans
foreach (GraphPane graph in masterPane.PaneList)
plist.Add(graph);
}
//---------------------------------------------------------------------------
public void Englare(RichButton button)
{
var graph = Apprefs.Zedgraph2.graph;
if (button.Name == "Show1")
{
ShowOneGraph(0);
}
else if (button.Name == "Show2")
{
ShowOneGraph(1);
}
else if (button.Name == "ShowAll")
{
ShowAllGraphs();
}
}
//---------------------------------------------------------------------------
private void ShowOneGraph(int Graphindex)
{
if (masterPane == null) return;
var graph = Apprefs.Zedgraph.graph;
if (Graphindex >= 0 && Graphindex < plist.Count)
{
masterPane.PaneList.Clear();
masterPane.PaneList.Add(plist[Graphindex]);
Layout();
}
}
//---------------------------------------------------------------------------
private void ShowAllGraphs()
{
if (masterPane == null) return;
var graph = Apprefs.Zedgraph.graph;
masterPane.PaneList.Clear();
foreach (GraphPane gr in plist)
masterPane.PaneList.Add(gr);
Layout();
}
//---------------------------------------------------------------------------
private void Layout()
{
var graph = Apprefs.Zedgraph2.graph;
using (Graphics g = graph.CreateGraphics())
{
masterPane.SetLayout(g, PaneLayout.SingleColumn);
graph.AxisChange();
graph.Refresh();
}
}
//---------------------------------------------------------------------------
方法 2: クリックしてにらみつける On Graph:
このメソッドを追加します。
//---------------------------------------------------------------------------
GraphPane lastpan;
public void UCclicked(PointF mousePt)
{
GraphPane pan= masterPane.FindPane(mousePt);
if (pan != null)
{
if (pan == lastpan)
{
ShowAllGraphs();
lastpan = null;
}
else
{
ShowOneGraph(plist.IndexOf(pan));
lastpan = pan;
}
} }
クリック イベントにも登録します。
zgcGraph.MouseDoubleClick += new MouseEventHandler(zgcGraph_MouseDoubleClick);
そして最後に:
void zgcGrzgcGraph_MouseDoubleClick(object source, System.Windows.Forms.MouseEventArgs e)
{
if (Apprefs.graphSystem != null)
{
System.Drawing.PointF mousePt = new System.Drawing.PointF(e.X, e.Y);
Apprefs.graphSystem.UCclicked(mousePt);
}
}
それでおしまい!