Profile Picture

Pie chart: get (x,y) pixel coordinates within a pie segment

Posted By Kevin Harrison 10 Years Ago

Pie chart: get (x,y) pixel coordinates within a pie segment

Author
Message
Kevin Harrison
Posted 10 Years Ago
View Quick Profile
Supreme Being

Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 176, Visits: 1,865

As part of our testing, we want to simulate clicking on a pie chart segment, using x,y pixel co-ordinates. What is the simplest way to achieve this?

Thanks

Kevin



Nevron Support
Posted 10 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 1 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Kevin,

You can perform hit test using the HitTest method:

NHitTestResult result = nChartControl1.HitTest(x, y);

if (result.ChartElement == ChartElement.DataPoint)
{
   // result.Series contains the series of the data point
   // result.DataPointIndex contains the data point index
}

Is this the functionality you're looking for?

Best Regards,
Nevron Support Team



Kevin Harrison
Posted 10 Years Ago
View Quick Profile
Supreme Being

Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 176, Visits: 1,865

No, I'm already doing that. The tester wants to simulate clicking on a pie segment to check my hit test code, so the tester needs the reverse information. He needs to know the x and y pixel coordinates to input into his test, whcih corresopond to clicking on a a pie chart segment.

Thanks

Kevin



Nevron Support
Posted 10 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 1 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Kevin,

That will be difficult - in the sense that you'll have to replicate the whole rendering code of the pie 2D/3D plus you'll need to take into account the non overlapping labels if you use them... In general you need to use a simpler approach - like as if the user has clicked pie1 or pie2 (skipping the hit test from mouse).

Best Regards,
Nevron Support Team



Kevin Harrison
Posted 10 Years Ago
View Quick Profile
Supreme Being

Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 176, Visits: 1,865
Sorry, I don't understand why it's so difficult. All I want is an (x,y) coordinate which lies within a given pie segment. I don't care where the point is within the segment. Am I missing something?



Similar Topics


Reading This Topic