Transparency problem with inverted stairs

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Glenn F. Henriksen
Newbie
Newbie
Posts: 52
Joined: Tue Mar 04, 2003 5:00 am

Transparency problem with inverted stairs

Post by Glenn F. Henriksen » Fri Sep 07, 2007 7:35 am

We have been experiencing a problem with the drawing of points for a line series with inverted stairs in the web.

Teechart.Net (1.1 framework) version:
2.0.2586.24038

Visual Studio 2003
ASP.Net 1.1

The problem occurs when we set a certain point as transparent, then the next point(which has a color) and it's corresponding line will not be drawn.
However, if we set the color of the line to System.drawing.color.fromargb(0,0,0,0) rather than system.drawing.color.Transparent, then the behaviour is as it should be, although we need to set the previous point to have the same value as the next point.

I have prepared a small demo to show the problem:

Code: Select all

Dim aSeries As New Steema.TeeChart.Styles.Line
Dim workingDate As Date

aSeries.Stairs = True
aSeries.InvertedStairs = True
aSeries.XValues.DateTime = True
aSeries.Title = ""
aSeries.Color = System.Drawing.Color.Red

workingDate = workingDate.AddMinutes(15)
aSeries.Add(workingDate, 3000, System.Drawing.Color.Transparent)

workingDate = workingDate.AddMinutes(15)
aSeries.Add(workingDate, 3000, System.Drawing.Color.Transparent)

workingDate = workingDate.AddMinutes(15)
aSeries.Add(workingDate, 3000, System.Drawing.Color.Red)

workingDate = workingDate.AddMinutes(15)
aSeries.Add(workingDate, 3000, System.Drawing.Color.Transparent)

workingDate = workingDate.AddMinutes(15)
aSeries.Add(workingDate, 3000, System.Drawing.Color.Transparent)

mForecastChart.Chart.Series.Add(aSeries)
mForecastChart.Chart.Axes.Left.SetMinMax(0, 5000)

If you test this code out, then you should not see any points nor lines being drawn. However, change the color to one with alpha zero(for the transparent ones) and you do see the line appear.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Sep 07, 2007 9:29 am

Hi Glenn,

This is because in TeeChart for .NET v2 setting a point to Color.Transparent implies setting it to be a null point. As to draw a line at least 2 points are necessary, that's why no line is visible.

In TeeChart for .NET v3 we added TreatNulls property which allows you to choose whether if you want to paint null points or not.

In v2 a workaround would be converting System.Drawing.Color.Transparent to Int32 and then use this value for assigning the color as shown here:

Code: Select all

		Dim aSeries As New Steema.TeeChart.Styles.Line
		Dim workingDate As Date

		'aSeries.Stairs = True
		'aSeries.InvertedStairs = True
		aSeries.XValues.DateTime = True
		aSeries.Title = ""
		aSeries.Color = System.Drawing.Color.Red

		Dim transp As Int32 = System.Drawing.Color.Transparent.ToArgb()

		workingDate = workingDate.AddMinutes(15)
		aSeries.Add(workingDate, 3000, System.Drawing.Color.FromArgb(transp))

		workingDate = workingDate.AddMinutes(15)
		aSeries.Add(workingDate, 3000, System.Drawing.Color.FromArgb(transp))

		workingDate = workingDate.AddMinutes(15)
		aSeries.Add(workingDate, 3000, System.Drawing.Color.Red)

		workingDate = workingDate.AddMinutes(15)
		aSeries.Add(workingDate, 3000, System.Drawing.Color.FromArgb(transp))

		workingDate = workingDate.AddMinutes(15)
		aSeries.Add(workingDate, 3000, System.Drawing.Color.FromArgb(transp))

		mForecastChart.Chart.Series.Add(aSeries)
		mForecastChart.Chart.Axes.Left.SetMinMax(0, 5000)
Best Regards,
Narcís Calvet / 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