Page 1 of 1

colorband start and end lines

Posted: Tue Mar 03, 2009 11:06 am
by 14045263
Is it possible to change the width of the colourlines used for drawing the start and end of the colourbands??

I'm in to a situation in that if the user zooms in a lot and makes a colourband too small, then on zoom out it doesn't appear as it is too thin, so I was going to see if the thickness of the lines could be changed - i'm not sure what else could be done!

Regards,
Chris

Posted: Tue Mar 03, 2009 1:46 pm
by yeray
Hi Chris,

You could calculate the minimum difference between values that make them visible doing this after a first draw:

Code: Select all

OnePixelIncrement = tChart1.Axes.Left.CalcPosPoint(0) - tChart1.Axes.Left.CalcPosPoint(1);
And then force the values of your colorband to have this minimum visible distance at OnUndoZoom event.

Code: Select all

void tChart1_UndoneZoom(object sender, EventArgs e)
        {
            if (Math.Abs(colorband1.Start - colorband1.End) < Math.Abs(OnePixelIncrement))
            {
                colorband1.End = colorband1.Start + 2*OnePixelIncrement;
            }
        }
As you can see here you should add some code to save the old end colorband value and restore it at OnZoom event.

Another possibility could be drawing a line directly to the canvas using OnAfterDraw event.

I hope these ideas will help you.

Posted: Tue Mar 03, 2009 2:47 pm
by 14045263
Thanks Yeray, i'll have a look at using them.