This may seem like a issue that is easy to solve but I have not been able to solve it. Basically, I have a bar chart on a html web page. Using the System.Web.UI.DataVisualization.Charting to create the charts. What I want to do is change the look of the label. An idea of how my label looks like is: "M: 312 A: 321 S: 432". What I would like to do is make them on top of one another, not side by side. So "M: ..." will be the first line then the others. So three lines in total. Is there anyway I can do that?
Code:
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();
}
}
Try this:
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.