0

午後中ずっと、関連するものをグーグルで探してみましたが役に立たなかったので、皆さんの何人かが私を助けてくれることを願っています.

ユーザーからさまざまな値を収集し、これらを最終的な「結果ページ」に表形式で表示する asp:wizard ユーザー コントロールを使用しています。

作成するグラフの種類 (折れ線/積み上げ縦棒グラフ) を決定する Bool パラメーターを取る別の「GraphEngine」クラスを作成しました。

//T13 is selection of line/stacked column chart type.
public Chart GetChart(bool T13)
    {

        Chart chart = new Chart();

        //define some shared properties no matter which ChartType.
        chart.Width = 900;
        chart.Height = 500;
        chart.ChartAreas.Add("ChartArea1");
        chart.Series.Add("Costs");
        chart.Series.Add("Stages");
        chart.Legends.Add("Legend1");

        if (T13 == true)
        {
            //chart = charttype1 and add values from Dictionary<string, bool>
        }
        else
        {
            //chart = charttype2 and add values..............
        }
        return chart;

    }

次に、ウィザード コントロール (acsx.cs ファイル) の最終ステップで GetChart を呼び出します。

GraphEngine GE = new GraphEngine(GraphData);
System.Web.UI.DataVisualization.Charting.Chart Chart =  GE.GetChart(t13);
//What should I be saying here to render Chart as "Chart" rather than literal
LiteralGraph.Text =  GE.GetChart(getSetGraphData, t13).ToString();

グラフの表示方法がわかりません

ID "Chart" のチャートは .ascx ページにあります。?

注: ユーザー コントロール ウィザードのステップ内ですべてのグラフの値と軸などを作成/定義すると、正常に返されますが、ascx.cs ファイルに多数のコード行 (検証など) があるため、グラフ生成を分離する必要があります。それから150の奇数行を分離したいと思います。これはおそらく物事を行うための「正しい」方法ですか?

前もって感謝します。

4

1 に答える 1