5

asp.netチャートのバーの上部に値を表示したい。また、表示中にx軸を非表示にしたい。モックアップについては、下の画像を参照してください。ありがとう。

asp.net のバーに値を含む棒グラフ

以下を試しましたが、うまくいきません。

var c = HorizontalChart;
        //c.ChartAreas.Add(new ChartArea("HChartArea"));
        //c.ChartAreas[0].BackHatchStyle = ChartHatchStyle.None;
        c.ChartAreas[0].AxisX.MajorGrid.Enabled = false;
        c.ChartAreas[0].AxisY.MajorGrid.Enabled = false;
        c.ChartAreas[0].AxisY.CustomLabels="Code here for Lable values" <-------------
        c.Width = 300;
        c.Height = 300;
        Series myHorizontalSeries = new Series();
        myHorizontalSeries.Color = System.Drawing.Color.Blue;
        myHorizontalSeries.ChartType = SeriesChartType.Bar;
        myHorizontalSeries.Points.DataBindXY(new string[] { "one", "two", "three" }, new int[] { 1, 2, 3 });
        c.Series.Add(myHorizontalSeries);
4

3 に答える 3

7

あなたは試すことができます:

asp.netチャートのバーの上部に値を表示したい。

myHorizontalSeries.IsValueShownAsLabel = true;

また、表示中にx軸を非表示にしたい。

c.ChartAreas[0].AxisX.Enabled = AxisEnabled.False;
于 2012-12-12T12:23:12.273 に答える
6

Axis Enabled プロパティを false に設定してみてください。

c.ChartAreas[0].AxisX.Enabled = AxisEnabled.False;

IsValueShownAsLabelシリーズのプロパティを設定した値を表示するにはtrue

于 2012-12-12T12:23:40.163 に答える
4

ラベルのような値を表示できる別の例

c.Series[myHorizontalSeries].Label = "#VALY";

私が助けたことを願っています。

于 2013-08-20T09:06:19.563 に答える