2

まもなく開始されるプロジェクトで、.Net 3.5 の MSChart コントロールを潜在的に使用することを検討し始めたところです。このプロジェクトの要件の 1 つは、必要に応じて、ユーザーがチャートを拡大して小さなデータ ポイントをより明確に表示できるようにすることです。

私は多くのチュートリアルを見てきましたが、ズームについて言及していないか、ズームを有効にする方法について簡単な情報を提供しているだけで、それを使用することは非常に明白であるため、説明は不要であると想定しているようです.

簡単なテスト プロジェクトを作成し、フォームにコントロールを追加してから、既定のシリーズにいくつかのポイントを追加しました。次に、ChartAreas コレクションに移動し、既定の ChartArea で、すべての Axis メンバーの ScaleView プロパティで Zoomable プロパティが True に設定されていることを確認しました。

アプリケーションを実行すると、チャートはすべて正しく表示されますが、拡大する方法がわかりません。クリック、ダブルクリック、スクロールホイール、ctrl-スクロールホイール、ctrl-+、その他多くのことを試しました。

私は明らかに何かが欠けています。私が間違っていること、ズームUIを有効にする方法、ズームUIを実際に使用する方法を教えてください。

私はVS2012を使用してWindows 7を使用しています。

ありがとうございました。

[編集: タイトルのばかげたスペルミスを修正]

4

1 に答える 1

9

次のようなことを行うと、マウスの左クリックとドラッグを使用してズームできるようになります。

private void ZoomToggle(bool Enabled)
{
    // Enable range selection and zooming end user interface
    this.cwSubplot.ChartAreas(0).CursorX.IsUserEnabled = Enabled;
    this.cwSubplot.ChartAreas(0).CursorX.IsUserSelectionEnabled = Enabled;
    this.cwSubplot.ChartAreas(0).CursorX.Interval = 0;
    this.cwSubplot.ChartAreas(0).AxisX.ScaleView.Zoomable = Enabled;
    this.cwSubplot.ChartAreas(0).AxisX.ScrollBar.IsPositionedInside = true;
    this.cwSubplot.ChartAreas(0).AxisX.ScrollBar.ButtonStyle = System.Windows.Forms.DataVisualization.Charting.ScrollBarButtonStyles.SmallScroll;
    this.cwSubplot.ChartAreas(0).AxisX.ScaleView.SmallScrollMinSize = 0;

    this.cwSubplot.ChartAreas(0).CursorY.IsUserEnabled = Enabled;
    this.cwSubplot.ChartAreas(0).CursorY.IsUserSelectionEnabled = Enabled;
    this.cwSubplot.ChartAreas(0).CursorY.Interval = 0;
    this.cwSubplot.ChartAreas(0).AxisY.ScaleView.Zoomable = Enabled;
    this.cwSubplot.ChartAreas(0).AxisY.ScrollBar.IsPositionedInside = true;
    this.cwSubplot.ChartAreas(0).AxisY.ScrollBar.ButtonStyle = System.Windows.Forms.DataVisualization.Charting.ScrollBarButtonStyles.SmallScroll;
    this.cwSubplot.ChartAreas(0).AxisY.ScaleView.SmallScrollMinSize = 0;
    if (Enabled == false) {
        //Remove the cursor lines
        this.cwSubplot.ChartAreas(0).CursorX.SetCursorPosition(double.NaN);
        this.cwSubplot.ChartAreas(0).CursorY.SetCursorPosition(double.NaN);
    }
}

ズームを実行するオブジェクトはどこthis.cwSubplotにありChartますか。

于 2013-09-30T17:06:51.160 に答える