这似乎是一个容易解决的问题,但我无法解决它。基本上,我在html网页上有一个条形图。使用System.Web.UI.DataVisualization.Charting创建图表。我想要做的是改变标签的外观。我的标签看起来如何:“M:312 A:321 S:432”。我想做的是让它们彼此叠加,而不是并排。所以“M:......”将是第一线,然后是其他线。所以共有三行。无论如何我能做到吗?
代码:
Chart1.Visible = true;
DataTableReader datareader = table.CreateDataReader();
Chart1.DataBindCrossTable(datareader, "FunctionGroup", "Date", "AverageGrading", "");
Chart1.Legends.Add("Legend");
Chart1.ChartAreas[0].AxisX.Title = "Period of feedback";
Chart1.ChartAreas[0].AxisY.Title = "Average grade";
Chart1.Legends[0].Enabled = true;
Chart1.Legends[0].BackColor = System.Drawing.Color.Transparent;
Chart1.Width = 1000;
Chart1.Height = 600;
ArrayList listOfStDev = new ArrayList();
ArrayList listOfMed = new ArrayList();
foreach (DateTime date in listofdates)
{
listOfStDev.Add(dbmanager.GetStdDevAppraisalForFunction(section, functionlist, date, questionID));
listOfMed.Add(GetMedianFunctionViaSectionCount(section, functionlist, date, questionID));
}
for (int i = 0; i < Chart1.Series.Count; i++)
{
for (int k = 0; k < Chart1.Series[i].Points.Count; k++)
{
Chart1.Series[i].Points[k].Label = "A: " + "#VALY" + " S: " + Convert.ToDouble(listOfStDev[k]).ToString("F") + " M: " + Convert.ToDouble(listOfMed[k]).ToString();
}
}
答案 0 :(得分:1)
试试这个:
<asp:Chart ID="Chart1" runat="server">
<Series>
<asp:Series Name="Series1" Label="A: #VAL\nS: #VALX\nM: #INDEX">
<Points>
<asp:DataPoint XValue="1" YValues="10" />
<asp:DataPoint XValue="2" YValues="20" />
<asp:DataPoint XValue="3" YValues="30" />
</Points>
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
<AxisY>
<MajorGrid LineColor="DarkGray" LineDashStyle="Dot" />
</AxisY>
<AxisX>
<MajorGrid LineColor="DarkGray" LineDashStyle="Dot" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>