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

interaction possible

6 Answers 244 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
smartpcr
Top achievements
Rank 1
smartpcr asked on 07 Dec 2011, 10:22 PM
  • Can I select a series/item on chart and have it highlighted (different style)
  • Any event such as selection changed?

6 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 08 Dec 2011, 12:44 PM
Hello Smartpcr,

The current BETA version supports multiple item selection only -- we will be extending the ChartSelectionBehavior with series selection and the ability to specify single item/series selection for the Q1 2012 official release.

Here is a sample code snippet that demonstrates how you can enable the chart selection:
  • Add ChartSelectionBehavior instance to the RadCartesianChart.Behaviors collection.
  • Define the desired selection color via custom ChartPalette and set it to the RadCartesianChart.SelectionPalette property.
  • You can detect the selection actopn via the RadCartesianChart.SelectionChanged event.

<telerik:RadCartesianChart x:Name="RadChart1" Palette="Metro" SelectionChanged="RadChart1_SelectionChanged">
    <telerik:RadCartesianChart.Behaviors>
        <telerik:ChartSelectionBehavior />
    </telerik:RadCartesianChart.Behaviors>
 
    <telerik:RadCartesianChart.SelectionPalette>
        <telerik:ChartPalette>
            <telerik:ChartPalette.GlobalEntries>
                <telerik:PaletteEntry Fill="Red" />
            </telerik:ChartPalette.GlobalEntries>
        </telerik:ChartPalette>
    </telerik:RadCartesianChart.SelectionPalette>
 
    <telerik:BarSeries>
        <telerik:CategoricalDataPoint Value="1" />
        <telerik:CategoricalDataPoint Value="2" />
        <telerik:CategoricalDataPoint Value="6" />
        <telerik:CategoricalDataPoint Value="7" />
    </telerik:BarSeries>
             
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:CategoricalAxis />
    </telerik:RadCartesianChart.HorizontalAxis>
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis />
    </telerik:RadCartesianChart.VerticalAxis>
 
    <telerik:RadCartesianChart.Grid>
        <telerik:CartesianChartGrid MajorLinesVisibility="Y" />
    </telerik:RadCartesianChart.Grid>
</telerik:RadCartesianChart>

All the best,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
SOFIE
Top achievements
Rank 1
answered on 17 Jan 2012, 10:12 AM
Hi Telerik,

I have been using the new chart engine and I must admit it is so much more simple than the previous one.

I have implemented the selection behavior and it works well, I can click on any of my bar and raise the selection event.

Nevertheless, I am trying now to find a way to select on of the bar (from my BarSeries) from code and not from mouse click anymore.

I tried to set the selectionPoints in the code manually without success.

Can you tell me how to select one single bar from code ?

Thanks !
0
SOFIE
Top achievements
Rank 1
answered on 18 Jan 2012, 09:56 AM
Up ;)
0
Giuseppe
Telerik team
answered on 20 Jan 2012, 12:32 PM
Hello Sofie,

RadChart.SelectionPoints is a read-only collection that is generally useful if you would like to use the chart selection in a different control (i.e. you will bind ListBox.ItemsSource to RadChart.SelectionPoints).

You can use the respective DataPoint.IsSelected boolean property to achieve the desired effect:
(RadChart1.Series[0] as BarSeries).DataPoints[2].IsSelected = true;

Hope this helps.


All the best,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
smartpcr
Top achievements
Rank 1
answered on 18 May 2012, 06:02 PM
Which future release support selection behavior on chart series? thanks!
0
Giuseppe
Telerik team
answered on 23 May 2012, 05:01 PM
Hello Xiaodong,

Could you elaborate a bit more on the desired selection behavior -- if you are looking for series-wide selection e.g. for a LineSeries to highlight the whole polyline in a different color, unfortunately this functionality is not available yet.


All the best,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ChartView
Asked by
smartpcr
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
SOFIE
Top achievements
Rank 1
smartpcr
Top achievements
Rank 1
Share this question
or