How to implement EmptyPointBehavior with wpf xaml c#

1 Answer 9 Views
Chart
Priti
Top achievements
Rank 1
Priti asked on 21 May 2024, 09:42 AM

WPF Chart - Empty Values - Telerik UI for WPF

I have added link for EmptyPointBehaviour for wpf but it's available for windows, I want to implement same for wpf or uwp xaml UI. 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 21 May 2024, 01:31 PM

Hello Priti,

The provided link is for the old WPF RadChart control. Instead, I recommend you to use RadChartView for WPF. In this case, you can see the following article that shows how to add empty points in the chart.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Priti
Top achievements
Rank 1
commented on 22 May 2024, 11:57 AM

Please see below code 

telerikChart:RadCartesianChart x:Name="lineSeries" PaletteName="DefaultLight" >
            <telerikChart:RadCartesianChart.VerticalAxis>
                <telerikChart:LinearAxis/>
            </telerikChart:RadCartesianChart.VerticalAxis>
            <telerikChart:RadCartesianChart.HorizontalAxis>
                <telerikChart:CategoricalAxis/>
            </telerikChart:RadCartesianChart.HorizontalAxis>
            <telerikChart:LineSeries  ItemsSource="{Binding}" x:Name="lseries">
                <telerikChart:LineSeries.CategoryBinding>
                <telerikChart:PropertyNameDataPointBinding PropertyName="Category"/>
                </telerikChart:LineSeries.CategoryBinding>
                <telerikChart:LineSeries.ValueBinding>
                    <telerikChart:PropertyNameDataPointBinding PropertyName="Value"/>
                </telerikChart:LineSeries.ValueBinding>
                <telerikChart:LineSeries.DefaultVisualStyle>
                    <Style TargetType="Path">
                        <Setter Property="Width" Value="10" />
                        <Setter Property="Height" Value="10" />
                        <Setter Property="Fill" Value="#FF5AC3" />
                    </Style>
                </telerikChart:LineSeries.DefaultVisualStyle>
            </telerikChart:LineSeries>
  </telerikChart:RadCartesianChart>



          List<Data> data = new List<Data>();
            data.Add(new Data() { Category = "Apples", Value = 5 });
            data.Add(new Data() { Category = "Oranges", Value = 9 });
            data.Add(new Data() { Category = "Peru", Value = float.NaN,  });
            data.Add(new Data() { Category = "Chiku", Value = float.NaN });
            data.Add(new Data() { Category = "Potato", Value = float.NaN });
            data.Add(new Data() { Category = "a", Value = float.NaN });
            data.Add(new Data() { Category = "b", Value = float.NaN });
            data.Add(new Data() { Category = "c", Value = float.NaN });
            data.Add(new Data() { Category = "d", Value = 4 });
            data.Add(new Data() { Category = "e", Value = float.NaN });
            data.Add(new Data() { Category = "f", Value = 3 });
            data.Add(new Data() { Category = "g", Value = float.NaN });
            data.Add(new Data() { Category = "h", Value = 8 });

            lseries.PointTemplate = this.Resources["PointTemplate"] as DataTemplate;

            this.lineSeries.DataContext = data;

It is Windows 8.1 App,

With this type of code and data I want to see the graph that we see after applying Drop option, is it possible to do so? 

 
Martin Ivanov
Telerik team
commented on 22 May 2024, 03:15 PM

RadChartView for WPF doesn't have a PaletteName property. Do you use another product? If so, can you tell me which one?
Tags
Chart
Asked by
Priti
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or