Simple is Best

思考 记录 ......

 

MS Chart 的一个异常及处理

在asp.net使用chart组件,遇上一个错误:

Cannot display indexed series (XValueIndexed = true) on the same axis if they are not aligned.A chart element with the name 'A32' could not be found in the 'SeriesCollection'  。

 

这个异常是调用 Char.DataBindCrossTable(....) 引发的。

检查下来,发现在轴字段,数据中有空格 "A32 " , 将空格去掉即可。

 

这应该是chart组件的一个小BUG,在生成轴时候,未将数据trim,在填充的时候,将数据trim ,造成找不到元素的错误。

 

记录一下,希望对遇上相同问题的程序员一点帮助。

posted on 2010-10-12 15:18  Simple is best  阅读(611)  评论(0编辑  收藏  举报

导航