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

[Solved] RadCartesianChart and ChartSelectionBehavior bug?

5 Answers 214 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vladimir
Top achievements
Rank 1
Vladimir asked on 15 Jan 2013, 05:29 PM
Hi there,

I have one page with two charts on it.
Frankly speaking I have also one Grid...

Those two charts are taking 50%/50% width.

They both have a ChartSelectionBehavior that also has a SelectionChanged event handlers.
So, In the demo project I attached I cannot recieve the SelectionChanged events for BAR Chart.
Event handler is not called.

But if I change from Grid.Column="1" to Grid.Column="0" for RadCartesianChart object and from Grid.Column="0" to Grid.Column="1" for RadPieChart respectively.
It works! I am able to recieve all events. Is there something I have missed?

Page xaml:
<Page
    x:Class="App1.MainPage"
    xmlns:local="using:App1"
    xmlns:telerik="using:Telerik.UI.Xaml.Controls.Chart" xmlns:charting="using:Telerik.Charting"
    mc:Ignorable="d">
 
    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="353*"/>
                <ColumnDefinition Width="330*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="8*"/>
                <RowDefinition Height="79*"/>
            </Grid.RowDefinitions>
            <telerik:RadCartesianChart HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" PaletteName="DefaultDark" Grid.Row="1" Margin="10">
                <telerik:RadCartesianChart.Behaviors>
                    <telerik:ChartSelectionBehavior SelectionChanged="ChartSelectionBehavior_OnSelectionChanged_BAR"/>
                </telerik:RadCartesianChart.Behaviors>
                <telerik:RadCartesianChart.HorizontalAxis>
                    <telerik:CategoricalAxis/>
                </telerik:RadCartesianChart.HorizontalAxis>
                <telerik:RadCartesianChart.VerticalAxis>
                    <telerik:LinearAxis/>
                </telerik:RadCartesianChart.VerticalAxis>
                <telerik:RadCartesianChart.Grid>
                    <telerik:CartesianChartGrid MajorLinesVisibility="Y" StripLinesVisibility="Y"/>
                </telerik:RadCartesianChart.Grid>
                <telerik:BarSeries ItemsSource="{Binding Items}">
                    <telerik:BarSeries.ValueBinding>
                        <telerik:PropertyNameDataPointBinding PropertyName="Value"/>
                    </telerik:BarSeries.ValueBinding>
                    <telerik:BarSeries.CategoryBinding>
                        <telerik:PropertyNameDataPointBinding PropertyName="Category"/>
                    </telerik:BarSeries.CategoryBinding>
                </telerik:BarSeries>
            </telerik:RadCartesianChart>
             
            <telerik:RadPieChart Name="pieChart" Grid.Column="0"  Grid.Row="1" PaletteName="DefaultDark" Margin="0,0,10,0">
                <telerik:RadPieChart.Behaviors>
                    <telerik:ChartSelectionBehavior SelectionChanged="ChartSelectionBehavior_OnSelectionChanged_PIE" DataPointSelectionMode="Single" SeriesSelectionMode="Single"/>
                </telerik:RadPieChart.Behaviors>
                <telerik:PieSeries ItemsSource="{Binding Items}" RadiusFactor="0.5">
                    <telerik:PieSeries.ValueBinding>
                        <telerik:PropertyNameDataPointBinding PropertyName="Value"/>
                    </telerik:PieSeries.ValueBinding>
                    <telerik:PieSeries.LabelDefinitions>
                        <telerik:ChartSeriesLabelDefinition Margin="-15"/>
                    </telerik:PieSeries.LabelDefinitions>
                </telerik:PieSeries>
            </telerik:RadPieChart>
        </Grid>
    </Grid>
</Page>

ViewModel:
public class ViewMOdel : INotifyPropertyChanged
   {
       private IEnumerable<CategoricalDataPoint> _items;
       public IEnumerable<CategoricalDataPoint> Items
       {
           get { return _items; }
           set
           {
               _items = value;
               OnPropertyChanged();
           }
       }
 
       public ViewMOdel()
       {
           var items = new List<CategoricalDataPoint>();
           for (int i = 2004; i < 2012; i++)
           {
               items.Add(new CategoricalDataPoint
               {
                   Category = i.ToString(),
                   Value =  i%2 == 0 ? 2000 : 0,
               });
           }
 
           Items = items;
       }
 
       public event PropertyChangedEventHandler PropertyChanged;
 
       [NotifyPropertyChangedInvocator]
       protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
       {
           PropertyChangedEventHandler handler = PropertyChanged;
           if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
       }
   }

Page code behind:
public sealed partial class MainPage : Page
   {      
       public MainPage()
       {
           this.InitializeComponent();
 
           this.DataContext = new ViewMOdel();
       }
     
       protected override void OnNavigatedTo(NavigationEventArgs e)
       {
       }
 
       private void ChartSelectionBehavior_OnSelectionChanged_PIE(object sender, EventArgs e)
       {
           Debugger.Break();
       }
 
       private void ChartSelectionBehavior_OnSelectionChanged_BAR(object sender, EventArgs e)
       {
           Debugger.Break();
       }
   }


Thanks in advance,
Vladimir.

5 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 16 Jan 2013, 12:11 PM
Hi Vladimir,

Thank you for using our controls.

Can you please clarify what version of our RadControls for Windows 8 you are using? We had an issue with ChartSelectionBehavior similar to your description but it is fixed in our latest internal build.

I hope this information is useful. Let me know if I can assist you further.

 

Regards,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Vladimir
Top achievements
Rank 1
answered on 16 Jan 2013, 12:42 PM
Hi Ivaylo,

Thank you for the responce,

So, I've just checked and it seems that I use Q3 2012 SP1.
Where I can download the internal build?(I am still using the trial version if it matters)

We are having a demo next week, so it is extremely important to get that fixed... :(

Thanks in advance,
Vladimir.





0
Ivaylo Gergov
Telerik team
answered on 16 Jan 2013, 04:17 PM
Hi Vladimir,

Thank you for getting back to us.

Only licensed accounts have access to our internal builds. If you want to download it you need to either purchase a license, or download it from a licensed account from Manage Products->Latest Internal Builds and then choose RadControls for Windows 8.

I hope this helps. If you have other questions do not hesitate to contact us again.


 

Kind regards,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Vladimir
Top achievements
Rank 1
answered on 17 Jan 2013, 01:55 PM
Hi Ivaylo,

Thanks for the response.
We have got a license and I can confirm that latest internal build does fix the Problem with the BarChart.

I have one more question,
How can I get the Click event for the Bar Chart X Axis labels?
I have a CartesianChart with CategoricalDataPoints in it and I need to get Click event when user taps on Axis X labels,(Category Name)

Thanks in advance,
Vladimir.
0
Ivaylo Gergov
Telerik team
answered on 17 Jan 2013, 03:34 PM
Hello Vladimir,

Thank you for getting back to us.

You can use the CategoricalAxis.LabelTemplate property and add a tapped event handler to the textblock in the default template:
<telerik:CategoricalAxis.LabelTemplate>
    <DataTemplate>
        <TextBlock Text="{Binding}"
                   Margin="4"
                   Tapped="TextBlock_Tapped_1"/>
    </DataTemplate>
</telerik:CategoricalAxis.LabelTemplate>

I hope this helps. Let me know if I can assist you any further.


Kind regards,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Chart for XAML
Asked by
Vladimir
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Vladimir
Top achievements
Rank 1
Share this question
or