ASP.Net MS图表控件饼图:删除不必要的填充 [英] ASP.Net MS Chart Control Pie Chart: remove unwanted padding
问题描述
HI
我尝试创建使用MS图表控件的简单饼图。当我的饼图中的浏览器获取呈现我得到的饼图,我不能摆脱周围填充。我想饼图坐起来对图像的无填充或保证金的边缘。我如何才能做到这一点任何想法?
在下面的填充我的代码高亮显示为蓝色。即Chart1.BackColor = System.Drawing.Color.Blue;
<脚本类型=文/ C#RUNAT =服务器>
保护无效的Page_Load(对象发件人,EventArgs五)
{
//设置图表类型
Chart1.Series [系列1] =图表类型SeriesChartType.Pie。
//添加点
Chart1.Series [系列1] Points.AddY(12)。
Chart1.Series [系列1] Points.AddY(45)。
Chart1.Series [系列1] Points.AddY(67)。
//重新设置图表对象$ B $的彩色B Chart1.BackColor = System.Drawing.Color.Blue;
//重新设置图表区域
Chart1.ChartAreas [ChartArea1]的颜色背景色= System.Drawing.Color.Green。
}
< / SCRIPT>
< ASP:图表ID =Chart1=服务器>
<&系列GT;
< ASP:系列名称=系列1图表类型=馅饼>
< / ASP:系列>
< /系列>
< ChartAreas>
< ASP:ChartArea NAME =ChartArea1>
< / ASP:ChartArea>
< / ChartAreas>
< / ASP:图表>
我不是特别熟悉的饼图,但对于一个折线图的位置需要的ChartArea内设置:
< ChartArea NAME =ChartArea1背景色=透明边框宽度=0>
将; AxisX线宽=0IsMarginVisible =假>
< / AxisX>
将;位置身高=100宽度=100x =0y =0/>
< / ChartArea>
这是设置图表区开始在左上角,我相信并占据整个区域的图表(它100%)。然后,你需要 IsMarginVisible = FALSE
来防止在左边和右边的空白。希望这会为你工作。
HI
im trying to create simple pie chart using the MS Chart controls. When my pie chart gets rendered in the browser i get padding around the pie chart that i cant get rid of. i would like the pie chart to sit up against the edge of the image with no padding or margin. Any ideas on how i can achieve this?
in my code below the padding is highlighted in blue. i.e Chart1.BackColor = System.Drawing.Color.Blue;
<script type="text/C#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
//Set the chart type
Chart1.Series["Series1"].ChartType = SeriesChartType.Pie;
//add points
Chart1.Series["Series1"].Points.AddY(12);
Chart1.Series["Series1"].Points.AddY(45);
Chart1.Series["Series1"].Points.AddY(67);
//set back color of chart object
Chart1.BackColor = System.Drawing.Color.Blue;
//set back color of chart area
Chart1.ChartAreas["ChartArea1"].BackColor = System.Drawing.Color.Green;
}
</script>
<asp:Chart ID="Chart1" runat="server">
<Series>
<asp:Series Name="Series1" ChartType="Pie">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
I'm not specifically familiar with the Pie chart, but for a line chart the Position needs to be set within the ChartArea:
<ChartArea Name="ChartArea1" BackColor="Transparent" BorderWidth="0" >
<AxisX LineWidth="0" IsMarginVisible="False">
</AxisX>
<Position Height="100" Width="100" X="0" Y="0" />
</ChartArea>
That sets the chart area to start at the top left corner, I believe and take up the entire area of the chart (100% of it). Then you need IsMarginVisible = false
to prevent the margin on the left and the right. Hopefully that will work for you.
这篇关于ASP.Net MS图表控件饼图:删除不必要的填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!