Graphics.DrawRectangle有好几个重载方法。你用的是
public void DrawRectangle(
Pen pen,
int x,
int y,
int width,
int height
)
如果数据(也就是矩形的Heigh)的差异不是很大,例如12个月的降雨量为:
92.2, 92.8,92.7,……,
用上面的函数作出的图形时,由于隐含的浮点到整型的转换,导致图形显示时,矩形的高度都为92!这不符合实际情况!
建议
1)用
public void DrawRectangle(
Pen pen,
float x,
float y,
float width,
float height
)
来作图
2)在保持图形大小不变的前提下,根据降雨量最大值和最小值,适当地“压缩”Y轴的坐标范围。例如Y轴只画出降雨量50~100。