Page 1 of 1

Using a Color Band to select a range of bars

Posted: Fri Apr 25, 2014 7:20 pm
by 10546565
In the demo using the link, I can click and drag the mouse left or right and it will normally highlight a x-range of the grid -- a color band highlights the selected items.

1. But.... sometimes it doesn't work (this it is highlighted in the MP4 video in the download). I can click and drag and the color band's start and end value seem to be the same. It seems that this occurs if I click on the very left side of a bar.

http://www.TBInc.com/misc/SelectionPoint3a.zip

I can't figure out how to fix this behavior.

2. Also, when the band is drawn, it is drawn from the left edge of the bar. How can I make the band start in the middle of the bar?

Thank you,

Ed Dressel

Re: Using a Color Band to select a range of bars

Posted: Mon Apr 28, 2014 10:44 am
by yeray
Hi Ed,
TestAlways wrote:1. But.... sometimes it doesn't work (this it is highlighted in the MP4 video in the download). I can click and drag and the color band's start and end value seem to be the same. It seems that this occurs if I click on the very left side of a bar.

http://www.TBInc.com/misc/SelectionPoint3a.zip

I can't figure out how to fix this behavior.
This part is the easy one. Some events seem to be interfering here. You can fix it disabling the AllowDrag property on all the dependant tools:

Code: Select all

  cbHighlight.StartLine.AllowDrag:=false;
  cbHighlight.EndLine.AllowDrag:=false;
  cbHighlight.AllowDrag:=false;
TestAlways wrote:2. Also, when the band is drawn, it is drawn from the left edge of the bar. How can I make the band start in the middle of the bar?
This will be more difficult. This means to change how the TColorBandTool is being drawn and I haven't found a way to override the needed functions so I can only think on modifying the TColorBandTool Drawing method on TeeChart sources or to skip using this tool and draw what you want in the OnBeforeDrawSeries event.