如何在asp.net C#中动态裁剪图像大小?
嗨成员,
我有一个颜色渐变图像设置为适合0到120的图表范围。但我现在的问题是我的问题图表范围可以根据填充的图表动态变化。
我的问题是如何在asp.net C#中动态裁剪我的图像以裁剪想象一下图表吗?
目前默认的颜色渐变图像非常适合0到120的范围:
http://i.stack.imgur.com/Xlh8N.png [ ^ ]
但是让我们拿一个看看图像是静态的问题,并且不会相应地调整图表范围:
http ://i.stack.imgur.com/1aVPc.png [ ^ ]
因此我想这样做:
1.获取图表的最大价值
2.例如如果值= 60,则%= 60/120 = 50%
3.从顶部动态裁剪50%并将其拉伸至100%以适合Y轴高度
我希望结果是:
http://i.stack.imgur.com/p8Bmt.png [ ^ ]
如果有任何其他方法来创建渐变色图像,请动态建议这样做!非常感谢。
Hi members,
I have a colour gradient image that is set to fit nicely on a chart range from 0 - 120. However my problem now is that my chart range can change dynamically according to the charts that is populated.
My question is how can I dynamically crop my image in asp.net C# to crop the image nicely to the chart?
Currently the default colour gradient image that fits nicely for range 0 - 120:
http://i.stack.imgur.com/Xlh8N.png[^]
However lets take a look at the problem which the image is static and does not adjust accordingly to the chart range:
http://i.stack.imgur.com/1aVPc.png[^]
Thus I would like to do in this approach:
1. get the max value of the chart
2. e.g. if value = 60, the % = 60/120 = 50%
3. dynamically crop 50% from the top and stretch it to 100% to fit the Y Axis height
which I would like the results to be:
http://i.stack.imgur.com/p8Bmt.png[^]
OR if there is any other approach to create gradient colour image like these dynamically do suggest too! thanks a lot.