This is a migrated thread and some comments may be shown as answers.

Setting X Axis to DateTime in Candlestick chart causes exception

2 Answers 113 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Pete Davis
Top achievements
Rank 1
Pete Davis asked on 31 Mar 2011, 09:43 PM
I have a simple candlestick chart:

<telerik:RadChart Name="radChart1" ItemsSource="{Binding ChartData}" Visibility="{Binding CandlestickVisibility}">
    <telerik:ChartDefaultView>
        <telerik:ChartDefaultView.ChartLegend>
            <telerik:ChartLegend IsEnabled="True" Visibility="Collapsed" />
        </telerik:ChartDefaultView.ChartLegend>
    </telerik:ChartDefaultView>
    <telerik:RadChart.SeriesMappings>
            <telerik:SeriesMapping>
            <telerik:SeriesMapping.SeriesDefinition>
                <telerik:CandleStickSeriesDefinition />
            </telerik:SeriesMapping.SeriesDefinition>
            <telerik:SeriesMapping.ItemMappings>
                <telerik:ItemMapping DataPointMember="Open"
                                    FieldName="OpenPrice" />
                <telerik:ItemMapping DataPointMember="High"
                                    FieldName="HighPrice" />
                <telerik:ItemMapping DataPointMember="Low"
                                    FieldName="LowPrice" />
                <telerik:ItemMapping DataPointMember="Close"
                                    FieldName="ClosePrice" />
            </telerik:SeriesMapping.ItemMappings>
        </telerik:SeriesMapping>
    </telerik:RadChart.SeriesMappings>
</telerik:RadChart>

When I go into the designer and click the IsDateTime for the X Axis, I get a Microsoft .NET Framework exception: "Specified cast is not valid" with this callstack System.Windows.Markup.XamlParseException: Specified cast is not valid. ---> System.InvalidCastException: Specified cast is not valid.
   at MS.Internal.Designer.PropertyEditing.Resources.ResourceUtilities.GetDouble(FrameworkElement element, String key, Double fallbackValue)
   at MS.Internal.Designer.PropertyEditing.Resources.ResourceUtilities.GetDesiredTypeIconSize(FrameworkElement queryRoot)
   at MS.Internal.Designer.PropertyEditing.Editors.SubPropertyEditor.RefreshQuickTypes()
   at MS.Internal.Designer.PropertyEditing.Editors.SubPropertyEditor.RefreshVisuals()
   at MS.Internal.Designer.PropertyEditing.Editors.SubPropertyEditor.OnPropertyEntryChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at MS.Internal.Designer.PropertyEditing.Editors.SubPropertyEditor.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.StyleHelper.ApplyTemplatedParentValue(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, DependencyProperty dp, FrameworkElementFactory templateRoot)
   at System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot)
   at System.Windows.FrameworkTemplate.InvalidatePropertiesOnTemplate(DependencyObject container, Object currentObject)
   at System.Windows.FrameworkTemplate.HandleBeforeProperties(Object createdObject, DependencyObject& rootObject, DependencyObject container, FrameworkElement feContainer, INameScope nameScope)
   at System.Windows.FrameworkTemplate.<>c__DisplayClass6.<LoadOptimizedTemplateContent>b__3(Object sender, XamlObjectEventArgs args)
   at System.Xaml.XamlObjectWriter.OnBeforeProperties(Object value)
   at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(ObjectWriterContext ctx)
   at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
   at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
   --- End of inner exception stack trace ---
   at System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter)
   at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)
   at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
   at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
   at System.Windows.FrameworkElement.ApplyTemplate()
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.UIElement.UpdateLayout()
   at System.Windows.Interop.HwndSource.SetLayoutSize()
   at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
   at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
   at System.Windows.Forms.Integration.ElementHost.OnHandleCreated(EventArgs e)
   at System.Windows.Forms.Control.WmCreate(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Integration.ElementHost.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
How do I make the X Axis a datetime without blowing out the designer?

2 Answers, 1 is accepted

Sort by
0
Pete Davis
Top achievements
Rank 1
answered on 01 Apr 2011, 05:08 PM
After playing with this some more, it appears that making any changes to X-Axis properties in the designer cause the cast exception. Guess I'll have to hand-code it.
0
Accepted
Nikolay
Telerik team
answered on 06 Apr 2011, 08:42 AM
Hello Pete Davis,

We have been able to reproduce the problematic behavior and this issue has been logged for our developers to investigate further and provide a fix for one of the upcoming versions of the control.

Please, excuse us for the inconvenience caused.

Kind regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Pete Davis
Top achievements
Rank 1
Answers by
Pete Davis
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or