When data-bound categorical series has zeros in the x-axis labels they are parsed and the zeros disappear. For example:
ASPX:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<telerik:RadHtmlChart runat="server" ID="Radhtmlchart1">
<PlotArea>
<Series>
<telerik:ColumnSeries DataFieldY="Score1"></telerik:ColumnSeries>
</Series>
<XAxis DataLabelsField="Student">
</XAxis>
</PlotArea>
</telerik:RadHtmlChart>
C#:
protected void Page_Load(object sender, EventArgs e)
{
Radhtmlchart1.DataSource = GetData();
Radhtmlchart1.DataBind();
}
protected DataTable GetData()
{
DataTable table = new DataTable();
table.Columns.Add("Student", typeof(string));
table.Columns.Add("Score1", typeof(int));
table.Rows.Add(new object[] { "0806014562", 40 });
table.Rows.Add(new object[] { "0806014562", 50 });
table.Rows.Add(new object[] { "0806014562", 70 });
return table;
}
Workarounds:
1) Use format string to add the desired missing zeros when parsed.
<LabelsAppearance DataFormatString="0{0}"></LabelsAppearance>
2) Add items programmatically
protected void Page_Load(object sender, EventArgs e)
{
Radhtmlchart1.DataSource = GetData();
Radhtmlchart1.DataBind();
DataTable currDT = GetData();
for (int i = 0; i < currDT.Rows.Count; i++)
{
AxisItem currItem = new AxisItem(currDT.Rows[i]["Student"].ToString());
Radhtmlchart1.PlotArea.XAxis.Items.Add(currItem);
}
}