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

VerticalLinearScale - change properties takes more than 20 seconds

2 Answers 61 Views
Gauges
This is a migrated thread and some comments may be shown as answers.
שושי
Top achievements
Rank 1
שושי asked on 06 Nov 2018, 09:42 AM

I have VerticalLinearScale with properties:

Min= 0

Max = 100

MajorTickStep = 20

MiddleTicks = 4

by click on button I changed the values of the properties to:

Min= 0
Max = 30000
MajorTickStep = 5000
MiddleTicks = 10

the problem is that it takes too much time till the element render again with the new values

I couldn't attach the sample

Xaml is:

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <telerik:VerticalLinearScale Min="0" Max="100" x:Name="bar"
                                         IsInteractive="False"
                                         RelativeHeight="0.8"
                                         RangeLocation="Outside"
                                         MajorTickOffset="0.02*"
                                         MiddleTickOffset="0.02*"
                                         MinorTickOffset="0.02*" 
                                         RelativeX="0.5" RelativeY="0.08"
                                         Foreground="Gray" Fill="Red"
                                         MajorTickStroke="Red" MiddleTickStroke="Red"
                                         MiddleTicks="4" MinorTicks="1" MajorTickStep="20">      
            <telerik:VerticalLinearScale.Indicators>
                <telerik:BarIndicator x:Name="VerticalIndicator" Value="{Binding Model.Parameters[0].ValueToDisplay}" BorderBrush="Transparent" Background="{Binding Model.FillColor}"
                                  RangeColorMode="Default" telerik:ScaleObject.Location="OverOutside" StartWidth="{Binding Model.BarWidth}" EndWidth="{Binding Model.BarWidth}"
                                  UseRangeColor="True" Margin="3,0,0,0" EmptyFill="{Binding Model.GaugeColor}" />
            </telerik:VerticalLinearScale.Indicators>        
        </telerik:VerticalLinearScale>
            <Button Content="click" Click="Button_Click" Grid.Row="1"/>
    </Grid>

click event is:

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bar.Min = 0;
            bar.Max = 30000;
            bar.MajorTickStep = 5000;
            bar.MiddleTicks = 10;
        }

Thanks,

Shoshana

 

 

2 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 08 Nov 2018, 01:10 PM
Hello Shoshana,

The reason for this delay is that once you set the Max property to 30000, the MajorTickStep is still 20. This will create 1500 ticks with 6000 middle ticks which requires a lot of rendering time. Once you change the MajorTickStep another recalculation of the ticks takes place so that the desired result is achieved.

To overcome this, you have to first set the MajorTickStep to the larger value and then set the Max property.

private void Button_Click(object sender, RoutedEventArgs e)
{
    bar.MajorTickStep = 5000;
    bar.MiddleTicks = 10;
    bar.Min = 0;
    bar.Max = 30000;
}

Please let me know whether this solves your issue.

Regards,
Dilyan Traykov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
שושי
Top achievements
Rank 1
answered on 11 Nov 2018, 06:22 AM

Thanks, It helped me!

Tags
Gauges
Asked by
שושי
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
שושי
Top achievements
Rank 1
Share this question
or