本文介绍了在ASP.NET图表控件中水平对齐图表区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在一个图表控件中有两个图表区域Chartarea1和Chartarea2.
I have two chart areas Chartarea1 and Chartarea2 inside a single chart control.
但这是垂直对齐的,我想水平对齐.我使用AlignmentOrientation ="Horizontal",但没有帮助.
But this is getting aligned vertically, I want to align it horizontally. I used AlignmentOrientation="Horizontal" but of no help.
我得到的输出如下:
但是我需要输出为:
But i need output as:
<asp:Chart ID="chartTest" runat="server" EnableViewState="true" Visible="false" Width="650px"><Titles><asp:Title Text="Test" Font="Arial, 11pt, style=Bold" /></Titles><Series><!--have few series here --></Series><ChartAreas><asp:ChartArea Name="ChartArea1" Area3DStyle-Enable3D="false"><Area3DStyle Enable3D="false" WallWidth="3" LightStyle="Realistic"></Area3DStyle></asp:ChartArea><asp:ChartArea Name="ChartArea2" Area3DStyle-Enable3D="false"><Area3DStyle Enable3D="false" WallWidth="3" LightStyle="Realistic"></Area3DStyle></asp:ChartArea></ChartAreas></asp:Chart>
任何帮助将不胜感激.
推荐答案
您可以控制ChartArea
的位置和大小:
You can control ChartArea
's position and size:
protected void Page_Load(object sender, EventArgs e)
{
Chart1.ChartAreas[0].Position.Auto = false;
Chart1.ChartAreas[0].Position.X = 0;
Chart1.ChartAreas[0].Position.Y = 0;
Chart1.ChartAreas[0].Position.Height = 25;
Chart1.ChartAreas[0].Position.Width = 25;
Chart1.ChartAreas[1].Position.Auto = false;
Chart1.ChartAreas[1].Position.X = 25;
Chart1.ChartAreas[1].Position.Y = 0;
Chart1.ChartAreas[1].Position.Height = 25;
Chart1.ChartAreas[1].Position.Width = 25;
}
这篇关于在ASP.NET图表控件中水平对齐图表区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!