Good day!
I use PivotGrid in conjunction with ChartView.
As one of the columns of data to implement a class for adding a field of type TimeSpan.
This code implements summary of TimeSpan:
/// <summary> /// Computes the sum of TimeSpan items during pivot grouping /// </summary> public class TimeSpanSum : AggregateFunction { protected override AggregateValue CreateAggregate(Type dataType) { return new TimeSpanAggregateValue(); } public override string DisplayName { get { return PivotGridLocalizationProvider.CurrentProvider.GetLocalizedString(PivotStringId.Sum); } } protected override void CloneCore(Cloneable source) { // } protected override Cloneable CreateInstanceCore() { return new TimeSpanSum(); } public override string ToString() { return "Sum"; } }This code adding aggregate description:
dataProvider.AggregateDescriptions.Add(new PropertyAggregateDescription{ PropertyName = ObjectHelper<PivotGridUnitStateDto>.GetPropertyName(x => x.Duration), CustomName = "Duration", AggregateFunction = new TimeSpanSum(), StringFormatSelector = new TimeSpanStringFormatSelector()});But ChartView generate exception on paint any data:
Unable to bring the object type "System.TimeSpan" type "System.IConvertible". (Mscorlib)------------------------------Program Location: в System.Convert.ToDouble(Object value) в Telerik.WinControls.UI.PivotGridChartDataProvider.UpdateChartCore() в Telerik.WinControls.UI.PivotGridChartDataProvider.UpdateChartData() в Telerik.WinControls.UI.PivotGridChartDataProvider.updateTimer_Tick(Object sender, EventArgs e)How can I fix this error?
