Profile Picture

Axis Cursor Performance

Posted By Paulo Silva 11 Years Ago
Author
Message
Paulo Silva
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 13, Visits: 12
Hi all,

I'm having some problems with Axis Cursor performance.

The performance depends on the number of X axis labels.

I attach a project that shows this.

Does anyone has any suggestion?

Attachments
CursorSelectionPerformance.zip (78 views, 45.00 KB)
Nevron Support
Posted 11 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: Last Week
Posts: 3,054, Visits: 4,009

Hi Paulo,

Generally the problem is that you perform a hit test on mouse move

void nChartControl1_MouseMove(object sender, MouseEventArgs e)
{
NHitTestResult hitTestResult = nChartControl1.HitTest(e.X, e.Y);
}

which is computationally expensive...



Best Regards,
Nevron Support Team



Paulo Silva
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 13, Visits: 12
Hi,

That's not a valid answer.

1. I need that code for select the values in a DataTable I have.
2. If hit test on mouse move is computationally expensive, Why not when I have less XAxisTickLabels? (menu option in solution - Decrease)


Best regards.


Daniel Csimszi
Posted 11 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 61, Visits: 35
Hi,

So if I understand you right then you have a data table with all of the values what you have inserted on the graph.

If so then:
I am not sure if that would be faster or not but You need to check the size of the graph, create a rectangle for restrictions of mouse click(if X and Y in the boundaries then handle the click event).
Calculate the length of the X axis by pixel from the previous data.

Divide that number with the number of data points you display. You should get a decimal number which is bigger then 1 call this number indexHelper (if you have more data points to show on the graph then the size of the graph then that method wont work).

take the X coordinate of your mouse click event(minus the CO where your graph starts) then multiply it with the indexHelper that will be equal index.

You should get your datapoint from your dataTable with dataTable[index].

As I mentioned before that is just working if the number of your data points are less then the pixel length of the graph, plus if your data points are constant, your graph is not real time.

It is possible that the index wont be accurate(+1/-1) because of the rounding(the index need to be integer) but if thats really speeds up your program it might worth it.

Regards
Daniel

Nevron Support
Posted 11 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: Last Week
Posts: 3,054, Visits: 4,009

Hi Paulo,

You use XML formatted texts for the axis labels - this is slow by design as the control has to parse the label, build text document etc...



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic