问题
HI i want to start bar from 10 rather than 0. is it possible and how?
chart1.ChartArea["ChartArea1"].AxisY.IsStartedfromZero=false
chart1.ChartArea["ChartArea1"].AxisY.minimum=10 //but this line replace 0
another command to bar start from 10 in ms chart.
回答1:
you are probably using the the wrong ChartType, what your code does is shift the baseline from Zero and instead start from 10
I presume what you really want is a Range Bar chart wherein you will have 2 values per bar representing the low and high values which would help in representing the bar midway.
Something like Product A low - 10 High 25 now this should show you a bar extending from 10 to 25. In this fashion you can set up for the other points.
EDIT Now its a bit more clear (from the link) for this you will have to use
Chart1.ChartAreas[0].AxisY.Crossing = 10;
and remove the AxisY.Minimum and you should be fine.
回答2:
Refer to the Bar Chart Custom Attributes to know about setting the start point of bar in mscharting.
来源:https://stackoverflow.com/questions/8383795/y-axis-start-from-10-rather-than-0-in-mschart-using-windows-application