ajax条形图y轴显示小数

时间:2017-02-26 12:01:37

标签: c#

enter image description here

我想设置ajax条形图y轴,如1,2,3,4,5.... 现在它显示为0.9,1.8,2.7,3.6,4.5..... 有什么办法吗?

var complaintSummery = bl.GetDailyComplaintSummery().ToList();
string[] x = new string[complaintSummery.Count];
decimal[] y = new decimal[complaintSummery.Count];
for (int i = 0; i < complaintSummery.Count; i++)
{
    x[i] = complaintSummery[i].Date.Day.ToString();
    y[i] = complaintSummery[i].ComplaintCount;
}
BarChart1.Series.Add(new AjaxControlToolkit.BarChartSeries { Data = y, BarColor = "#d43f3a", Name = "Complaint Count"});
BarChart1.CategoriesAxis = string.Join(",", x);
BarChart1.ChartTitle = string.Format("Daily Complaints");
BarChart1.Visible = true;

2 个答案:

答案 0 :(得分:0)

将y轴的值更改为int,

 int[] y = new int[complaintSummery.Count];

答案 1 :(得分:0)

int[] y = new int[complaintSummery.Count];
for (int i = 0; i < complaintSummery.Count; i++)
{
    x[i] = complaintSummery[i].Date.Day.ToString();
    y[i] = Math.Round(complaintSummery[i].ComplaintCount);
}

现在它仅考虑舍入值。