Telerik Forums
UI for WPF Forum
5 answers
443 views
Hi,

I'm trying to make a line chart with multiple series with the Y-Axis being an integer value and the X-Axis being a date value. However, I need to display something custom for the X-Axis item labels - not the date. So far I have been able to do everything except to get the X-Axis item labels to show the custom label values. Any help would be appreciated.

Thanks.
Rosko
Telerik team
 answered on 03 Aug 2012
2 answers
693 views
Hello!!

So, I blew up your ChartView by having fun with animating heights.  In my live application, I have two ChartViews on different rows of a Grid and the row heights are animated to show/collapse a chart.  If the window size is small enough, I will get a  "'-1' is not a valid value for property 'Height'." exception with this stack trace:
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.FrameworkElement.set_Height(Double value)
at Telerik.Windows.Controls.ChartView.PresenterBase.ArrangeUIElement(FrameworkElement presenter, RadRect layoutSlot, Boolean setSize) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Common\PresenterBase.cs:line 297
at Telerik.Windows.Controls.ChartView.CartesianChartGrid.UpdateYStripes() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\CartesianChart\CartesianChartGrid.cs:line 479
at Telerik.Windows.Controls.ChartView.CartesianChartGrid.UpdateVisuals(ChartLayoutContext context) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\CartesianChart\CartesianChartGrid.cs:line 421
at Telerik.Windows.Controls.ChartView.CartesianChartGrid.UpdateUICore(ChartLayoutContext context) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\CartesianChart\CartesianChartGrid.cs:line 296

I have been able to reproduce this issue in its own project by forcefully setting the chart Height property to a small value and then adding a series (line/bar doesn't matter).  This is done in a Command executed by pressing a button.  Here is the relevant reproduction code:

View:
<Window x:Class="TinyChart.MainWindow"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
    <telerik:RadCartesianChart x:Name="chart" telerik:StyleManager.Theme="Metro">
        <telerik:RadCartesianChart.TrackBallInfoStyle>
            <Style TargetType="telerik:TrackBallInfoControl">
                <Setter Property="HeaderTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" Foreground="Black" HorizontalAlignment="Center"/>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </telerik:RadCartesianChart.TrackBallInfoStyle>
        <telerik:RadCartesianChart.Behaviors>
            <telerik:ChartTrackBallBehavior ShowIntersectionPoints="True" ShowTrackInfo="True" SnapMode="AllClosePoints" />
        </telerik:RadCartesianChart.Behaviors>
        <telerik:RadCartesianChart.HorizontalAxis>
            <telerik:DateTimeCategoricalAxis LabelFormat="dd MMM yyyy" Title="Date Processed" DateTimeComponent="DayOfYear" LabelFitMode="Rotate" LabelInterval="3" LastLabelVisibility="Visible">
                <telerik:DateTimeCategoricalAxis.LabelTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding}" HorizontalAlignment="Center" />
                        </StackPanel>
                    </DataTemplate>
                </telerik:DateTimeCategoricalAxis.LabelTemplate>
            </telerik:DateTimeCategoricalAxis>
        </telerik:RadCartesianChart.HorizontalAxis>
        <telerik:RadCartesianChart.VerticalAxis>
            <telerik:LinearAxis Title="# Documents Processed" />
        </telerik:RadCartesianChart.VerticalAxis>
        <telerik:RadCartesianChart.Grid>
            <telerik:CartesianChartGrid MajorLinesVisibility="Y" StripLinesVisibility="Y" />
        </telerik:RadCartesianChart.Grid>
        </telerik:RadCartesianChart>
        <Button Command="{Binding MyCommand}" Width="64" Height="64" VerticalAlignment="Top" HorizontalAlignment="Right" Content="..." />
    </Grid>
</Window>

View Model:

public class MainWindowViewModel
    {
        public ObservableCollection<Item> Items { get; set; }
        public ICommand MyCommand { get; set; }
        public MainWindow View { get; set; }
 
        public MainWindowViewModel()
        {
            MyCommand = new RelayCommand(OnMyCommand);
 
            Items = new ObservableCollection<Item>();
 
            Items.Add(new Item { Date = DateTime.Now, Number = 1 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(1), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(2), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(3), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(4), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(5), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(6), Number = 0 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(1), Number = 1 });
            Items.Add(new Item { Date = DateTime.Now.AddDays(7), Number = 0 });
        }
 
        private void OnMyCommand()
        {
            View.chart.Height = 100;
            View.chart.Series.Add(new BarSeries
                        {
                            //StrokeThickness = 4,
                            //Stroke = Brushes.Red,
                            ItemsSource = Items,
                            CategoryBinding = new PropertyNameDataPointBinding("Date"),
                            ValueBinding = new PropertyNameDataPointBinding("Number"),
                            ShowLabels = false
                        });
        }
    }
 
    public class Item
    {
        public DateTime Date { get; set; }
        public int Number { get; set; }
 
        public override string ToString()
        {
            return Date.ToString() + " - " + Number.ToString();
        }
    }

I require this situation to work.  Although it may seem silly to set height before adding a series, this should not cause a crash.  If a workaround can't be found, I will require a hotfix.  This occurs with the latest version Q2 2012 SP1 (also Q1 2012).

The series is added after user invokes a command, so I know what data to display.  There can be multiple series in a chart also, hence the programmatic approach.

I am at a loss to figure out how to solve this problem as I can find nothing wrong with my code and it works fine when the screen size is sufficiently large enough.

Thank you very much!
Petar Kirov
Telerik team
 answered on 03 Aug 2012
1 answer
134 views
I'm trying to create a simple horizontal bar chart that contains 3 data items and corresponding values. I've been working through the Help files on the website to get started with a RadCartesianChart.
I have the dlls,  Telerik.Windows.Controls, Telerik.Windows.Controls.Chart, and Telerik.Windows.Data included as referenced libraries within the WPF project. Any ideas what I am doing wrong?

I have the following references setup in XAML:
xmlns:chart="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Chart"
xmlns:charting="clr-namespace:Telerik.Charting;assembly=Telerik.Windows.Controls.Chart"
xmlns:chartView="clr-namespace:Telerik.Windows.Controls.ChartView;assembly=Telerik.Windows.Controls.Chart"

I have the chart declared as shown below. The LinearAxis and CategoricalAxis are displaying messages that state; The type 'chart:LinearAxis' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
<ContentControl Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="300"
                 x:Name="chartPlaceHolder">
    <chart:RadCartesianChart x:Name="speedometerChart">
        <chart:RadCartesianChart.HorizontalAxis>
            <chart:LinearAxis/>
        </chart:RadCartesianChart.HorizontalAxis>
        <chart:RadCartesianChart.VerticalAxis>
            <chart:CategoricalAxis/>
        </chart:RadCartesianChart.VerticalAxis>
    </chart:RadCartesianChart>
</ContentControl>
Rosko
Telerik team
 answered on 03 Aug 2012
2 answers
173 views
Hi there,

I've got the WPF telerik controls which is great, but I'm new to WPF so many of the controls and usages are still a bit of a mystery.
If I wanted a static main form and when different buttons (almost like a menu, but each button represents a section of the application) are clicked then I want to load another form into the main form, kind of like old MDI forms.

What's the right tool for the job here. I almost thought the Tileview might do the job, but then it seems more like the tile view is more there to dislpay small chunks of data to the user and have them be able to move it around.

Thanks,
Jacques
Jacques
Top achievements
Rank 2
 answered on 03 Aug 2012
3 answers
143 views
Hi,

I've been using the RowReordering tutorials to implement my drag & drop functionality and I'm trying to prevent certain grids from dropping their draggedItems into a grid. I'm thinking all I need is the target and source grid references, performing a simple comparison or test and show the "disabled" drag effect. I can get the target grid object but not the source grid object from inside the OnDragOver or OnDrop event handlers.

How can I do this? 

Thanks
Dimitrina
Telerik team
 answered on 03 Aug 2012
3 answers
114 views
Hi,

I'm trying to add an appointment to my ScheduleView using:

var appointments = new ObservableCollection<Appointment>();
Appointment myAppointment = 
new Appointment();
myAppointment.Subject = "Appointment Here";
myAppointment.Start = new DateTime(2012, 7, 31, 00, 00, 00);
myAppointment.End = new DateTime(2012, 7, 31, 2, 00, 00);
appointments.Add(myAppointment);
 
scheduleView.AppointmentsSource = appointments;

The above code works, but when I change the End date of myAppointment to  myAppointment.End = new DateTime(2012, 7, 31, 24, 00, 00); I'm getting a XamlParseException.

How should I be adding a 24hour appointment? Should it be just myAppointment.End = new DateTime(2012, 7, 31, 23, 59, 00);?


Thanks,
Mark
Mark
Top achievements
Rank 1
 answered on 03 Aug 2012
2 answers
168 views
I am using RadDataFilter in the following manner:
Just to build a list of conditions that users can query the database.

Our data is huge and thus we cannot bring all data and let the RadDataFilter control filter it. Rather, we are just using this control to get the list of conditions from the user, and then we query database to get the result set.

So, for example, if an element (column in the database) is of type "string (varchar)", I do not want to see all the options in the operator dropdown. Depending on what element is being filtered, I would want to display only certain operators.

Also, it would be nice to name the operators the way we want to. For example, I want to change the "is equal to" operator to something like "equals", and so on..
Shankar
Top achievements
Rank 1
 answered on 02 Aug 2012
2 answers
160 views
I am trying to store the "state" of the RadDataFilter in a database, so that the object can be persisted and the users can add/remove more filter expressions to it.

How is it possible? I tried to serialize the "FilterDescriptors" object, but is it the right way to do it? Is there a better solution than this?

Please let me know.
Shankar
Top achievements
Rank 1
 answered on 02 Aug 2012
2 answers
70 views
Hi all,

Is it possible to inset a row in the RadGridView which behaves the same way as the clicking on the insert row. 

I also have a context menu with an "Add Row" feature. For consistency I would like it to behave in the same way.

Thanks in advance

Arthur
Dimitrina
Telerik team
 answered on 02 Aug 2012
3 answers
126 views
Hello,

i have a GridView which has a Gridview as HierarchyChildTemplate. How can I get a reference to the SelectedItems of the child GridView?

Thanks

Dimitrina
Telerik team
 answered on 02 Aug 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?