Asp.net control value label position

I am showing data in an asp.net chart control. Using 3D charts. I show the values ​​next to the bars. (seriesCount.IsValueShownAsLabel = true;). The chart control displays the value label at the top of the panel and makes the value difficult to read. I am trying to put this shortcut to the right, but so far I have not found a way to do this. I also tried turning on smart tags in the hope of putting a marker on the bar to push the value away, but I was not successful. Any suggestions are welcome.

Code example:

Chart chartSubjects = new Chart(); chartSubjects.Width = Unit.Pixel(800); chartSubjects.Height = Unit.Pixel(300); chartSubjects.AntiAliasing = AntiAliasingStyles.All; Series seriesCount = new Series("subjectsCountSeries"); seriesCount.YValueType = ChartValueType.Int32; seriesCount.ChartType = SeriesChartType.Bar; seriesCount.IsValueShownAsLabel = true; seriesCount.ChartArea = "subjectsCountArea"; chartSubjects.Series.Add(seriesCount); ChartArea areaCount = new ChartArea("subjectsCountArea"); LabelStyle yAxisStyle = new LabelStyle(); yAxisStyle.ForeColor = System.Drawing.ColorTranslator.FromHtml("#444444"); yAxisStyle.Font = new System.Drawing.Font("Arial", 11, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); areaCount.AxisY.LabelStyle = yAxisStyle; areaCount.AxisY.IsLabelAutoFit = false; areaCount.Position.Width = 50; areaCount.Position.Height = 100; areaCount.Position.X = 0; areaCount.Position.Y = 0; areaCount.Area3DStyle.Enable3D = true; areaCount.Area3DStyle.LightStyle = LightStyle.Realistic; areaCount.Area3DStyle.WallWidth = 4; areaCount.Area3DStyle.Inclination = 10; areaCount.Area3DStyle.Perspective = 10; areaCount.Area3DStyle.Rotation = 20; areaCount.Area3DStyle.PointDepth = 90; chartSubjects.ChartAreas.Add(areaCount); int[] pointsToAdd = new int[] { 1434, 712, 601, 204, 173, 168, 64, 35, 22, 8, 2 }; foreach (int point in pointsToAdd) { DataPoint dataPoint = new DataPoint(); dataPoint.SetValueY(point); seriesCount.Points.Add(dataPoint); } 

enter image description here

+4
source share
2 answers

Is this what you are looking for?

 <asp:Series Name="Series1" ChartType="Bar" CustomProperties="BarLabelStyle=Right" IsValueShownAsLabel="True" Palette="EarthTones" XValueMember="xvalue" YValueMembers="yvalue"> </asp:Series> 

CustomProperties="BarLabelStyle=Right" did this for me.

+1
source

In your case, I would use:

 chartSubjects.Series["seriesCount"]["LabelStyle"] = "Right"; 
0
source

Source: https://habr.com/ru/post/1380480/


All Articles