Page 1 of 1

GetPointerStyle Issue of multiple styles

Posted: Mon Jul 18, 2011 7:28 pm
by 15658279
Hello,

I was trying to display data in the form of point series with each point having its own color and pointer style. I created new class derived from CustomPoint. I used GetPointerStyle event of this class to set Color and Style of each point. However graph is not displaying all data points. some of the points are not visible.

Following is the code example which has same issue.

Code: Select all

    public partial class MainFrm : Form
    {
        TChart tchart = new TChart();
        public MainFrm()
        {
            tchart.Dock = DockStyle.Fill;
            tchart.Aspect.View3D = false;
            this.Controls.Add(tchart);
        }

        protected override void OnLoad(EventArgs e)
        {
            ValuePoints point = new ValuePoints(tchart.Chart, "TestData");
            point.GetPointerStyle += point_GetPointerStyle;
        }       

        void point_GetPointerStyle(CustomPoint series, GetPointerStyleEventArgs e)
        {
            ValuePoints ser = series as ValuePoints;
            if (ser != null && e.ValueIndex >= 0)
            {
                e.Color = ser.SeriesColors[e.ValueIndex];
                e.Style = ser.Styles[e.ValueIndex];
            }
        }
    }

    public class ValuePoints : CustomPoint
    {
        public List<Color> SeriesColors;
        public List<PointerStyles> Styles;
        public ValuePoints(Chart c, string title)
            : base(c)
        {
            this.Title = title;
            this.FillSampleValues(6);
            SeriesColors = new List<Color>(new[] { Color.Red, Color.Green, Color.Yellow, Color.Magenta, Color.Yellow, Color.Purple });
            Styles = new List<PointerStyles>(new[] { PointerStyles.Sphere, PointerStyles.Cross, PointerStyles.Star, PointerStyles.Triangle, PointerStyles.Rectangle, PointerStyles.DownTriangle });
            this.Pointer.HorizSize = this.Pointer.VertSize = 3;
        }

        public override void DrawValue(int valueIndex)
        {
            base.DrawValue(valueIndex);
        }
    }
Also I tried using Points series as

Code: Select all

        protected override void OnLoad(EventArgs e)
        {
            Points point = new Points(tchart.Chart);
            point.FillSampleValues(6);
            point.GetPointerStyle += point_GetPointerStyle;
        } 
        void point_GetPointerStyle(CustomPoint series, GetPointerStyleEventArgs e)
        {
            if (e.ValueIndex >= 0)
            {
                var SeriesColors = new List<Color>(new[] { Color.Red, Color.Green, Color.Yellow, Color.Magenta, Color.Yellow, Color.Purple });
                var Styles = new List<PointerStyles>(new[] { PointerStyles.Sphere, PointerStyles.Cross, PointerStyles.Star, PointerStyles.Triangle, PointerStyles.Rectangle, PointerStyles.DownTriangle });
                e.Color = SeriesColors[e.ValueIndex];
                e.Style = Styles[e.ValueIndex];
            }
        }
 
With these examples, my second and third points appears to be invisible on graph.

Please help me with this problem.

Thanks,
Bhausaheb

Re: GetPointerStyle Issue of multiple styles

Posted: Tue Jul 19, 2011 10:09 am
by 10050769
Hello Bhausaheb

I can reproduce your problem and I have attached it in bug list report with number [TF02015667] we will try to fix it to next maintenance releases.

Thanks,