Issue with GetPointerStyle and setting pointer colors in Mon

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Netsoft
Newbie
Newbie
Posts: 8
Joined: Tue Jul 03, 2012 12:00 am

Issue with GetPointerStyle and setting pointer colors in Mon

Post by Netsoft » Fri Jul 06, 2012 8:03 pm

Below is an example that calls the GetPointerStyle method to set different colors for the pointer based on the pointer index. Even though the pointer indices start with 0, the color for the first pointer is never set because it seems to set the colors for the pointer after the index in question.

However, the pointer pen color seems to work as expected. Could you please let me know on what I am doing wrong. Thanks.

public void InitChart()
{
newChart = new TChart();
newChart.Frame = new RectangleF(0,10,320,300);
newChart.Header.Visible = false;
newChart.Legend.Visible = false;
newChart.Axes.Visible = false;

this.View.AddSubview(newChart);

Steema.TeeChart.Themes.CustomTheme backgroundTheme = new Steema.TeeChart.Themes.ClassicTheme(newChart.Chart);
backgroundTheme.Apply();
newChart.Walls.Back.Gradient.Visible = false;
newChart.Walls.Back.Color = UIColor.Black.CGColor;
newChart.Panel.Color = UIColor.Black.CGColor;
newChart.Aspect.View3D = false;
newChart.Chart.Aspect.ZoomScrollStyle = Steema.TeeChart.Drawing.Aspect.ZoomScrollStyles.Manual;
newChart.Panning.Allow = ScrollModes.Horizontal;

newSeries = new Steema.TeeChart.Styles.Line();
newSeries.LinePen.Width = 2;
newSeries.Pointer.Visible = true;
newSeries.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle;
newSeries.Pointer.HorizSize = 10;
newSeries.Pointer.VertSize = 10;
newSeries.Pointer.Pen.Color = UIColor.White.CGColor;
newSeries.Color = UIColor.White.CGColor;


newSeries.Add (2);
newSeries.Add (1);
newSeries.Add(4);
newSeries.GetPointerStyle += HandleGetPointerStyle;

newChart.Series.Add (newSeries);
}

void HandleGetPointerStyle (Steema.TeeChart.Styles.CustomPoint series, Steema.TeeChart.Styles.GetPointerStyleEventArgs e)
{
newSeries.Pointer.Color = GetColorForIndex(e.ValueIndex);
newSeries.Pointer.Pen.Color = GetColorForIndex(e.ValueIndex);

}

private MonoTouch.CoreGraphics.CGColor GetColorForIndex(int index)
{
MonoTouch.CoreGraphics.CGColor color = UIColor.White.CGColor;

if( index <= 1)
color = UIColor.Red.CGColor;
else if( index <= 2)
color = UIColor.Orange.CGColor;
else if( index <= 3)
color = UIColor.Yellow.CGColor;
else if( index <= 4)
color = UIColor.Green.CGColor;


return color;
}

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Issue with GetPointerStyle and setting pointer colors in Mon

Post by Sandra » Mon Jul 09, 2012 10:24 am

Hello NetSoft,

Next code I have made in c# works fine for me, as you see I have changed the color directly in the GetPointerStyle Event. Could you please, try to do the same in your MonoTouch project and check if it works as you want? if you have any problems please let me know.

Code: Select all

 void newSeries_GetPointerStyle(CustomPoint series, GetPointerStyleEventArgs e)
        {
            if (e.ValueIndex <1)
                e.Color = Color.Red;
            else if (e.ValueIndex < 2)
                e.Color = Color.Orange;
            else if (e.ValueIndex < 3)
                e.Color = Color.Yellow;

        }
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Netsoft
Newbie
Newbie
Posts: 8
Joined: Tue Jul 03, 2012 12:00 am

Re: Issue with GetPointerStyle and setting pointer colors in Mon

Post by Netsoft » Mon Jul 09, 2012 1:55 pm

Thanks Sandra, that did the trick for me.

I have another slightly related question. I have click series event on the series. Currently, I have the horizontal and vertical size of the pointers set to 10 but I still don't get a 100% success rate on tapping the pointers. I think this will improve if I increase the surface area of the pointers but at the same time I don't want to make them too large. My questions is, is there a way to increase surface area without visually increasing the size of the pointers? Thanks.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Issue with GetPointerStyle and setting pointer colors in Mon

Post by Sandra » Wed Jul 11, 2012 11:40 am

Hello NetSoft,

I am afraid that at the moment, the only way to achieve increase surface of pointer you need change the width and the height the pointer. So at the moment I don't have no ideas of you how can achieve it. The only way, is increase the size of pointer when you increase chart or you do zoom.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply