Page 1 of 1

Issue with GetPointerStyle and setting pointer colors in Mon

Posted: Fri Jul 06, 2012 8:03 pm
by 17262881
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;
}

Re: Issue with GetPointerStyle and setting pointer colors in Mon

Posted: Mon Jul 09, 2012 10:24 am
by 10050769
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,

Re: Issue with GetPointerStyle and setting pointer colors in Mon

Posted: Mon Jul 09, 2012 1:55 pm
by 17262881
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.

Re: Issue with GetPointerStyle and setting pointer colors in Mon

Posted: Wed Jul 11, 2012 11:40 am
by 10050769
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,