开发者

asp.net chart: final series getting cut off when setting .AxisX.Maximum

I'm trying to bind a data table like,

month       value
  5          345
  10         1300
  12         450

to an ASP.NET Chart control. My problem is that the data table only contain months that have values while in the chart i want to show the full month range from 1st to the 12th.

So i used

Chart1.ChartAreas["ChartArea1"].AxisX.Minimum = 1;
Chart1.ChartAreas["ChartArea1"].AxisX.Maximum = 12;

But when i do this, a part of the final series gets cut off in the middle like this.

asp.net chart: final series getting cut off when setting .AxisX.Maximum

I can avoid this issue by making the maximum 开发者_如何学JAVA13 but that would not be appropriate since i just need to show the months of the year. Please help.


Yes but look at how the x-axis is measured; it is not just 12, then 13. It is 12.2, 12.4, 12.6, 12.8 and then 13.0. So you see if you make 12.0 the maximum you are not going to get the entire bar for the final month. Also your x-axis shouldn't even be on that interval in the 1st place. It should be in whole numbers only since you are measuring months.

An example of using the "Interval" property on an Axis in a bar chart:

<axisx Title="MyValue" Interval="1" IsMarginVisible="false">

I use ASP.NET charts a lot, and the best site is the one below. I highly recommend downloading the FULL .NET project and look at the samples and code. These types of bar charts are trivial, as you will see after looking at some of the examples in the .aspx sample pages.

Samples Environment for Microsoft Chart Controls:
http://code.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=4418


this is about aligning the series position and controlling the width of series

check links

http://asp-net-example.blogspot.com/2010/09/how-to-use-chart-backimagealignment.html

MS Chart with ASP.NET chart type "column" not showing axis x label if there are more than 9 bar in the chart

http://forums.asp.net/p/1516836/3636476.aspx

also generally useful

http://betterdashboards.wordpress.com/2009/02/11/align-multiple-chart-areas/

http://www.ezzylearning.com/tutorial.aspx?tid=4337488

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜