Page 1 of 1

Colors incorrect as adding data to bar series in random ...

Posted: Tue Jun 10, 2008 7:12 am
by 14048132
Greetings,

   I found that if I add data to bar series in radom order, the color of bars would not be in my expectation.

   Did I misuse the bar series? Would you please help to check this? Thanks.

Code: Select all

    Private Sub mDrawBarInOrder(ByRef tchart As Steema.TeeChart.TChart)
        Dim bar As New Steema.TeeChart.Styles.Bar()

        bar.Add(0, 9, "item1", System.Drawing.Color.Red)
        bar.Add(1, 10, "item2", System.Drawing.Color.Red)

        tchart.Series.Add(bar)
    End Sub

    Private Sub mNOT_DrawBarInOrder(ByRef tchart As Steema.TeeChart.TChart)
        Dim bar As New Steema.TeeChart.Styles.Bar()

        bar.Add(1, 10, "item2", System.Drawing.Color.Red)
        bar.Add(0, 9, "item1", System.Drawing.Color.Red)

        tchart.Series.Add(bar)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.mDrawBarInOrder(TChart1)

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Me.mNOT_DrawBarInOrder(TChart2)
    End Sub

Posted: Tue Jun 10, 2008 10:02 am
by narcis
Hi Chris.CHWU,

You may need to set bar's YValues order to none before adding values to the series in the mNOT_DrawBarInOrder method, for example:

Code: Select all

    Private Sub mNOT_DrawBarInOrder(ByRef tchart As Steema.TeeChart.TChart)
        Dim bar As New Steema.TeeChart.Styles.Bar()

        bar.YValues.Order = Steema.TeeChart.Styles.ValueListOrder.None
        bar.Add(1, 10, "item2", System.Drawing.Color.Red)
        bar.Add(0, 9, "item1", System.Drawing.Color.Red)

        tchart.Series.Add(bar)
    End Sub

Posted: Wed Jun 11, 2008 3:24 am
by 14048132
Hi Narcis,

    I copied your code to build my program, but the result was the same.
    I set bars on location 0, 1 both System.Color.Red, but only bar on location 0 is Red and the other seems dark blue.

    If I add data in order, both bars on location 0, 1 are in red.

Posted: Wed Jun 11, 2008 7:33 am
by narcis
Hi Chris.CHWU,

Using your code works fine for me here using latest TeeChart for .NET v3 maintenance release, it plots all bars in red. Which TeeChart version are you using?

Thanks in advance.

Posted: Wed Jun 11, 2008 9:47 am
by 14048132
Hi Narcis,

    I'm using TeeChart for .NET v3 2008/5/23 release version.
    Is this version as same as yours?

Posted: Wed Jun 11, 2008 10:19 am
by narcis
Hi Chris.CHWU,

Sorry, no. I was using our latest sources. Using the same build as you I can reproduce the problem but works fine using current sources so you may expect this being fixed in the next maintenance release.

I recommend you to be aware at this forum or subscribe to our RSS feed for new release announcements.