I need to create a UI that uses color bands to select a series of bars in a chart using a TBarSeries.
The attached demo gets close--when the mouse goes down, it finds the closest center of a bar bar then selects from the middle of the bar to the middle of the bar when the mouse goes up.
But I need it to find the closest point between two bars and start there. (After getting that right, I need to add multiple color bands, but I believe after getting this first step right everything else should be easy).
How can I achieve this?
Thank you,
Ed Dressel
Selecting bars in a series with a TColorBand
-
- Newbie
- Posts: 12
- Joined: Mon Mar 09, 2015 12:00 am
Selecting bars in a series with a TColorBand
- Attachments
-
- Selection Point 3b.zip
- (6.02 KiB) Downloaded 735 times
Re: Selecting bars in a series with a TColorBand
Hello,
I've played a bit with your application and I think I improved it a bit.
First note CalcXPos returns x pixel position of the left side of a bar, not the middle.
I basically used XValue[lIdx] as the ColorBand values instead of using lIdx as value.
Then I implemented a CalcOffset function to calculate the offset to add to a given bar index and mouse X position. When the given X pixel position is on the left side of the bar, the offset is negative.
I've played a bit with your application and I think I improved it a bit.
First note CalcXPos returns x pixel position of the left side of a bar, not the middle.
I basically used XValue[lIdx] as the ColorBand values instead of using lIdx as value.
Then I implemented a CalcOffset function to calculate the offset to add to a given bar index and mouse X position. When the given X pixel position is on the left side of the bar, the offset is negative.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 12
- Joined: Mon Mar 09, 2015 12:00 am
Re: Selecting bars in a series with a TColorBand
Nice work--this looks good. Thank you for the quick turn around.
Ed Dressel
Ed Dressel