Graphics3D Pen Alignment

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
WD_Gordon
Newbie
Newbie
Posts: 49
Joined: Wed Jun 18, 2008 12:00 am

Graphics3D Pen Alignment

Post by WD_Gordon » Wed Apr 01, 2009 5:09 pm

I am drawing an horizontal line in the BeforeDrawAxes event and it is several pixels in width, i.e. g.Pen.Width = 10. The problem is the line centers on the y axis value. I tried using the alignment property, g.Pen.DrawingPen.Alignment, and it seems to have no effect. Please see code below:

Code: Select all

g.Pen.Color = newColor;
g.Pen.Width = Convert.ToInt32(this.tChart1.Axes.Right.CalcPosValue((double)this.lastBidSell) -
     this.tChart1.Axes.Right.CalcPosValue((double)this.lastAskBuy));
g.Pen.DrawingPen.Alignment = PenAlignment.Left;
g.Line(this.chartRect.X + 1,
     this.tChart1.Axes.Right.CalcPosValue((double)this.lastBidSell),
     this.chartRect.Width,
     this.tChart1.Axes.Right.CalcPosValue((double)this.lastBidSell));

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

Post by Sandra » Thu Apr 02, 2009 9:03 am

Hello WD_Gordon,

I could reproduce your problem and I have added to the list of Bug Report with number [TF02014053] we will try to fix it for next versions of TeeChart .NET.

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

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

Post by Sandra » Thu May 14, 2009 9:52 am

Hello WD_Gordon,ç

I noticed that the Bug Report with number [TF02014053], is not a bug, beacuse the code of TeeChart is not contamplate, and we think that this problem is a Feature Request. But, we make a simple example that solve your issue, and you could use a similar code for your application.


InitializChart:

Code: Select all

        private Steema.TeeChart.Styles.Bar bar1;
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar1.FillSampleValues();
            bar1.Marks.Visible = false;
            tChart1.BeforeDrawAxes += new Steema.TeeChart.PaintChartEventHandler(tChart1_BeforeDrawAxes);

        }
BeforeDrawAxes Event:

Code: Select all

        private void tChart1_BeforeDrawAxes(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
          // g.Pen.DrawingPen.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset;
            g.Pen.Width = 10;
            Rectangle rect = tChart1.Chart.ChartRect;
            g.Line(rect.Left, bar1.CalcYPos(0)-5, rect.Right, bar1.CalcYPos(0)-5);
        }
Please, check this code works fine in your application.

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