Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1300
Name my axis ?
posted

Hi ,

I have modify the acis set with this code on the fillscengraph :

       // Create axes
            foreach (Primitive item in e.SceneGraph)
            {                
                if (item.GetType() == typeof(Line) && ((Line)item).lineStyle.DrawStyle != LineDrawStyle.Dash)
                {
                    if (((Line)item).p1.X == ((Line)item).p2.X)
                    {
                        ((Line)item).p1.Offset(this.Chartquadrant.Width / 2 - 50, 0);
                        ((Line)item).p2.Offset(this.Chartquadrant.Width / 2 - 50, 0);
                    }
                    else
                    {
                        ((Line)item).p1.Offset(0, -360);
                        ((Line)item).p2.Offset(0, -360);
                    }
                }

                Text pl = item as Text;
                if (pl != null && ((Text)item).labelStyle.Orientation == TextOrientation.VerticalLeftFacing)
                {
                    ((Text)item).bounds = new Rectangle(((Text)item).bounds.X + 0, ((Text)item).bounds.Y - (360), ((Text)item).bounds.Width, ((Text)item).bounds.Height);
                }

                if (pl != null && ((Text)item).labelStyle.Orientation == TextOrientation.Horizontal)
                {
                    ((Text)item).bounds = new Rectangle(((Text)item).bounds.X + this.Chartquadrant.Width / 2 - 50, ((Text)item).bounds.Y, ((Text)item).bounds.Width, ((Text)item).bounds.Height);
                }
            }
According to some sample I can put a text wherever I want on the graph by :

            // name axes
            IAdvanceAxis xAxis = (IAdvanceAxis)e.Grid["X"];
            IAdvanceAxis yAxis = (IAdvanceAxis)e.Grid["Y"];
            if (xAxis == null || yAxis == null)
    return;

            Text text = new Text();
            text.PE.Fill = Color.Red;
            text.bounds = new Rectangle((int)xAxis.Map(8), (int)yAxis.Map(10), 100, 20);
            text.SetTextString("Sample Text");

But the sample text is not visible, can you tell me what is wrong ?

Thanks