Telerik Forums
UI for WPF Forum
14 answers
522 views

I use dynamic numer of SplineSeries in my chart (so I use ChartSeriesProvider) and I want to display Chart Legend in the right upper corner of chart. But ChartSeriesProvider doesn't work with LegendSettings. An empty chart area is displayed. Please see 'EmptyChartArea.PNG' file attached. I did the following XAML markup:

<UserControl x:Class="DeviceReading.Views.AutomaticGainControlView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:prism="http://prismlibrary.com/"
             xmlns:local="clr-namespace:DeviceReading"
             xmlns:views="clr-namespace:DeviceReading.Views"
             prism:ViewModelLocator.AutoWireViewModel="True">
 
    <UserControl.Resources>
        <!--Series colors-->
        <telerik:ChartPalette x:Key="customPalette">
            <telerik:ChartPalette.SeriesEntries>
                <telerik:PaletteEntryCollection SeriesFamily="Line">
                    <telerik:PaletteEntry Fill="Blue" Stroke="Blue"/>
                    <telerik:PaletteEntry Fill="Crimson" Stroke="Crimson"/>
                    <telerik:PaletteEntry Fill="Green" Stroke="Green"/>
                    <telerik:PaletteEntry Fill="DarkOrange" Stroke="DarkOrange"/>
                    <telerik:PaletteEntry Fill="Purple" Stroke="Purple"/>
                    <telerik:PaletteEntry Fill="DarkTurquoise" Stroke="DarkTurquoise"/>
                    <telerik:PaletteEntry Fill="SaddleBrown" Stroke="SaddleBrown"/>
                    <telerik:PaletteEntry Fill="SlateBlue" Stroke="SlateBlue"/>
                </telerik:PaletteEntryCollection>
            </telerik:ChartPalette.SeriesEntries>
        </telerik:ChartPalette>
 
        <local:StringToLegendSettingsConverter x:Key="StringToLegendSettingsConverter"/>
    </UserControl.Resources>
 
<telerik:RadCartesianChart Visibility="{Binding IsAbsoluteSplineChartVisible}" Palette="{StaticResource customPalette}">
     <!--Turn scrollbars off-->
     <telerik:RadCartesianChart.Resources>
         <Style TargetType="telerik:PanZoomBar">
             <Setter Property="Visibility" Value="Collapsed"/>
         </Style>
     </telerik:RadCartesianChart.Resources>
     <!-- X-axis -->
     <telerik:RadCartesianChart.HorizontalAxis>
         <telerik:DateTimeContinuousAxis MajorStepUnit="Second" LabelInterval="5" LabelFormat="hh:mm:ss" FontFamily="Segoe UI" PlotMode="OnTicks" TickOrigin="{Binding AlignmentDate}"/>
     </telerik:RadCartesianChart.HorizontalAxis>
     <!-- Y-axis -->
     <telerik:RadCartesianChart.VerticalAxis>
          <telerik:LinearAxis FontFamily="Segoe UI" Title="Децибелы [Дб]" />
     </telerik:RadCartesianChart.VerticalAxis>
     <!--Coordinate grid-->
     <telerik:RadCartesianChart.Grid>
         <telerik:CartesianChartGrid MajorLinesVisibility="XY" MajorXLineDashArray="3,4" MajorYLineDashArray="3,4"/>
     </telerik:RadCartesianChart.Grid>
     <!--Series Provider used-->
     <telerik:RadCartesianChart.SeriesProvider>
         <telerik:ChartSeriesProvider Source="{Binding SeriesData}">
             <telerik:ChartSeriesProvider.SeriesDescriptors>
                 <telerik:CategoricalSeriesDescriptor CategoryPath="Category" ValuePath="Value" ItemsSourcePath="ChartPoints">
                     <telerik:CategoricalSeriesDescriptor.TypeConverter>
                          <local:SeriesTypeConverter/>
                     </telerik:CategoricalSeriesDescriptor.TypeConverter>
                     <!--USE StringToLegendSettingsConverter-->
                     <telerik:CategoricalSeriesDescriptor.Style>
                          <Style TargetType="telerik:SplineSeries">
                              <Setter Property="LegendSettings" Value="{Binding  SeriesName, Converter={StaticResource StringToLegendSettingsConverter}}"/>
                          </Style>
                     </telerik:CategoricalSeriesDescriptor.Style>
                 </telerik:CategoricalSeriesDescriptor>
             </telerik:ChartSeriesProvider.SeriesDescriptors>
         </telerik:ChartSeriesProvider>
     </telerik:RadCartesianChart.SeriesProvider>
     <!--Zooming and Panning-->
     <telerik:RadCartesianChart.Behaviors>
         <telerik:ChartPanAndZoomBehavior DragMode="Pan" ZoomMode="Both"  PanMode="Both"/>
     </telerik:RadCartesianChart.Behaviors>
</telerik:RadCartesianChart>
</UserControl>

Below is StringToLegendSettingsConverter class:

public class StringToLegendSettingsConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return new SeriesLegendSettings { Title = "" + value };
    }
 
    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

Below is SeriesModel class (with Rusian remarks).

public class SeriesModel
{
        #region Constructors
        /// <summary>
        /// Создаёт экземпляр SeriesModel по умолчанию.
        /// </summary>
        public SeriesModel() { }
        /// <summary>
        /// Создаёт экземпляр SeriesModel  по заданным параметрам
        /// </summary>
        /// <param name="chartPoints">Тип серии (вид графика).</param>
        /// <param name="seriesType">Коллекция точек, представляющая серию (кривую графика).</param>
        public SeriesModel(RadObservableCollection<ChartPoint> chartPoints, string seriesName, string seriesType = "Spline")
        {
            this.ChartPoints = chartPoints;
            this.SeriesName = seriesName;
            this.SeriesType = seriesType;
        }
        #endregion
 
        #region Properties
 
        /// <summary>
        /// Тип серии (вид графика). Т.е. состоит ли график кривой из отрезков, просто соединяющих точки (LineChart),
        /// либо места, в которых отрезки соединяются с точками, имеют закруглённую форму (SplineCahrt).
        /// </summary>
        public string SeriesType { get; set; }
 
        /// <summary>
        /// Имя серии. Например, "1-й луч", "2-й луч" и т.д.
        /// </summary>
        public string SeriesName { get; set; }
 
        /// <summary>
        /// Коллекция точек, представляющая серию (кривую графика).
        /// </summary>
        public RadObservableCollection<ChartPoint> ChartPoints { get; set; }
 
        #endregion
}

Below is using SeriesModel Instance in 'AutomaticGainControlViewModel' class (ViewModel of 'AutomaticGainControl' chart) constructor for asigning to SeriesName property (with Rusian remarks):

. . . . . . . . . . . . . . .
// Создать и начать заполнять коллекцию точек для графиков кривых абсолютных значений.
this.SeriesData = new RadObservableCollection<SeriesModel>();
// Добавить точку для графика кривой коэффициента усиления на первом луче в прямом направлении.
series = new SeriesModel();
series.SeriesType = "Spline";
series.SeriesName = "P1AB";
series.ChartPoints = new RadObservableCollection<ChartPoint>();
automaticGainControl = this.Data[0].Value;
series.ChartPoints.Add(new ChartPoint(new DateTime(this._currentDate.Ticks), automaticGainControl));
this.SeriesData.Add(series);
// Добавить точку для графика кривой коэффициента усиления на первом луче в обратном направлении.
series = new SeriesModel();
series.SeriesType = "Spline";
series.SeriesName = "P1BA";
series.ChartPoints = new RadObservableCollection<ChartPoint>();
automaticGainControl = this.Data[1].Value;
series.ChartPoints.Add(new ChartPoint(new DateTime(this._currentDate.Ticks), automaticGainControl));
this.SeriesData.Add(series);
// Добавить точку для графика кривой коэффициента усиления на втором луче в прямом направлении.
series = new SeriesModel();
series.SeriesType = "Spline";
series.SeriesName = "P2AB";
series.ChartPoints = new RadObservableCollection<ChartPoint>();
automaticGainControl = this.Data[2].Value;
series.ChartPoints.Add(new ChartPoint(new DateTime(this._currentDate.Ticks), automaticGainControl));
this.SeriesData.Add(series);
// Добавить точку для графика кривой коэффициента усиления на втором луче в обратном направлении.
series = new SeriesModel();
series.SeriesType = "Spline";
series.SeriesName = "P2BA";
series.ChartPoints = new RadObservableCollection<ChartPoint>();
automaticGainControl = (ushort)this.Data[3].Value;
series.ChartPoints.Add(new ChartPoint(new DateTime(this._currentDate.Ticks), automaticGainControl));
this.SeriesData.Add(series);
. . . . . . . . . . . . . .

And, just in case, I bring a 'SeriesTypeConverter' converter class source code here:

public class SeriesTypeConverter : IValueConverter
{
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            SeriesModel seriesItem = value as SeriesModel;
 
            if (seriesItem.SeriesType == "Spline")
            {
                return typeof(SplineSeries);
            }
            else
            {
                return typeof(LineSeries);
            }
        }
 
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
}

What have I done wrong in my program that I have the empty chart. How to correct the error. Thank you very much in advance.

Dmitry
Top achievements
Rank 1
 answered on 10 Feb 2017
4 answers
476 views

Hi,

I am trying to build a stacked bar chart in wof 4.0 using telerik version 2012.1.326.40.

I am able to do so by using telerik:RadCartesianChart.SeriesProvider in 4.5 but as the SeriesProvider is absent in the earlier version it is hard for me to construct the same.

I am trying to achieve a chart attached.

Please advise.

dec698
Top achievements
Rank 1
 answered on 10 Feb 2017
0 answers
96 views

Hi there,

We are dealing with Accesibility and looks like we can't modify the RadWatermakerTextBox.LocalizedControlType of the RadAutoCompleteBox. I am able to create a specific RadAutoCompleteBoxPeer but I didn't find the way to create a specific one for the RadWatermarkTextBox that contains the RadAutoCompleteBox. Any thoughts?

thanks!

jose

Jose
Top achievements
Rank 1
 asked on 09 Feb 2017
1 answer
160 views

I am using RadGridView with editing capability. I am editing one item and then perform scroll down operation. At this point of time, the edit cell text is getting overlapped with other cell text.

Please suggest me, how to avoid this.

Stefan
Telerik team
 answered on 09 Feb 2017
2 answers
61 views

Hi Team,

I have using R1 2017 telerik products and while using RadImageEditor, I need the feature of panning that you have used in your demos. And also found the documentation related to the same, please refer the below link.

http://docs.telerik.com/devtools/wpf/controls/radimageeditor/tools/panning

But IsPanningEnabled property is not working for me, could you please let me know to achieve this?

 

Regards,

Antony Raj

Antony
Top achievements
Rank 1
 answered on 09 Feb 2017
1 answer
185 views

Hi, I'm using a RadCartesianChart with a LinearAxis as y-axis. The range for the y-axis is automatic (I haven't set Minimum or Maximum on the axis).

Vertical zoom is enabled, so the user can zoom to the range he likes. The problem is that the range of the viewed y-values changes when range of the line series changes. I understand this is probably by design, since you want to keep the relative values VerticalZoomRangeStart and VerticalZoomRangeEnd.

To make the problem clear, I'll use an example:

Let's say the range of the data is [0,10]. The user then zooms the y-axis to display the values [8,9]. Then the range of the data changes to [0,20] and the range of the y-aixs is recalculated. The range the user sees now automatically changes from [8,9] og [16,18], since the zoom is still [0.8,0.9]. Is there a way to avoid this without manually setting the range of the y-axis?

From the documentation it says : "Maximum: Gets or sets the user-defined maximum of the axis. By default the axis calculates the maximum, depending on the maximum of the plotted data points."

Is there a way to get the calculated maximum? I would then be able to calculate new values for vertical zoom to keep the range of the y-values the same. I noticed that the calculated maximum is not necessarily the same as maximum of the dataset, since you make sure the calculated maximum is a nice round number.

 

Martin Ivanov
Telerik team
 answered on 09 Feb 2017
3 answers
114 views
I have a time zone map I've built that generates data 'bubbles' with a city name and local time from a datasource. Works great BUT the bubbles frequently overlap. I'd like to hittest each one as it is rendered and float it away from any underlying bubble.

What event is fired/should I be looking for as the informationLayer items are created? 
Martin Ivanov
Telerik team
 answered on 09 Feb 2017
7 answers
384 views

Hello Guys,

  I am having issues to do this. I have setup the following RadTreeView control:

 

<telerik:RadTreeView   AllowDrop="True"  
                                   telerik:AnimationManager.IsAnimationEnabled="False"
                                   Name="trvModule" ItemsIndent="15"
                                   IsLineEnabled="True"
                                   IsRootLinesEnabled="False" FontSize="11" 
                                   IsDropPreviewLineEnabled="True"
                                   IsDragDropEnabled="True" 
                                   IsLoadOnDemandEnabled="False" 
                                   DropExpandDelay="00:00:00" 
                                   BringIntoViewMode="HeaderAndItems"
                                   />

 

In the Code Behind I have the following:

 

        DragDropManager.AddDragInitializeHandler(trvModule, New DragInitializeEventHandler(AddressOf OnDragInitialize), True)
        DragDropManager.AddDragOverHandler(trvModule, AddressOf OnDragOver, True)
        DragDropManager.AddDragDropCompletedHandler(trvModule, New DragDropCompletedEventHandler(AddressOf OnDragDropCompleted), True)
        DragDropManager.AddDropHandler(trvModule, New DragEventHandler(AddressOf OnDropElement), True)

 

 I have seen this working in Windows Apps, but I am not being able to make it work in my WPF application.

I saw this might be to a security problem? 

Can you please provide any help to solve the problem? 

I cannot attach the project for security restrictions, but I can paste any piece of code you need.

 

 Any help will be much appreciated.

Thanks!

Martin Ivanov
Telerik team
 answered on 08 Feb 2017
3 answers
1.0K+ views
Hey guys,
I've got a problem which is really frustrating. I am trying to display content based on its type in a RadGridView. Therefore I am using a DataTemplate referenced to a DataType. Sadly it seems like the DataType isnt beeing recognized at all. If I change the DataMemberBinding from "{Binding}" to a member of the object which is of type string - it is working but thats not what I need, i need it to be working with my own Data types(classes). 

Code:

XAML
<Window x:Class="RadControlsWpfApp1.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                xmlns:local="clr-namespace:RadControlsWpfApp1"
                xmlns:System="clr-namespace:System;assembly=mscorlib"
                Title="MainWindow" Height="350" Width="525">
        <Grid>
        <telerik:RadGridView x:Name="Grid" Grid.Column="1" Margin="11,10,9,50" Grid.Row="1" ItemsSource="{Binding}" >
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn IsReadOnly="True" Header="test" DataMemberBinding="{Binding}" >
                    <telerik:GridViewDataColumn.Resources>
                        <DataTemplate DataType="{x:Type local:Foo}">
                            <TextBlock Text="test" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.Resources>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
 
    </Grid>
</Window>

CS:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
 
namespace RadControlsWpfApp1
{
    public class Foo
    {       
        public string Name { get; set; }
        public string Value { get; set; }
    }
    public class Foo2
    {
        public string Name { get; set; }
        public string Value { get; set; }
    }
 
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    ///
    public partial class MainWindow : Window
    {
         
        public MainWindow()
        {
            var list = new List<object> { new Foo2() { Name = "Brian2", Value = "val2" }, new Foo() { Name = "Brian", Value = "val1" } };
 
 
            InitializeComponent();
            Grid.DataContext = list;
        }
    }
}
Yoan
Telerik team
 answered on 08 Feb 2017
3 answers
117 views

Hello Telerik team!

I would like to implement a control I attached.  So I need to know: is it possible to do it using RadGridView or RadPivotGrid ?Thank you in advance

Ivan Ivanov
Telerik team
 answered on 08 Feb 2017
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Slider
Expander
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?