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

Tooltip Issue when applied Zooming

6 Answers 145 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Vinod Sardar
Top achievements
Rank 1
Vinod Sardar asked on 29 Mar 2010, 07:53 AM
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> 

6 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 29 Mar 2010, 09:21 AM
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.
0
Albert
Top achievements
Rank 1
answered on 04 Jun 2010, 06:28 AM
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

0
Rakhi
Top achievements
Rank 1
answered on 18 Oct 2010, 08:38 AM
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
0
Giuseppe
Telerik team
answered on 20 Oct 2010, 11:33 AM
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
0
Janaki
Top achievements
Rank 1
answered on 20 May 2013, 01:23 PM
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? 
0
Petar Marchev
Telerik team
answered on 23 May 2013, 06:24 AM
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.

Tags
Chart
Asked by
Vinod Sardar
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Albert
Top achievements
Rank 1
Rakhi
Top achievements
Rank 1
Janaki
Top achievements
Rank 1
Petar Marchev
Telerik team
Share this question
or