Page 1 of 1

color is not working in VB.Net 2005 implementation

Posted: Mon Aug 21, 2006 4:50 pm
by 6927067
I am using TeeChart in a VB.Net 2005 application. All seems to be working fairly well, but I can't get the color of my line series to work. Below is the code I am using.

I am trying to set the line series to color red using the line:

QuickChart.Series(0).Color = System.Drawing.ColorTranslator.ToOle(Drawing.Color.Red),

But to no avail. I know this color works because I use it later on to color the pen around the zoom box object, but the series line color is not changing.

Any suggestions?




Code: Select all

Private Sub TBtnChart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TBtnChart.Click
        'update the chart
        Dim thisvalues(1, 1) As Object
        thisvalues = GetValues(CurrentTS, "WCSDataCube_TimeSeries", Me.DBWorkSpace.PathName)
        Dim thists As TimeSeries
        For Each thists In CurrentWCS.TimeSeriesSet
            If thists.TSID = CurrentTS Then
                Me.CurrentTimeSeries = thists
                thists.Data = thisvalues
            End If
        Next
        If Me.CurrentTimeSeries Is Nothing Then Exit Sub
        QuickChart.ClearChart()
        QuickChart.RemoveAllSeries()
        QuickChart.AddSeries(TeeChart.ESeriesClass.scLine)
        QuickChart.Aspect.View3D = False
        QuickChart.Header.Visible = True

        Dim i As Integer
        For i = 1 To UBound(Me.CurrentTimeSeries.Data, 1)
            Dim thisdate As Double, thisval As Double
            Dim thedate As Date
            thedate = Me.CurrentTimeSeries.Data(i, 0)
            thisdate = thedate.ToOADate()
            thisval = Me.CurrentTimeSeries.Data(i, 1)
            QuickChart.Series(0).AddXY(thisdate, thisval, "", 0)
        Next i
        With QuickChart.Series(0)
            QuickChart.Series(0).XValues.DateTime = True
            QuickChart.Series(0).Color = System.Drawing.ColorTranslator.ToOle(Drawing.Color.Red)
            .Marks.Visible = False
            .Title = Me.CurrentWCS.WCSID & " " & Me.CurrentTimeSeries.Variable
            QuickChart.Header.Text.Add(CStr(.Title))
            '.asLine.LinePen.Color = System.Drawing.ColorTranslator.ToOle(Drawing.Color.Red)
            '.Color = System.Drawing.ColorTranslator.ToOle(Drawing.Color.Red)
        End With
        QuickChart.Legend.Visible = False
        With QuickChart.Zoom
            .Animated = True
            .Brush.Style = TeeChart.EBrushStyle.bsFill20
            .Brush.Color = System.Drawing.KnownColor.Yellow
            .Pen.Style = TeeChart.EChartPenStyle.psDash
            .Pen.Color = System.Drawing.ColorTranslator.ToOle(Drawing.Color.Red)
        End With



    End Sub
[/size][/code]

Posted: Tue Aug 22, 2006 9:14 am
by narcis
Hi GWRI,

It works fine for me here usint latest TeeChart for .NET v2 maintenance release available and this code:

Code: Select all

        TChart1.Series(1).Color = Drawing.Color.Red