Main Page | Report this Page
.NET DotNet Forum Index  »  General Discussion  »  strange results using dotnet chart control...
Page 1 of 1    

strange results using dotnet chart control...

Author Message
IB...
Posted: Wed Oct 28, 2009 7:20 am
Guest
vb express, 2008:

I do not get the last point in a stacked area chart. I made a simple
program, but could not reproduce it under test circumstances. Put my simple
test code into my main program, and the problem was still there - so the
same code shows the problem in one project, but not in another, very
strange.

After much experimentation, it seemed to be variable intervals in the X axis
data that was causing the problem, i.e.
4min 3 seconds between the first points, and 1 minute 5 seconds between the
next 2 points.

The code below gives me a chart with a rising orange edge, then a falling
orange edge for a 1/10 of the X distance, in my test project. In my main
project, the chart ends after the rising edge.

Any ideas how this can happen?

Thanks


Private Sub AddControl(ByVal C As Windows.Forms.Control)
Me.Controls.Add(C)
C.BringToFront()
C.Visible = True
End Sub

Private Sub MakeChartCommon(ByVal C As Chart, ByVal Top As Integer,
ByVal Width As Integer)
C.Top = Top
C.Width = Width
If C.ChartAreas.Count = 0 Then
Dim A As New ChartArea
C.ChartAreas.Add(A)
End If

If C.Titles.Count = 0 Then
Dim T As New Title
C.Titles.Add(T)
End If
If C.Legends.Count = 0 Then
Dim L As New Legend
C.Legends.Add(L)
End If
C.BorderSkin.SkinStyle = BorderSkinStyle.FrameThin1
C.BorderSkin.PageColor = Drawing.Color.FromArgb(40, 40, 60)
C.BackColor = Drawing.Color.FromArgb(192, 192, 255)
C.BackGradientStyle = GradientStyle.LeftRight
AddControl(C)

End Sub



Private ColStrings() As String = {"Upline", _
"Downline", _
"User", _
"Production", _
"Idle", _
"Off"}
Private ColColours() As Drawing.Color = {Drawing.Color.FromArgb(255,
128, 0), _
Drawing.Color.FromArgb(255,
255, 0), _
Drawing.Color.FromArgb(255, 0,
0), _
Drawing.Color.FromArgb(0, 196,
0), _
Drawing.Color.FromArgb(64, 64,
128), _
Drawing.Color.FromArgb(64, 32,
64)}



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim C As New Chart
MakeChartCommon(C, 10, 200)
C.ChartAreas(0).BackColor = Drawing.Color.FromArgb(0, 0, 0, 0)
C.ChartAreas(0).AxisY.Enabled = AxisEnabled.False

For Count = 0 To ColStrings.GetLength(0) - 1
Dim S As New Series(ColStrings(Count))
S.Color = ColColours(Count)
S.ChartType = SeriesChartType.StackedArea100
C.Series.Add(S)
Next

Dim DT1 As DateTime = Date.Parse("27/10/2009 16:10:00")
Dim DT2 As DateTime = Date.Parse("27/10/2009 16:20:00")
Dim DT3 As DateTime = Date.Parse("27/10/2009 16:21:00")


C.Series(0).Points.AddXY(DT1, 0)
C.Series(1).Points.AddXY(DT1, 0)
C.Series(2).Points.AddXY(DT1, 0)
C.Series(3).Points.AddXY(DT1, 0)
C.Series(4).Points.AddXY(DT1, 0)
C.Series(5).Points.AddXY(DT1, 100)

C.Series(0).Points.AddXY(DT2, 80)
C.Series(1).Points.AddXY(DT2, 0)
C.Series(2).Points.AddXY(DT2, 0)
C.Series(3).Points.AddXY(DT2, 0)
C.Series(4).Points.AddXY(DT2, 0)
C.Series(5).Points.AddXY(DT2, 20)

C.Series(0).Points.AddXY(DT3, 0)
C.Series(1).Points.AddXY(DT3, 0)
C.Series(2).Points.AddXY(DT3, 0)
C.Series(3).Points.AddXY(DT3, 0)
C.Series(4).Points.AddXY(DT3, 0)
C.Series(5).Points.AddXY(DT3, 100)



End Sub
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Fri Dec 11, 2009 2:50 am