Page 1 of 1

Transparency problem with inverted stairs

Posted: Fri Sep 07, 2007 7:35 am
by 8119814
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.

Posted: Fri Sep 07, 2007 9:29 am
by narcis
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)