我已在标签面板中动态生成图表。我现在面临的问题是,当生成许多图表时,它会彼此并排生成。如何在每行中只有1个图表,而不是将它们水平并排显示在一起?每张图表应该分别为1行。
这是我执行程序时目前看到的内容:
//Aspx file
<div>
<asp:scriptmanager ID="ScriptManager1" runat="server">
</asp:scriptmanager>
</div>
<asp:updatepanel ID="UpdatePanel1" runat="server" ScrollBars="Horizontal">
<contenttemplate>
<asp:placeholder ID="PlaceHolder1" runat="server"></asp:placeholder>
</contenttemplate>
</asp:updatepanel>
//Cs file
AjaxControlToolkit.TabContainer container = new AjaxControlToolkit.TabContainer();
container.ID = "TabContainer";
container.EnableViewState = false;
container.Tabs.Clear();
foreach (ListItem item in SelectionListBox.Items)
{
if (item.Selected)
{
Label tabContent = new Label();
tabContent.ID = "lbl_tab_";
tabContent.Text += item.Value;
Chart Chart1 = new Chart();
Chart1.DataSource = dt;
Chart1.Width = 715;
Chart1.Height = 450;
Chart1.Series.Add(new Series());
Chart1.Series[0].ChartType = SeriesChartType.BoxPlot;
List<object> List1 = dt_LVL1RISKCHART.AsEnumerable().ToList<object>();
foreach (DataRow row in dt.Rows)
Chart1.Series[0].Points.AddXY(row["STATUS"], new object[] { row["MIN"], row["MAX"], row["25TH_PERCENTILE"], row["75TH_PERCENTILE"], row["AVG"], row["50TH_PERCENTILE"] });
//create chartareas
ChartArea ca = new ChartArea();
ca .AxisX = new Axis();
ca .AxisY = new Axis();
Chart1.ChartAreas.Add(ca);
//databind
Chart1.DataBind();
Chart1.Visible = true;
AjaxControlToolkit.TabPanel panel = new AjaxControlToolkit.TabPanel();
panel.HeaderText += item.Value;
container.Tabs.Add(panel);
panel.Controls.Add(tabContent);
panel.Controls.Add(Chart1);
}
}
PlaceHolder1.Controls.Add(container);
}
public AjaxControlToolkit.TabPanel GetManualTab()
{
AjaxControlToolkit.TabPanel panel = new AjaxControlToolkit.TabPanel();
return panel;
}
问题:如果一次生成多个图表,如何仅在标签面板的每一行显示 1图表?
我需要这方面的帮助,感谢有人能为我提供帮助,非常感谢!!
答案 0 :(得分:0)
尝试使用宽度为100%的<div>
包装图表。