TChart Issues II

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: TChart Issues II

Post by Sandra » Mon May 03, 2010 9:23 am

Hello VarMelb,

Thanks, for your example. I think that you could solve your problem, doing something as next code:

Code: Select all

public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }

        private Steema.TeeChart.Styles.Bar bar1;
        private Steema.TeeChart.Tools.ColorLine colorLine1;
        private void InitializeChart()
        {
            bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar1.FillSampleValues();
            colorLine1 = new Steema.TeeChart.Tools.ColorLine(tChart1.Chart);
            colorLine1.Axis = tChart1.Axes.Bottom;
            colorLine1.Value = 0;
            colorLine1.Pen.Color = Color.Red;
            colorLine1.Value = 2;
            tChart1.Scroll +=new EventHandler(tChart1_Scroll);
            tChart1.UndoneZoom += new EventHandler(tChart1_UndoneZoom);
        }

        void tChart1_UndoneZoom(object sender, EventArgs e)
        {
            colorLine1.Active = true;
        }
        void tChart1_Scroll(object sender, EventArgs e)
        {
            if ((colorLine1.Value > tChart1.Axes.Bottom.Maximum) || (colorLine1.Value < tChart1.Axes.Bottom.Minimum))
                colorLine1.Active = false;
            else
                colorLine1.Active = true;
        }
Please, check if previous code solves your problem. Also, I have added with the information above item with number (TF02014843).

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

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: TChart Issues II

Post by VarMelb » Wed May 19, 2010 4:25 am

Hi Sandra,

thanks for the work around.

A simple "don't display the ColorLine when outside the Chart" is not really practical for our code as we have many charts each with a ColorLine.
Also the workaround doesn't handle the situation when the user drags the ColorLine outside the chart.

I will have to look at fixing the problem in the TChart ColorLine code.

thanks anyway.

Mark

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

Re: TChart Issues II

Post by Sandra » Wed May 19, 2010 10:13 am

Hello Mark,

I have made other simple project that I think you could use its code for solve your problem for now. Please, check if its code works as you want.

Code: Select all

        private Steema.TeeChart.Styles.Bar bar1,bar2;
        private Steema.TeeChart.Tools.ColorLine colorLine1,colorLine2;

        double inivalue;
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            tChart2.Aspect.View3D = false;

            bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar2 = new Steema.TeeChart.Styles.Bar(tChart2.Chart);
        
            bar1.FillSampleValues();
            bar2.DataSource = bar1;
            
            colorLine1 = new Steema.TeeChart.Tools.ColorLine(tChart1.Chart);
            colorLine2 = new Steema.TeeChart.Tools.ColorLine(tChart2.Chart);
           
            colorLine1.Axis = tChart1.Axes.Bottom;
            colorLine1.Value = 0;
            colorLine1.Pen.Color = Color.Red;
            colorLine1.Value = 4;

            colorLine2.Axis = tChart2.Axes.Bottom;
            colorLine2.Value = 0;
            colorLine2.Pen.Color = Color.Red;
            colorLine2.Value = 4;

            tChart1.Scroll += new EventHandler(tChart1_Scroll);
            tChart1.UndoneZoom += new EventHandler(tChart1_UndoneZoom);

            tChart2.Scroll +=new EventHandler(tChart1_Scroll);
            tChart2.UndoneZoom += new EventHandler(tChart2_UndoneZoom);
            tChart1.Axes.Bottom.Automatic = false;
            tChart1.Axes.Bottom.Minimum = 0;
            tChart1.Axes.Bottom.Maximum = 5;
            tChart1.Axes.Bottom.Increment = 1;

            tChart2.Axes.Bottom.Automatic = false;
            tChart2.Axes.Bottom.Minimum = 0;
            tChart2.Axes.Bottom.Maximum = 5;
            tChart2.Axes.Bottom.Increment = 1;
            inivalue = colorLine1.Value;
        }

        void tChart2_UndoneZoom(object sender, EventArgs e)
        {
            colorLine2.Value = inivalue;
        }

        void tChart1_UndoneZoom(object sender, EventArgs e)
        {
            colorLine1.Value = inivalue;
        }

        void tChart1_Scroll(object sender, EventArgs e)
        {
            Steema.TeeChart.Chart chart = (Steema.TeeChart.Chart)sender;
            Steema.TeeChart.Tools.ColorLine cl = new Steema.TeeChart.Tools.ColorLine();
            Steema.TeeChart.Axis axis = new Steema.TeeChart.Axis();

            if (chart.Tools[0] is Steema.TeeChart.Tools.ColorLine)
            {
                cl = (Steema.TeeChart.Tools.ColorLine)chart.Tools[0];
                axis = cl.Axis;    
            }

            if (cl != null)
            {
                if (cl.Value > axis.Minimum)
                {
                    cl.Value = Math.Max(inivalue, axis.Minimum);
                }

                if (cl.Value > axis.Maximum)
                {
                    cl.Value = Math.Min(inivalue, axis.Maximum);
                } 
            }         
        }
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

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: TChart Issues II

Post by VarMelb » Fri Jul 30, 2010 4:13 am

Hi Support,

thank you for fixing a couple of other issues I had reported.

However, I have tried the latest build (4.0.2010.27960) and I believe the ColorLine problem as stated above is still present.

If possible can the priority of this be elevated to be fixed for the next release.

thanks
Mark

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

Re: TChart Issues II

Post by Sandra » Fri Jul 30, 2010 9:23 am

Hello Mark,

Could you please, tell us if last code that I attached solve your problem and works as you want?


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

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: TChart Issues II

Post by VarMelb » Mon Aug 02, 2010 4:39 am

Hi Sandra,

the supplied code is not suitable.

When out side the axis min and max the ColorLine.Value should not change.

As our customer has requested this problem be fixed asap I have had to fix the problem in the TChart file ColorLine.cs.

Incidently, the same problem was present in the CursorTool code in the file Cusor.cs. I fixed that as well.

So our custom build of TChart now works as expected.

thanks for your time on this issue.

regards
Mark

Post Reply