WPF c1chart的ChartPanel设定为日期问题
本帖最后由 szpzr 于 2024-4-8 10:54 编辑求助:
DateTime[] x = new DateTime.Rows.Count];
x =Convert.ToDateTime( Ds.Tables.Rows["OccurDate"]);
var bind1 = new Binding();
bind1.Source = obj;
//DateTime dt = x.FromOADate();
bind1.Converter = new DateTimeConverter();
bind1.StringFormat = "x ={ 0:yyyy/MM/dd HH:MM:SS}";
bind1.Path = new PropertyPath("DataPoint.X ");
运行时出现:
从你截图的内容来看,错误是来自于日期转换时 的报错。和c1chart没有什么关系
你应该检查使用的转换器是否合适
谢谢版主:
下列转换器有问题吗?
public class DateTimeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
DateTime result = DateTime.FromOADate((double)value);
return result;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{ return null; }
} 从你的截图看,是这个value没法转换
页:
[1]