TeeChart Line style will not show close samples

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

TeeChart Line style will not show close samples

Post by BenW » Thu Apr 23, 2009 8:16 pm

Hello.

If you create a simple windows forms application using a TeeChart (runtime version v2.0.50727). and add the following to be called when the Form loads (but after the Teechart has been initialized):

private void Initialize()
{
tChart1.Aspect.View3D = false;

Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
tChart1.Series.Add(line1);

tChart1.Axes.Bottom.SetMinMax(-50, 80);
//tChart1.Axes.Bottom.Automatic = true;
tChart1.Axes.Left.SetMinMax(-50, 100);
//tChart1.Axes.Left.Automatic = true;

line1.Add(0, .098785, System.Drawing.Color.Red);
line1.Add(0, .098786, System.Drawing.Color.Red);
//line1.Add(0, .098786);
//line1.Add(0, .098787);


//line1.CheckDataSource();
}

Then there is no indication that 2 (or any) data samples exist.

What can be done about this? Are there axis properties that need to be set in order to have samples that are this close to each other, drawn?

If autoscale is enabled for the Left axis the samples are drawn, but the customer does not want to use autoscale, but wants to set the max and min values explicitly...

thanks,
Ben.

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

Post by Sandra » Fri Apr 24, 2009 9:02 am

Hello BenW,

I could reproduce your issues with version 2 of TeeChartFor .NET, but when I use version 3 of TeeChartFor .NET and using next line of code:

Code: Select all

line1.Pointer.Visible = true;
Point there are visible and works fine. I recomend that use last version of TeeChartFor .NET version 3.

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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Fri Apr 24, 2009 4:07 pm

Hi Sandra.

Please understand, we have this version installed and deployed in many customer installations. Hopefully you understand when a product is in production, your proposed solution of simply upgrading to version 3.0 is not accomplished readily. There is a huge effort associated with 3rd Party upgrades ranging from extensive Q/A (regression testing, deployment reconfiguration) to product roll-out. This is a very real issue for our customers against this version, today, and so I'm wondering if there is any other kind of a workaround that can be applied here against this version of the TeeChart. Can you please consult with your colleagues (perhaps Narcis), to determine if there is an alternative V2.0 Steema Teechart way of solving this problem.

Your help and cooperation in this regard is greatly appreciated!

Ben.

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

Post by Sandra » Mon Apr 27, 2009 8:22 am

Hello BenW,

One solution there are draw the pointers in the canvas, as example next code, that use After Draw event:

Initialize:

Code: Select all

        private void Initialize()
        {
            tChart1.Aspect.View3D = false;
            Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            tChart1.Series.Add(line1);
            tChart1.Axes.Bottom.SetMinMax(-50, 80);
            tChart1.Axes.Left.SetMinMax(-50, 100);
            line1.Add(0, .098785, System.Drawing.Color.Red);
            line1.Add(0, .098786, System.Drawing.Color.Red);
           tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);   
        }
After Draw Event:

Code: Select all

        void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            Steema.TeeChart.Styles.Line s = (Steema.TeeChart.Styles.Line)tChart1[0];

            for (int i = 0; i < s.Count; i++)
            {
                s.DrawPointer(s.CalcXPos(i), s.CalcXPos(i), s.Color, i);
            }
        }
       

I hope will help.

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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Mon Apr 27, 2009 8:57 pm

Hi Sandra.

Thanks for the workaround!

I think I've adapted the core solution so that it works for us even when panning and zooming, but I only want to employ the 'AfterDraw' override when we hit the TeeChart limitation. The code I've currently constructed and which employs some checks based on what I've discovered, and understand about the problem is as follows:

foreach (Steema.TeeChart.Styles.Line s in this.tChart1.Series)
{
Steema.TeeChart.Axis xAxis = s.GetHorizAxis;
Steema.TeeChart.Axis yAxis = s.GetVertAxis;
if (xAxis != null &&
s.Count > 1 &&
(((xAxis.MaxXValue - xAxis.MinXValue) < 1.0) && (xAxis.Automatic == false) && (yAxis.MaxYValue == yAxis.MinYValue )) ||
(((yAxis.MaxYValue - yAxis.MinYValue) < 1.0) && (yAxis.Automatic == false) && (xAxis.MaxXValue == xAxis.MinXValue)))
{
for (int i = 0; i < s.Count; i++)
{
int xPos = s.CalcXPos(i);
int yPos = s.CalcYPos(i);
if ((yPos > yAxis.IStartPos) &&
(yPos < yAxis.IEndPos) &&
(xPos < xAxis.IEndPos) &&
(xPos > xAxis.IStartPos))
{
// Draw the pointer only if it is going to appear within the chart bounds.
s.DrawPointer(s.CalcXPos(i), s.CalcYPos(i), s.Color, i);
}
}
}
}


Can you let me know if the checks I've put in are sufficient in order to identify when the poblem will occur, or are there some other checks I need to add. Note currently I only call DrawPointer if the following conditions are set:

1. There is greater than 1 sample in the series
2. The xAxis (or yAxis) maximum value is less than the xAxis (or yAxis) minimum value by 1.0.
3. Autoscale is not set for the limiting x (or y) axis.
4. The maxValue is not equal to the minValue for the opposing axis.

Thanks,
Ben.

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

Post by Sandra » Tue Apr 28, 2009 8:39 am

Hello Ben,

We have checked your code and we seems correct it's a good idea.
1. There is greater than 1 sample in the series
2. The xAxis (or yAxis) maximum value is less than the xAxis (or yAxis) minimum value by 1.0.
3. Autoscale is not set for the limiting x (or y) axis.
4. The maxValue is not equal to the minValue for the opposing axis.
We can't think of any other condition to evaluate for now.



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