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

x axis declared in xaml not updating UI

1 Answer 94 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 17 Aug 2010, 06:59 PM
I created a simple RadChart with the following code that binds to a collection of data.  The x-axis binds to Date property of DateTIme and the y-axis binds to Quantity property of type Int.  When I try and set a property in ChartARea.AXisX, the UI is not updated.  For example, I try and set LabelRotationAngle = 45.  Nothing happens.  What I see in the x-axis since it is bound to DateTIme values, is LongDateTime format values which is making the x-axis all messy.  I set DefaultLabelFormat="dd-MMM" but the UI doesn't get updated again. 

Can anyone figure out why my chart is not getting updated in the UI.  I've looked at all the Chart Sample Demo's and my XAML looks pretty much the same.  Not sure what I'm doing wrong where the UI does not updated.

Thanks

<telerikChart:RadChart Grid.Row="1" Foreground="White" Background="Transparent" x:Name="RadChart1" ItemsSource="{Binding MetricSum}">
                <telerikChart:RadChart.DefaultView>
                    <Charting:ChartDefaultView>
                        <Charting:ChartDefaultView.ChartArea>
                            <Charting:ChartArea LegendName="chartLegend">
                                <Charting:ChartArea.AxisX>
                                    <Charting:AxisX AutoRange="True" Step="5" DefaultLabelFormat="dd-MMM" LabelRotationAngle="45" IsDateTime="True"
                                                    LayoutMode="Normal" LabelStep="5" TicksDistance="100" Title="XAxis Title">
                                    </Charting:AxisX>
                                </Charting:ChartArea.AxisX>
                            </Charting:ChartArea>
                        </Charting:ChartDefaultView.ChartArea>
                        <Charting:ChartDefaultView.ChartLegend>
                            <Charting:ChartLegend x:Name="chartLegend" Header="Legend" UseAutoGeneratedItems="True"  />
                        </Charting:ChartDefaultView.ChartLegend>
                        <Charting:ChartDefaultView.ChartTitle>
                            <Charting:ChartTitle Content="" HorizontalAlignment="Left" />
                        </Charting:ChartDefaultView.ChartTitle>
                    </Charting:ChartDefaultView>
                </telerikChart:RadChart.DefaultView>
                <telerikChart:RadChart.PaletteBrushes>
                    <SolidColorBrush Color="DarkBlue" />
                    <SolidColorBrush Color="Red" />
                </telerikChart:RadChart.PaletteBrushes>
                <telerikChart:RadChart.SeriesMappings>
                    <Charting:SeriesMapping CollectionIndex="0" LegendLabel="Expected">
                        <Charting:SeriesMapping.SeriesDefinition>
                            <Charting:LineSeriesDefinition ShowPointMarks="True" ShowItemLabels="False" ShowItemToolTips="True" ItemToolTipFormat="Quintiles Expected&#x0a;#X{MMM/yy}&#x0a;value: #Y">
                                <Charting:LineSeriesDefinition.Appearance>
                                    <Charting:SeriesAppearanceSettings StrokeThickness="5"></Charting:SeriesAppearanceSettings>
                                </Charting:LineSeriesDefinition.Appearance>
                            </Charting:LineSeriesDefinition>
                        </Charting:SeriesMapping.SeriesDefinition>
                        <Charting:SeriesMapping.ItemMappings>
                            <Charting:ItemMapping FieldName="Date" DataPointMember="XValue" />
                            <Charting:ItemMapping FieldName="Quantity" DataPointMember="YValue" />
                        </Charting:SeriesMapping.ItemMappings>
                    </Charting:SeriesMapping>
                    <Charting:SeriesMapping CollectionIndex="1" LegendLabel="Actual">
                        <Charting:SeriesMapping.SeriesDefinition>
                            <Charting:LineSeriesDefinition ShowPointMarks="True" ShowItemLabels="False" ShowItemToolTips="True" ItemToolTipFormat="Quintiles Actual&#x0a;#X{MMM/yy}&#x0a;value: #Y">
                                <Charting:LineSeriesDefinition.Appearance>
                                    <Charting:SeriesAppearanceSettings StrokeThickness="5"></Charting:SeriesAppearanceSettings>
                                </Charting:LineSeriesDefinition.Appearance>
                            </Charting:LineSeriesDefinition>
                        </Charting:SeriesMapping.SeriesDefinition>
                        <Charting:SeriesMapping.ItemMappings>
                            <Charting:ItemMapping FieldName="Date" DataPointMember="XValue" />
                            <Charting:ItemMapping FieldName="Quantity" DataPointMember="YValue" />
                        </Charting:SeriesMapping.ItemMappings>
                    </Charting:SeriesMapping>
                </telerikChart:RadChart.SeriesMappings>
            </telerikChart:RadChart>

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 20 Aug 2010, 09:17 AM
Hi Christopher,

This might happen when the chart is in the ItemTemplate of an ItemsControl. If this is the case -- you will need to update the axis values manually in code.

However, if that is not the case the chart works as expected on our side. Please, find attached a sample project, which updates X-Axis properties correctly. Could you, please, give it a try and see if you're still experiencing the same issue.If so, it would be very helpful for us if you could modify the attached application so that the updating problem is reproducible for our developers to investigate and provide further assistance.

Thanks in advance.

Sincerely yours,
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
Christopher
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or