You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I don't get why you want to extend around the visible area ? A user cannot move the mouse on something invisible (of course an object partially visible need to be include in the visible area, that's a different point).
When the chart is zoomed, scaled, moved, etc... just update your visible area and the selected objects according to the new time/price intervals. In all cases working with chart objects is relatively slow, you would need to keep all data in memory for a fast processing.
A vector is a data structure, not an algorithm, you need to start from the algorithm then see what data structure you need to implement it.
I don't get why you want to extend around the visible area ? A user cannot move the mouse on something invisible (of course an object partially visible need to be include in the visible area, that's a different point).
When the chart is zoomed, scaled, moved, etc... just update your visible area and the selected objects according to the new time/price intervals. In all cases working with chart objects is relatively slow, you would need to keep all data in memory for a fast processing.
A vector is a data structure, not an algorithm, you need to start from the algorithm then see what data structure you need to implement it.
Instead of performing a linear search (iterating) through the list, you can build an index from keys in the list, then use that index to get the values directly from the list.
This idea is similar to index rebuilding in relational databases.
The index itself is a hash map of key-value pairs, where (key) is a transformation of price and time; (value) = index of a graphical object in the list;
The run-time complexity of linear search by iterating though the list is O(n), where n is the total objects in the list. The time complexity of hashed search using the index map method is O(1).
Instead of performing a linear search (iterating) through the list, you can build an index from keys in the list, then use that index to get the values directly from the list.
This idea is similar to index rebuilding in relational databases.
The index itself is a hash map of key-value pairs, where (key) is a transformation of price and time; (value) = index of a graphical object in the list;
The run-time complexity of linear search by iterating though the list is O(n), where n is the total objects in the list. The time complexity of hashed search using the index map method is O(1).
My idea is to round-down the coordinates of the graphical objects (e.g., price to 3 digits, time to 1 minute) before calculating the hash key.
This effectively will transform the chart area to small rectangles that can be easily encoded in the index database.
The search by using these approximate keys (mouse price and time) will return the "nearest bounding rectangle". However, each rectangle has a limitation that it can contain only one object (HashMap does not allow values with duplicate keys).
My idea is to round-down the coordinates of the graphical objects (e.g., price to 3 digits, time to 1 minute) before calculating the hash key.
This effectively will transform the chart area to small rectangles that can be easily encoded in the index database.
The search by using these approximate keys will return the "nearest bounding rectangle".
if the coordinates are limited like 0-1000 for both for a hash you can squeeze them together into one new number = x + 1000*y. Then x= number%1000 and y= number/1000 (one need to check the rounding of big numbers)? max of ulong (18 446 744 073 709 551 615) has 20 digits so this would work up to 8 digits (99 999 999) for each coordinate?