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

when period changed

1 Answer 82 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Xiaojun
Top achievements
Rank 1
Xiaojun asked on 24 Feb 2012, 04:35 AM
I use the time bar to show orders and invoices, but it happens some problems. All data bind from view model. Orders will be added a record which order date is period start if orders have not this. The same as period end. The SelectionStart and SelectionEnd are calculated in view model. Details show in the attached picture.

Best regards

     
PeriodEnd = OptionPeriodEnd;
PeriodStart = OptionPeriodStart;
Criteria.EndDate = PeriodEnd;
SelectionEnd = Criteria.EndDate.Value;
var startDate = new DateTime(PeriodEnd.Year, PeriodEnd.Month, 1).AddMonths(-3);
Criteria.StartDate = PeriodStart.CompareTo(startDate) < 0 ? startDate : PeriodStart;
SelectionStart = Criteria.StartDate.Value;
 

<telerik:RadTimeBar x:Name="timeBar"
                                IsSnapToIntervalEnabled="True"
                                MinZoomRange="7.00:00:00"
                                PeriodStart="{Binding PeriodStart, Mode=OneWay}"
                                PeriodEnd="{Binding PeriodEnd, Mode=OneWay}"
                                MinSelectionRange="7.00:00:00"
                                SelectionStart="{Binding SelectionStart, Mode=TwoWay}"
                                SelectionEnd="{Binding SelectionEnd, Mode=TwoWay}"
                                BorderThickness="0"
                                Margin="10,10,10,0"
                                Grid.Row="1"
                                Grid.ColumnSpan="2"
                                MinHeight="100"
                                MaxHeight="130"
                                Foreground="{StaticResource text}"
                                Style="{StaticResource RadTimeBarStyle}"
                                Opacity="1">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <i:InvokeCommandAction Command="{Binding ReloadAllCommand}" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
                <telerik:RadTimeBar.Intervals>
                    <telerik:YearInterval/>
                    <telerik:QuarterInterval/>
                    <telerik:MonthInterval/>
                    <telerik:WeekInterval/>
                </telerik:RadTimeBar.Intervals>
                <Grid>
                    <telerik:RadLinearSparkline x:Name="ActualTrend"
                                                FirstPointBrush="{StaticResource invoice}"
                                                Foreground="{StaticResource text}"
                                                LastPointBrush="{StaticResource invoice}"
                                                MarkersBrush="{x:Null}"
                                                NegativePointBrush="{StaticResource invoice}"
                                                AutoRange="False"
                                                XValuePath="OrderDate"
                                                YValuePath="InvoiceAmount"
                                                LineStroke="{StaticResource invoice}"
                                                ItemsSource="{Binding Orders, Mode=OneWay}"
                                                Visibility="Visible"/>
                    <telerik:RadLinearSparkline x:Name="TargetTrend"
                                                FirstPointBrush="{StaticResource order}"
                                                Foreground="{StaticResource text}"
                                                LastPointBrush="{StaticResource order}"
                                                MarkersBrush="{x:Null}"
                                                NegativePointBrush="{StaticResource order}"
                                                XValuePath="OrderDate"
                                                YValuePath="OrderAmount"
                                                LineStroke="{StaticResource order}"
                                                ItemsSource="{Binding Orders, Mode=OneWay}">
                    </telerik:RadLinearSparkline>
                </Grid>
            </telerik:RadTimeBar>

1 Answer, 1 is accepted

Sort by
0
Xiaojun
Top achievements
Rank 1
answered on 24 Feb 2012, 06:16 AM
I have found the problem. PeriodStart and PeriodEnd must be twoway and the value of PeriodStart must be set earlier than PeriodEnd. The same as SelectionStart and SelectionEnd.
Thank you.
Tags
TimeBar
Asked by
Xiaojun
Top achievements
Rank 1
Answers by
Xiaojun
Top achievements
Rank 1
Share this question
or