c# - Stackedcolumn 图表有间隙并且 y 值不是从 0 开始
问题描述
但是当我在stackedcolumn上输出它时,我得到了这个结果,它有间隙,它没有从0开始
这是我的代码:
string query = "SELECT * FROM TBL_SAMPLE INNER JOIN TBL_AREA ON TBL_SAMPLE.AREA = TBL_AREA.AREA";
DataTable dt = GetData(query);
//Get the DISTINCT Foods.
List<string> countries = (from p in dt.AsEnumerable()
select p.Field<string>("FOOD")).Distinct().ToList();
//Loop through the Foods.
foreach (string food in countries)
{
//Add Series to the Chart.
Chart1.Series.Add(new Series(food));
Chart1.Series[food].IsValueShownAsLabel = true;
//Get the Area for each Food.
int[] x = (from p in dt.AsEnumerable()
where p.Field<string>("FOOD") == food
select p.Field<int>("AREA_ID")).ToArray();
//Get the Total each food.
int[] y = (from p in dt.AsEnumerable()
where p.Field<string>("FOOD") == food
select p.Field<int>("TOTAL")).ToArray();
Chart1.Series[food].ChartType = SeriesChartType.StackedColumn;
Chart1.Series[food].Points.DataBindXY(x, y);
}
Chart1.Legends[0].Enabled = true;
解决方案
推荐阅读
- java - 从 URL 将图像加载到视图后如何将图像保存到磁盘
- functional-programming - ImmutableJS vs Ramda 或 ImmutableJS + Ramda - 它们可以一起使用吗
- oculusgo - Oculus Go:如何在应用程序中保持清醒
- jquery - 添加带有输入占位符的标签
- python - 导入同名函数会覆盖吗?
- javascript - React Navigation:组件未在弹出或后退按钮上卸载 #5775
- r - 如何在 rticles::jss 函数中包含引用
- java - 我在线性布局中的滚动视图正在向上推其他小部件
- rest - Rails - 如何使用第三方 api 授权用户
- delphi - Delphi 未声明的标识符