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

[Solved] ChartSelectionBehavior not working after update

4 Answers 151 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.
Darko
Top achievements
Rank 1
Darko asked on 15 Dec 2012, 01:22 AM
Dear Telerik,
I'm experiencing a strange behavior in  ChartSelectionBehavior after update. 
Can you please verify the problem?
XAML:
<telerikChart:RadCartesianChart x:Uid="Chart" x:Name="ChartControl"  Grid.Row="2" DataContext="{Binding ActivityByDate}" EmptyContentTemplate="{StaticResource EmptyChartTemplate}">
  <telerikChart:RadCartesianChart.VerticalAxis>
    <telerikChart:CategoricalAxis></telerikChart:CategoricalAxis>
  </telerikChart:RadCartesianChart.VerticalAxis>
  <telerikChart:RadCartesianChart.HorizontalAxis>
    <telerikChart:LinearAxis LabelStyle="{StaticResource LabelStyle}"></telerikChart:LinearAxis>
  </telerikChart:RadCartesianChart.HorizontalAxis>
  <telerikChart:RadCartesianChart.SeriesProvider >
    <telerikChart:ChartSeriesProvider    Source="{Binding}" x:Name="provider" >
      <telerikChart:ChartSeriesProvider.SeriesDescriptors >
        <telerikChart:CategoricalSeriesDescriptor ValuePath="Value" CategoryPath="Date" ItemsSourcePath="ValuesByDay">
          <telerikChart:CategoricalSeriesDescriptor.Style>
            <Style TargetType="telerikChart:BarSeries">
              <Setter Property="CombineMode" Value="Stack"/>
              <Setter Property="PointTemplate">
                <Setter.Value>
                  <DataTemplate>
                    <Border Margin="1" BorderThickness="{Binding IsSelected, Converter={StaticResource BoolToThicknessConverter}}" BorderBrush="#FFFFE800">                     
                      <TextBlock FontSize="14" Margin="2" Foreground="White" VerticalAlignment="Center" Text="{Binding DataItem.Name}" />
                    </Border>
                  </DataTemplate>
                </Setter.Value>
              </Setter>
            </Style>
          </telerikChart:CategoricalSeriesDescriptor.Style>
        </telerikChart:CategoricalSeriesDescriptor>
      </telerikChart:ChartSeriesProvider.SeriesDescriptors>
    </telerikChart:ChartSeriesProvider>
  </telerikChart:RadCartesianChart.SeriesProvider>
  <telerikChart:RadCartesianChart.Behaviors>                   
      <telerikChart:ChartSelectionBehavior DataPointSelectionMode="Single" SelectionChanged="ChartSelectionBehavior_SelectionChanged_1"></telerikChart:ChartSelectionBehavior>
      <telerikChart:ChartPanAndZoomBehavior PanMode="Horizontal" ZoomMode="Horizontal"/>
   </telerikChart:RadCartesianChart.Behaviors>     
</telerikChart:RadCartesianChart>


 ChartSelectionBehavior_SelectionChanged_1 is called randomly, and   ChartSelectionBehavior.SelectedPoints is populated with wrong values. 

private void ChartSelectionBehavior_SelectionChanged_1(object sender, EventArgs e)  //doesn't fire on some items
{
    ChartSelectionBehavior sel = sender as ChartSelectionBehavior;
    if (sel == null) return;
    var item = sel.SelectedPoints.FirstOrDefault(); <-- SelectedPoints returns wrong items
    ....
}

Best regards,
Darko

4 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 18 Dec 2012, 12:59 PM
Hello Darko,

Thank you for using our RadControls for Windows 8!

Everything is working as expected on our side. I have prepared you an example (using the current code snippet and the RadControls for Windows 8 Extension - version 2012.3.1204.0) where I have added a TextBox in order to show the string representation of the value of the current selected point. Please, find the attached file. Can you please verify if this is working on your side too and if not - when exactly the SelectedPoints collection returns wrong value?

I am looking forward to your reply.


 

All the best,
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
Darko
Top achievements
Rank 1
answered on 18 Dec 2012, 10:48 PM
Hi Ivaylo!
Thank you for the effort.

Yes indeed you sample does work correctly. However when I add some space on top of the chart and axes are switched, it starts selecting items on top of the correct item. Here is a sample image of what I'm trying to achieve with some clues. Modified sample you sent me.

br,
darko

PS: Here is what I've changed from your sample:
<!-- added -->
      <Grid.RowDefinitions>
          <RowDefinition Height="100"></RowDefinition>
          <RowDefinition Height="*"></RowDefinition>
      </Grid.RowDefinitions>
      <telerikChart:RadCartesianChart x:Uid="Chart" x:Name="ChartControl"  Grid.Row="1" >
          <!-- switched axis -->
          <telerikChart:RadCartesianChart.VerticalAxis>
              <telerikChart:CategoricalAxis></telerikChart:CategoricalAxis>
          </telerikChart:RadCartesianChart.VerticalAxis>
          <telerikChart:RadCartesianChart.HorizontalAxis>               
              <telerikChart:LinearAxis></telerikChart:LinearAxis>
          </telerikChart:RadCartesianChart.HorizontalAxis>
0
Ivaylo Gergov
Telerik team
answered on 20 Dec 2012, 03:23 PM
Hello Darko,

Thank you for getting back to us.

Indeed I was able to reproduce the described issue. I have logged this issue as a bug and it will be fixed in one of our next internal builds - probably after the Christmas and New Year Holidays. I have also updated your Telerik points for your valuable feedback.

If you have any other questions, suggestions or ideas do not hesitate to contact us again.

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
Ivaylo Gergov
Telerik team
answered on 10 Jan 2013, 04:54 PM
Hello Darko,

I am happy to inform you that our internal build is now available for download. You can find it in your profile - Manage Products -> Latest Internal Builds -> RadControls for Windows 8. Then you can find all the included fixes clicking on version notes.

Thank you for your patience.

 

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
Darko
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Darko
Top achievements
Rank 1
Share this question
or