Tooltip Issue when applied Zooming

7 posts, 0 answers
  1. Vinod Sardar
    Vinod Sardar avatar
    33 posts
    Member since:
    Nov 2009

    Posted 29 Mar 2010 Link to this post

    hi,

    I was analysis zooming functionality.I found that Tooltip is not working.

    I am pasting the code files here. Please let me know how can I resolve this issue.
    Sample CS file: (I am only using the code from the Demo site)

     

    using System;  
    using System.Collections.Generic;  
    using System.Linq;  
    using System.Net;  
    using System.Windows;  
    using System.Windows.Controls;  
    using System.Windows.Documents;  
    using System.Windows.Input;  
    using System.Windows.Media;  
    using System.Windows.Media.Animation;  
    using System.Windows.Shapes;  
    using System.ComponentModel;  
    using Telerik.Windows.Controls.Charting;  
     
    namespace TelerikZoomTest  
    {  
        public partial class MainPage : UserControl  
        {  
            Random r = new Random();  
     
            public MainPage()  
            {  
                InitializeComponent();  
     
                this.ConfigureChart();  
                this.FillSampleChartData();  
     
                RadChart1.DefaultView.ChartArea.MouseMove += new MouseEventHandler(ChartArea_MouseMove);  
     
            }  
     
            void ChartArea_MouseMove(object sender, MouseEventArgs e)  
            {  
                  
                  
            }  
            private void FillSampleChartData()  
            {  
                List<TemperatureData> temperatureData = new List<TemperatureData>();  
                DateTime baseDate = new DateTime(2000, 1, 1);  
     
                for (int year = 0; year < 12; year++)  
                {  
                    for (int day = 0; day < 365; day++)  
                    {  
                        for (int hour = 0; hour < 24; hour++)  
                        {  
                            TemperatureData tempData = new TemperatureData();  
                            tempData.Temperature = TranslateTemperatureValue(CalculateBaseTemperatureValue(day));  
                            tempData.Date = baseDate.AddYears(year).AddDays(day).AddHours(hour);  
                            temperatureData.Add(tempData);  
                        }  
                    }  
                }  
     
                RadChart1.ItemsSource = temperatureData;  
            }  
     
            private void ConfigureChart()  
            {  
                RadChart1.DefaultView.ChartArea.EnableAnimations = false;  
                RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.RangeStart = 0.0;  
                RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.RangeEnd = 1.0;  
                RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.MinZoomRange = 0.001;  
                RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollAndZoom;  
                RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.PropertyChanged += ZoomScrollSettingsX_PropertyChanged;  
                  
     
                RadChart1.DefaultView.ChartTitle.Content = "Temperature measurements for Sofia over 12 years";  
     
                //RadChart1.DefaultView.ChartArea.AxisX.Title = "Time Period";  
                RadChart1.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible;  
                RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "MMMM yyyy";  
                RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelCount = 2;  
                RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelHeight = 15;  
     
                RadChart1.DefaultView.ChartArea.AxisY.AutoRange = false;  
                RadChart1.DefaultView.ChartArea.AxisY.AddRange(-15, 35, 5);  
                RadChart1.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible;  
                RadChart1.DefaultView.ChartArea.AxisY.MinorGridLinesVisibility = Visibility.Visible;  
                RadChart1.DefaultView.ChartArea.AxisY.Title = "Temperature in Celsius";  
     
                AxisY fahrenheitAxis = new AxisY();  
                fahrenheitAxis.AutoRange = false;  
                fahrenheitAxis.AddRange(5, 95, 9);  
                fahrenheitAxis.Title = "Temperature in Fahrenheit";  
                RadChart1.DefaultView.ChartArea.AdditionalYAxes.Add(fahrenheitAxis);  
     
                SeriesMapping temperatureMapping = new SeriesMapping();              
                LineSeriesDefinition lineDefinition = new LineSeriesDefinition();  
     
     
                lineDefinition.ShowItemLabels = true;  
                lineDefinition.ShowItemToolTips = true;  
                lineDefinition.ShowPointMarks = true;  
                temperatureMapping.SeriesDefinition = lineDefinition;  
                temperatureMapping.ItemMappings.Add(new ItemMapping("Date", DataPointMember.XValue));  
                temperatureMapping.ItemMappings.Add(new ItemMapping("Date", DataPointMember.Tooltip));  
                ItemMapping yItemMapping = new ItemMapping("Temperature", DataPointMember.YValue);  
                yItemMapping.SamplingFunction = ChartSamplingFunction.Average;  
                temperatureMapping.ItemMappings.Add(yItemMapping);  
                temperatureMapping.LegendLabel = "Temperature";  
                RadChart1.SeriesMappings.Add(temperatureMapping);  
            }  
     
            private void ZoomScrollSettingsX_PropertyChanged(object sender, PropertyChangedEventArgs e)  
            {  
                double range = (sender as ZoomScrollSettings).Range;  
     
                if (range > 0.7d)  
                {  
                    RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "yyyy";  
                    RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelCount = 1;                  
                }  
                else if (range > 1d / 12d)  
                {  
                    RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "MMMM yyyy";  
                    RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelCount = 2;  
                }  
                else if (range > 1d / 12d / 30d)  
                {  
                    RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd MMM yyyy";  
                    RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelCount = 2;  
                }  
                else 
                {  
                    RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd-MMM (HH:mm)";  
                    RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelCount = 2;  
                }  
            }  
     
            private static double CalculateBaseTemperatureValue(int day)  
            {  
                return Math.Sin(day / 365d * 2 * Math.PI - Math.PI / 2);  
            }  
     
            private double TranslateTemperatureValue(double baseTemperatureValue)  
            {  
                return (baseTemperatureValue + 1) * 20 - 10 + r.Next(-5, 5);  
            }  
     
            public class TemperatureData  
            {  
                private DateTime _date;  
                private double _temperature;  
     
                public DateTime Date  
                {  
                    get 
                    {  
                        return this._date;  
                    }  
                    set 
                    {  
                        this._date = value;  
                    }  
                }  
     
                public double Temperature  
                {  
                    get 
                    {  
                        return this._temperature;  
                    }  
                    set 
                    {  
                        this._temperature = value;  
                    }  
                }  
            }  
     
            private void OneYear_Click(object sender, RoutedEventArgs e)  
            {  
                this.SetRange(1d / 12d);  
            }  
     
            private void SixMonths_Click(object sender, RoutedEventArgs e)  
            {  
                this.SetRange(1d / 24d);  
            }  
     
            private void OneMonth_Click(object sender, RoutedEventArgs e)  
            {  
                this.SetRange(1d / 144d);  
            }  
     
            private void OneWeek_Click(object sender, RoutedEventArgs e)  
            {  
                this.SetRange(1d / 625d);  
            }  
     
            private void SetRange(double newRange)  
            {  
                if (RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.RangeEnd + newRange > 1)  
                    RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.SetSelectionRange(1 - newRange, 1);  
                else 
                    RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.RangeEnd = RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.RangeStart + newRange;  
            }  
     
            private void RadChart1_MouseMove(object sender, MouseEventArgs e)  
            {  
     
            }  
     
        }  
    }  
     

    XAML file:
    <UserControl x:Class="TelerikZoomTest.MainPage" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"   
        mc:Ignorable="d" 
                 xmlns:telerikChart="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting" 
            xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
                 > 
        <Grid> 
            <Grid.RowDefinitions> 
                <RowDefinition Height="*" /> 
                <RowDefinition Height="Auto" /> 
            </Grid.RowDefinitions> 
            <telerikChart:RadChart x:Name="RadChart1" 
                                   MouseMove="RadChart1_MouseMove" 
                                   /> 
            <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,0,0">  
                <TextBlock Foreground="White" VerticalAlignment="Center" Text="Time Period: " /> 
                <Button Click="OneYear_Click" Content="1 Year" /> 
                <Button Click="SixMonths_Click" Content="6 Months" /> 
                <Button Click="OneMonth_Click" Content="1 Month"  /> 
                <Button Click="OneWeek_Click" Content="1 Week" /> 
            </StackPanel> 
        </Grid> 
    </UserControl> 

  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 29 Mar 2010 Link to this post

    Hello Vinod,

    Indeed your observations are correct -- the official version of the control released with the Q1 2010 release did not support interactivity features (tooltips, click events) in zooming / scrolling scenarios.

    Note, however, that our developers were able to address this limitation shortly after the release, so you can now download the latest weekly internal build from your Client.Net account and you will be able to use tooltips in zooming / scrolling scenarios as well.


    Best wishes,
    Freddie
    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.
  3. DevCraft banner
  4. Albert
    Albert avatar
    36 posts
    Member since:
    May 2010

    Posted 04 Jun 2010 Link to this post

    Hey...

    When i run  above code....i got this error...

    So can you please send me zip file for above application . 

    Error :--
    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)
    Timestamp: Fri, 4 Jun 2010 04:53:59 UTC


    Message: Sys.InvalidOperationException: ManagedRuntimeError error #4004 in control 'Xaml1': System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows.Data, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
    File name: 'System.Windows.Data, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
       at Telerik.Windows.Controls.Charting.DataBindingHelper.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ISeriesDefinition defaultSeriesDefinition, ChartFilterDescriptorCollection globalFilterDescriptors, ChartSortDescriptorCollection globalSortDescriptors, SamplingSettings samplingSettings, ZoomScrollSettings zoomScrollSettings, AxisRangeState axisXRangeState)
       at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData, SeriesMappingCollection seriesMappings, ChartArea chartArea)
       at Telerik.Windows.Controls.RadChart.GenerateDataSeries(Object originalData)
       at Telerik.Windows.Controls.RadChart.Rebind(Object originalData)
       at Telerik.Windows.Controls.RadChart.Rebind()
       at Telerik.Windows.Controls.RadChart.InternalRebind()
       at Telerik.Windows.Controls.RadChart.OnApplyTemplate()
       at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)
    Line: 453
    Char: 17
    Code: 0
    URI: http://localhost:33612/ScriptResource.axd?d=4J1PmjzOAhWgesFdax2Ru9O6rJSWtXynV-jJm6X-afvCWTImTLdaXLlScPTs3ZUCnxzSg6Al5_-cnc-wBvKYig2&t=26f981c1

  5. Rakhi
    Rakhi avatar
    10 posts
    Member since:
    Aug 2010

    Posted 18 Oct 2010 Link to this post

    Hi,
    i have two series definition as Branches on X-Axis and added two series for Branch's Sale Amount and Branch's Profit.
    Now i want to filter X-axis with branch name not by start range and endrange, plz help what should i do ?

    Thanks in advance
  6. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 20 Oct 2010 Link to this post

    Hi Rakhi,

    We are a bit unsure what exactly you are looking for but you can find the RadChart filtering example here and the help topic here.

    If the problem persists, we would ask you to paste the control declaration and the data model you are using so we can advise you properly how to proceed.


    All the best,
    Freddie
    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
  7. Janaki
    Janaki avatar
    5 posts
    Member since:
    Dec 2011

    Posted 20 May 2013 Link to this post

    Hi All,

            i am using Telerik Q3 2010 version in my silverlight project. I have a radchart which supports zooming and scrolling function.Is it possible to implement tootlip along with the zooming function.If not this version, then which version supports this both functionality? 
  8. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 23 May 2013 Link to this post

    Hello Janaki,

    I suggest you download the latest version of our controls. We have a new control - ChartView. It is actually a set of controls, such as RadCartesianChart. The RadCartesianChart supports both zooming, scrolling and tooltips - and yes, these features all work at the same time.
    References:
    Online demos
    Online help

    Regards,
    Petar Marchev
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner