I am trying to figure out how to use the drilldown feature.
I looked at the drilldown "help" http://docs.telerik.com/devtools/winforms/chartview/features/drill-down but not sure how to get it to apply to my situation because I don't really have separate "views" or binding. I really just need to be able to get an event to tell me that I've double clicked on a data point.
I have created a multi-level donut chart (attached), and I want to be able to double click on any segment and recreate the chart centered on that segment.
I did try adding a view and a DrillDownController hoping that it would fire the "drill" event but it did not.
As an aside, I believe that the description in the "help" for the "InnerRadiusFactor" of the donut series is either incorrect or at least misleading. It says that "its value is used as a percentage of the whole radius", but it appears to work as a percentage of the RadiusFactor amount. If it were the whole radius, I could set it to 0.2 and I should get consistently sized series bands that are 20% of the available space, but what it actually gives me are bands that are 20% of the radius of the series defined by RadiusFactor. I had to scale at (1 / (RadiusFactor * 5) to get a consistently 20% sized bands.
13 Answers, 1 is accepted
Thank you for writing.
If you need to determine which part is selected you can use the Selection functionality: ChartView Selection.
I have checked our Feedback Portal and we have an issue with the drill down functionality. The items details are located here: UI for Winforms Feedback Portal - FIX. RadChartView - pie series do not implement the ILegendInfoProvider interface.
Could you please check if the suggested workaround works for your case? If not I would suggest you open a support thread and attach you project there. This will allow us to properly investigate this case.
You are correct about the InnerRadiusFactor property and it behaves exactly as you have described. We will update the property description.
I hope this will be useful.
Regards,
Dimitar
Telerik
The workaround does seem to work for my case and I am now able to get the drill event, but with the swapping around of the views, I think that the chart view selection will be a better approach.
HOWEVER, for both the drill (with the workaround), and the selection, I only get the events for clicks on my first donut ring. Clicks on any other donut series seem to get lost. Also, tooltips only work on that first series.
Is there any event I can get to tell me when I have clicked on an area of the chart that is not one of the pie/donut data points? There does not appear to be a selection changed to nothing state.
Also I think the object browser help text is wrong for RadChartView.DrillNavigationMode:
Public Property DrillNavigationMode As Telerik.WinControls.UI.DrillNavigationMode
Member of Telerik.WinControls.UI.RadChartView
Summary:
Show or hide Smart labels controller in RadChartView.
Thank you for writing back.
I have checked this and it appears that there is an issue with the pie renderer. The issue is caused because the HitTest method only searches for the selected point in the first added series. I have logged this issue in our Feedback Portal. You can track the item for status changes and add your vote for it here.
To workaround this you can create a custom PieRenderer and override the HitTest method (this will fix the tooltips as well):
class
MyPieRenderer : PieRenderer
{
public
MyPieRenderer(PieArea area) :
base
(area)
{
}
public
override
DataPoint HitTest(
int
x,
int
y)
{
if
(
this
.DrawParts.Count > 0)
{
foreach
(var item
in
this
.DrawParts)
{
if
(item
is
PieSeriesDrawPart)
{
Dictionary<PieDataPoint, GraphicsPath> paths = ((PieSeriesDrawPart)item).PointPaths;
foreach
(PieDataPoint point
in
paths.Keys)
{
GraphicsPath path =
new
GraphicsPath();
paths.TryGetValue(point,
out
path);
if
(path !=
null
)
{
if
(path.IsVisible(x, y))
{
return
point;
}
}
}
}
}
}
return
null
;
}
The following snippet shows how you can change the defaut renderer:
private
void
RadChartView1_CreateRenderer(
object
sender, ChartViewCreateRendererEventArgs e)
{
e.Renderer =
new
MyPieRenderer((PieArea)e.Area);
}
Your Telerik Points have been updated for this report.
In addition, you can use the HitTest method in the MouseDown event handler of the chart to determine where the user is clicking. The method will return null if no point is clicked:
MyPieRenderer renderer;
private
void
RadChartView1_CreateRenderer(
object
sender, ChartViewCreateRendererEventArgs e)
{
renderer =
new
MyPieRenderer((PieArea)e.Area);
e.Renderer = renderer;
}
private
void
RadChartView1_MouseDown(
object
sender, MouseEventArgs e)
{
if
(renderer.HitTest(e.Location.X,e.Location.Y) ==
null
)
{
//No point is selected
}
}
Indeed, the description for the DrillNavigationMode is wrong, we will change it as soon as possible.
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Telerik
Thanks, providing my own hit test does solve the problem. Of course due to the quantity of my data (I have about 1000 series in that chart), the lag performing the hit test in this manner is pretty substantial. I found as an alternative I can get the angle from the point of the cursor to the origin and search only the data points containing that angle within their range according to the hierarchy of the wedges along the concentric rings.
A few questions though. Is there an easy way to get the series containing the data point? I am currently storing it in a "wedge" class that derives from the pie data point, but if I can access one that already exists, that would be easier.
Is there an easy way to get the center point of the pie or should I just get the layout slot of the area from the renderer and use its center? Is the viewport with the pie always going to be full plot area?
The description for the pie series says that the pie pieces are rendered counter clockwise but that doesn't seem to be the case.
Thank you for writing back.
You can get the series by using the Presenter property:
var series = point.Presenter
as
DonutSeries;
You can get the center lie this:
var centerPoint = radChartView1.View.Viewport.Center;
The pie will always take the entire available space, please note that it is always a square and the view has a default margin. The default margin can be changed as follows:
radChartView1.View.Margin =
new
Padding(0);
The StartAngle property indicates where the data point starts (imagine you have a standard coordinate system), and the SweepAngle indicates how large the point element is.
I hope this information is useful.
Regards,
Dimitar
Telerik
Sorry I meant that the PieDataPoint class has a StartAngle and SweepAngle but they don't seem to get populated.
Also the help for pie says "Note that pie slices are always rendered in counter-clockwise direction", but the example shows Germany, United States, France, and United Kingdom being displayed in a clockwise direction.
Thank you for writing back.
These properties are updated when the chart is made visible and all layout operations are completed. You can test this by putting a break point in the custom renderer where the point is returned (see attached image).
In addition, you are right about the direction. I have changed this in our documentation and it will be made live soon.
Let me know if you have additional questions.
Regards,
Dimitar
Telerik
hi,
How could I get the ChartView Palette to var ,
I want to save palette to database, and set the palette of chartview next time with stored data.
Regarding
Jamsheer
Hello, Jamsheer,
The RadChartView.Area.View.Palette property gives you the value of the currently applied palette. All available palettes are stored in the KnownPalette class: https://docs.telerik.com/devtools/winforms/controls/chartview/customization/palettes
The following code snippet demonstrates how to store the currently applied palette and restore it at a later moment:
//store palette
string palette = this.radChartView1.Area.View.Palette.Name;
//restore the palette
this.radChartView1.Area.View.Palette = KnownPalette.LoadPalette(palette);
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
hi Dess,
Thank you for fast reply
Here its Working if I set like this
string palette = "Rainbow";
radchart1.Area.View.Palette = KnownPalette.LoadPalette(palette);
radchart1.Area.View.Palette.Name = palette;
but if I change the palette with the property of Context Menu Strip, The palette name is null, I cant get what palette is applied on chartview
How could I overcome this,
Regarding
Jamsheer
If I use the context menu to set the palette, it still can be extracted and then again the same palette to be applied. Please refer to the attached gif file illustrating better the observed behavior on my end.
I have also attached the sample project for your reference. Please give it a try and see how it works on your end. Am I missing something? Could you please specify the exact steps how to reproduce the problem?
I am looking forward to your reply.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.