在asp.net条形图的条形显示值 [英] Display Values on Bars of a Bar chart in asp.net

查看:175
本文介绍了在asp.net条形图的条形显示值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在asp.net图表栏的顶部显示值。
此外,我想隐藏x轴的同时显示出来。
对于模拟了请参阅下面的图像。谢谢你。

我试着以下但不工作。

 变种C = Horizo​​ntalChart;
        //c.ChartAreas.Add(new ChartArea(HChartArea));
        //c.ChartAreas[0].BackHatchStyle = ChartHatchStyle.None;
        c.ChartAreas [0] = .AxisX.MajorGrid.Enabled虚假的;
        c.ChartAreas [0] = .AxisY.MajorGrid.Enabled虚假的;
        c.ChartAreas [0] .AxisY.CustomLabels =code这里拉布勒值< -------------
        c.Width = 300;
        c.Height = 300;
        系列myHorizo​​ntalSeries =新系列();
        myHorizo​​ntalSeries.Color = System.Drawing.Color.Blue;
        myHorizo​​ntalSeries.ChartType = SeriesChartType.Bar;
        myHorizo​​ntalSeries.Points.DataBindXY(新的String [] {一,二,三化},新的INT [] {1,2,3});
        c.Series.Add(myHorizo​​ntalSeries);


解决方案

您应该尝试启用轴属性设置为false

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

要告诉你设置一系列的 IsValueShownAsLabel 属性值真正

I want to display values on the top of the bars in asp.net chart. Also I want to hide the x axis while displaying it. For mock up please see the image below. Thanks.

I tried following but doesn't work.

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);

解决方案

You should try setting the Axis Enabled property to false

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

To show the values you set the IsValueShownAsLabel property of the series to true

这篇关于在asp.net条形图的条形显示值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆